Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscriminatorSchema ¶
type DiscriminatorSchema struct {
// PropertyName is the name of the property that holds the type tag.
PropertyName string `json:",omitempty"`
// Mapping is an optional explicit tag-value → $ref map.
Mapping map[string]string `json:",omitempty"`
}
DiscriminatorSchema describes the polymorphism discriminator field used in TaggedUnion schemas. It maps to the OpenAPI 3.x / AsyncAPI discriminator object.
type Property ¶
Property is a named schema entry inside an object's properties list. Using a slice of Property (rather than a map) preserves the registration order, giving deterministic YAML/JSON output across runs.
type Schema ¶
type Schema struct {
Type string `json:",omitempty"`
Title string `json:",omitempty"`
Description string `json:",omitempty"`
Format string `json:",omitempty"`
Example any `json:",omitempty"`
Properties []Property `json:",omitempty"`
Required []string `json:",omitempty"`
Enum []any `json:",omitempty"`
OneOf []Schema `json:",omitempty"`
Items *Schema `json:",omitempty"`
// Nullable marks the value as accepting null in addition to its type.
// Renders as "nullable: true" in OpenAPI 3.0 / AsyncAPI.
Nullable bool `json:",omitempty"`
// AdditionalProperties controls whether undeclared properties are allowed.
// nil = unset (spec default), false = no additional properties, true = any allowed.
AdditionalProperties *bool `json:",omitempty"`
// AdditionalPropertiesSchema constrains the type of additional properties.
// When set, takes precedence over AdditionalProperties and renders as a schema object.
// Used by StringMap to express map[string]V where V has a specific schema.
AdditionalPropertiesSchema *Schema `json:",omitempty"`
// Discriminator describes the polymorphism tag for TaggedUnion schemas.
Discriminator *DiscriminatorSchema `json:",omitempty"`
// Numeric constraints.
Minimum *float64 `json:",omitempty"`
Maximum *float64 `json:",omitempty"`
ExclusiveMinimum bool `json:",omitempty"`
ExclusiveMaximum bool `json:",omitempty"`
// String constraints.
MinLength *int `json:",omitempty"`
MaxLength *int `json:",omitempty"`
Pattern string `json:",omitempty"`
// Deprecated marks this schema as deprecated in generated documentation.
Deprecated bool `json:",omitempty"`
// Default is the default value for this schema, used when the field is absent.
Default any `json:",omitempty"`
}
Schema describes the shape of a value for documentation and validation purposes.
Click to show internal directories.
Click to hide internal directories.