Request Unions
Unions are represented as a struct with fields prefixed by “Of” for each of its variants, only one field can be non-zero. The non-zero field will be serialized. Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.Request Union Structure
Request Union Example
Only one field of the union can be non-zero. Use
param.IsOmitted() to check if a field is set.Response Unions
In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the.AsFooVariant() method or the .AsAny() method if present.
If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with
Of and feature the tag json:"...,inline".