Documentation
¶
Overview ¶
Package swagger_type_array exercises the schemaBuilder fallthrough path added by #11: when swagger:type is set to a value not recognised by swaggerSchemaForType (e.g. "array"), the builder falls through to the underlying type resolution rather than silently emitting an empty schema.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NamedFixedArray ¶
type NamedFixedArray [5]string
NamedFixedArray is a named fixed-length array type carrying swagger:type array. The fix makes buildNamedArray inline it rather than fall through to $ref.
swagger:type array
type NamedStringSlice ¶
type NamedStringSlice []string
NamedStringSlice is a named slice type carrying swagger:type array. With the fix it expands to {type: "array", items: {type: "string"}} via buildNamedSlice, preserving the field description on the enclosing struct instead of dropping it behind a $ref.
swagger:type array
type ObjectStruct ¶
ObjectStruct carries swagger:type object (unsupported by swaggerSchemaForType for structs). The fix inlines the struct as type:object rather than producing an empty schema.
swagger:type object swagger:model objectStruct
type Payload ¶
type Payload struct {
// Tags for this item.
Tags NamedStringSlice `json:"tags"`
// Labels for this item.
Labels NamedFixedArray `json:"labels"`
// The nested struct with an unsupported swagger:type.
Nested StructWithBadType `json:"nested"`
// Headers for this request.
Headers ObjectStruct `json:"headers"`
}
Payload aggregates all four cases so a full scan walks every branch.
swagger:model payload
type StructWithBadType ¶
type StructWithBadType struct {
Name string `json:"name"`
}
StructWithBadType is a struct whose swagger:type is set to an unrecognised value. The fix ensures buildNamedStruct falls through to makeRef so the property is still serialisable — the key assertion is that the referenced schema is not empty.
swagger:type badvalue swagger:model structWithBadType