Documentation
¶
Overview ¶
Package refexamplecoercion exercises doc-quirk G3: a JSON-literal example: / default: on a field whose type is a $ref must be coerced into a structured value on the allOf override arm, exactly as it is on a plain (non-ref) field. Before the fix the literal rode the override arm as a raw string ("{\"name\":\"x\"}" rather than {"name":"x"}).
The referenced model (Pet) gives the field a $ref, so its sibling keywords (example, default) land on allOf[1]; the coercion that runs on the direct-field path must run here too.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Holder ¶
type Holder struct {
// a single pet, with a JSON-object example riding the override arm
// example: {"name":"Rex"}
Pet Pet `json:"pet"`
// a single pet, with a JSON-object default riding the override arm
// default: {"name":"Default"}
DefaultPet Pet `json:"defaultPet"`
// a tag, with a JSON-array example riding the override arm
// example: [{"value":"a"},{"value":"b"}]
Tags Tag `json:"tags"`
// a scalar example on a $ref'd field is left as a plain string (the
// referenced type is unknown on the override arm; only JSON object /
// array literals are coerced).
// example: plain-scalar
Plain Pet `json:"plain"`
}
Holder carries fields typed by other models, each annotated with a JSON-literal example/default that must coerce structurally.
swagger:model Holder