Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAndMarshalToMap ¶
ValidateAndMarshalToMap marshals the JSON-body fields of a struct into a map whose shape matches the actual wire payload, so generated examples agree with the generated schema. It mirrors encoding/json with one deliberate exception: exported fields without a json tag (path/query/header-only request fields) are dropped so body examples stay payload-only.
In particular, and unlike a naive "skip every empty value" marshaller:
- a non-omitempty pointer that is nil is emitted as JSON null — a nullable "value or null" response field stays visible instead of vanishing;
- omitempty/omitzero fields are dropped only when empty, exactly like the wire;
- field.Optional[T]/field.Clearable[T] encode through their own MarshalJSON (set value, or null for an explicit Clearable clear) and drop when unset.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.