Documentation
¶
Overview ¶
Package additionalprops exercises the type-level swagger:additionalProperties marker: true / false / a typed value / a model reference, the map-override case, coexistence with other object validations, and the lowest-priority precedence rule (the marker only rides on an object).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowExtras ¶
type AllowExtras struct {
A string `json:"a"`
}
AllowExtras is an open object: named properties plus arbitrary extra keys.
swagger:model AllowExtras swagger:additionalProperties true
type BoundedExtras ¶
type BoundedExtras struct {
A string `json:"a"`
}
BoundedExtras shows additionalProperties coexisting with maxProperties.
maxProperties: 10
swagger:model BoundedExtras swagger:additionalProperties true
type Contradiction ¶
type Contradiction struct {
A string `json:"a"`
}
Contradiction resolves to a string via swagger:type; additionalProperties is the lowest-priority annotation, so it is dropped with a diagnostic.
swagger:model Contradiction swagger:type string swagger:additionalProperties true
type ForbidExtras ¶
ForbidExtras is a closed object: named properties only, no extra keys.
swagger:model ForbidExtras swagger:additionalProperties false
type OverrideMap ¶
OverrideMap is a map whose element schema (string) is overridden by the marker to integer additionalProperties.
swagger:model OverrideMap swagger:additionalProperties integer
type RefExtras ¶
type RefExtras struct {
A string `json:"a"`
}
RefExtras references a model as its additionalProperties value schema.
swagger:model RefExtras swagger:additionalProperties Thing
type Thing ¶
type Thing struct {
Name string `json:"name"`
}
Thing is referenced as an additionalProperties value type.
swagger:model Thing
type TypedExtras ¶
type TypedExtras struct {
A string `json:"a"`
}
TypedExtras complements its named property with typed (integer) values.
swagger:model TypedExtras swagger:additionalProperties integer