Documentation
¶
Index ¶
- Constants
- type AdditionalProperties
- type BoolSchema
- type Callback
- type CallbackRef
- type Callbacks
- type Components
- type Content
- type Discriminator
- type Document
- type Encoding
- type Encodings
- type Example
- type ExampleRef
- type Examples
- type ExclusiveBound
- type ExternalDocs
- type FieldLocations
- type Header
- type HeaderRef
- type Headers
- type Info
- type Link
- type LinkRef
- type Links
- type Location
- type MappingRef
- type MediaType
- type Operation
- type Origin
- type Parameter
- type ParameterRef
- type Parameters
- type ParametersMap
- type PathItem
- type Paths
- type RequestBodies
- type RequestBody
- type RequestBodyRef
- type Response
- type ResponseBodies
- type ResponseRef
- type Responses
- func (responses *Responses) Default() *ResponseRef
- func (responses *Responses) Delete(key string)
- func (responses *Responses) Keys() []string
- func (responses *Responses) Len() int
- func (responses *Responses) Map() map[string]*ResponseRef
- func (responses *Responses) Set(key string, value *ResponseRef)
- func (responses *Responses) Status(status int) *ResponseRef
- func (responses *Responses) Value(key string) *ResponseRef
- type Schema
- func (schema *Schema) NewRef() *SchemaRef
- func (schema *Schema) WithAnyAdditionalProperties() *Schema
- func (schema *Schema) WithEnum(values ...any) *Schema
- func (schema *Schema) WithMaxLength(i int64) *Schema
- func (schema *Schema) WithProperty(name string, propertySchema *Schema) *Schema
- func (schema *Schema) WithPropertyRef(name string, ref *SchemaRef) *Schema
- func (schema *Schema) WithoutAdditionalProperties() *Schema
- type SchemaRef
- type SchemaRefs
- type Schemas
- type SecurityRequirement
- type SecurityRequirements
- type SecurityScheme
- type SecuritySchemeRef
- type SecuritySchemes
- type Server
- type ServerVariable
- type ServerVariables
- type Servers
- type Tag
- type Tags
- type Types
- type XML
Constants ¶
const ( ParameterInPath = "path" ParameterInQuery = "query" ParameterInHeader = "header" ParameterInCookie = "cookie" )
Where a parameter lives.
const ( TypeArray = "array" TypeBoolean = "boolean" TypeInteger = "integer" TypeNumber = "number" TypeObject = "object" TypeString = "string" TypeNull = "null" )
JSON Schema type names, matching kin-openapi's constants.
const MethodQuery = "QUERY"
MethodQuery is the HTTP QUERY method, a fixed Path Item field in OpenAPI 3.2.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalProperties ¶
type AdditionalProperties = BoolSchema
AdditionalProperties is a BoolSchema. The name matches kin-openapi.
type BoolSchema ¶
BoolSchema is a keyword that is either a boolean or a schema, used for additionalProperties, unevaluatedProperties and unevaluatedItems.
type Callback ¶
type Callback struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
Callback is an OpenAPI Callback Object, mapping an expression to a path item.
func (*Callback) Map ¶
Map returns a copy of the callback entries. The copy is empty, never nil, when callback is nil or has no entries.
type CallbackRef ¶
type CallbackRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Callback
}
CallbackRef is a callback or a $ref to one.
type Callbacks ¶
type Callbacks map[string]*CallbackRef
Callbacks are named callbacks, on an operation or in components.
type Components ¶
type Components struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Schemas Schemas `json:"schemas,omitempty" yaml:"schemas,omitempty"`
Parameters ParametersMap `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"`
RequestBodies RequestBodies `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
Responses ResponseBodies `json:"responses,omitempty" yaml:"responses,omitempty"`
SecuritySchemes SecuritySchemes `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"`
Links Links `json:"links,omitempty" yaml:"links,omitempty"`
Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
}
Components is an OpenAPI Components Object.
type Discriminator ¶
type Discriminator struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
PropertyName string `json:"propertyName" yaml:"propertyName"`
Mapping map[string]MappingRef `json:"mapping,omitempty" yaml:"mapping,omitempty"`
}
Discriminator is an OpenAPI Discriminator Object.
type Document ¶
type Document struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
OpenAPI string `json:"openapi" yaml:"openapi"`
Components *Components `json:"components,omitempty" yaml:"components,omitempty"`
Info *Info `json:"info" yaml:"info"`
Paths *Paths `json:"paths" yaml:"paths"`
Security SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"`
Tags Tags `json:"tags,omitempty" yaml:"tags,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Webhooks map[string]*PathItem `json:"webhooks,omitempty" yaml:"webhooks,omitempty"` // OpenAPI >=3.1
}
Document is the root of an OpenAPI 3 document. Kin-openapi calls this T.
func (*Document) IsOpenAPI31OrLater ¶
IsOpenAPI31OrLater reports whether the document is OpenAPI 3.1 or 3.2. Only the version strings kin-openapi recognizes count: a patch it does not list, such as "3.1.3", is not.
func (*Document) OpenAPIMajorMinor ¶
OpenAPIMajorMinor returns the "3.y" of an OpenAPI version string kin recognizes, or "" for a nil document and for any string it does not.
type Encoding ¶
type Encoding struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"`
Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"`
Style string `json:"style,omitempty" yaml:"style,omitempty"`
Explode *bool `json:"explode,omitempty" yaml:"explode,omitempty"`
AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
}
Encoding is an OpenAPI Encoding Object.
type Example ¶
type Example struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Value any `json:"value,omitempty" yaml:"value,omitempty"`
ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
}
Example is an OpenAPI Example Object. Present so a reference can resolve; the generator does not read its fields.
type ExampleRef ¶
type ExampleRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Example
}
ExampleRef is an example or a $ref to one. The generator tracks the reference; it does not read the example value.
type ExclusiveBound ¶
ExclusiveBound is exclusiveMinimum or exclusiveMaximum. OpenAPI 3.0 stores a boolean in Bool; OpenAPI 3.1 stores the bound in Value.
type ExternalDocs ¶
type ExternalDocs struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
ExternalDocs is an OpenAPI External Documentation Object.
type FieldLocations ¶
type FieldLocations []Location
FieldLocations holds the locations of a collection's scalar fields, in document order. It is a slice rather than a map, matching kin-openapi: each Location already carries its Name.
func (FieldLocations) Get ¶
func (f FieldLocations) Get(name string) Location
Get returns the location of the named field, or the zero Location when the field has none. Use Lookup to tell an absent field from a zero location.
type Header ¶
type Header struct {
Parameter
}
Header is an OpenAPI Header Object. It is a parameter without name or in.
type HeaderRef ¶
type HeaderRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Header
}
HeaderRef is a header or a $ref to one.
type Info ¶
type Info struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Title string `json:"title" yaml:"title"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` // OpenAPI >=3.1
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Version string `json:"version" yaml:"version"`
}
Info is an OpenAPI Info Object. Contact, license and terms of service are omitted: the generator does not read them.
type Link ¶
type Link struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Parameters map[string]any `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Server *Server `json:"server,omitempty" yaml:"server,omitempty"`
RequestBody any `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
}
Link is an OpenAPI Link Object. Present so a reference can resolve; the generator does not read its fields.
type LinkRef ¶
type LinkRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Link
}
LinkRef is a link or a $ref to one. The generator tracks the reference; it does not read the link.
type Location ¶
type Location struct {
File string `json:"file,omitempty" yaml:"file,omitempty"`
Line int `json:"line,omitempty" yaml:"line,omitempty"`
Column int `json:"column,omitempty" yaml:"column,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
// EndLine and EndColumn mark the end of the block this location heads
// (set only on Origin.Key). Both are zero when the source carried no end.
EndLine int `json:"endLine,omitempty" yaml:"endLine,omitempty"`
EndColumn int `json:"endColumn,omitempty" yaml:"endColumn,omitempty"`
}
Location is the source position of a field.
type MappingRef ¶
type MappingRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Ref string
Value *Schema
}
MappingRef is one discriminator mapping value. Kin serializes it as a plain string; the generator reads Ref.
type MediaType ¶
type MediaType struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
ItemSchema *SchemaRef `json:"itemSchema,omitempty" yaml:"itemSchema,omitempty"` // OpenAPI >=3.2
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"`
Encoding Encodings `json:"encoding,omitempty" yaml:"encoding,omitempty"`
}
MediaType is an OpenAPI Media Type Object.
type Operation ¶
type Operation struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
RequestBody *RequestBodyRef `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
Responses *Responses `json:"responses" yaml:"responses"`
Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`
Servers *Servers `json:"servers,omitempty" yaml:"servers,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
Operation is an OpenAPI Operation Object.
type Origin ¶
type Origin struct {
Key *Location `json:"key,omitempty" yaml:"key,omitempty"`
Fields FieldLocations `json:"fields,omitempty" yaml:"fields,omitempty"`
Sequences map[string][]Location `json:"sequences,omitempty" yaml:"sequences,omitempty"`
}
Origin is where a collection was written in its source document. Key is the collection itself. Fields holds each scalar field. Sequences holds each item of a sequence-valued field, keyed by the field name.
The shape matches kin-openapi's Origin, including source positions the generator reads (route order uses Key.Line).
type Parameter ¶
type Parameter struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
In string `json:"in,omitempty" yaml:"in,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Style string `json:"style,omitempty" yaml:"style,omitempty"`
Explode *bool `json:"explode,omitempty" yaml:"explode,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Schema *SchemaRef `json:"schema,omitempty" yaml:"schema,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"`
Content Content `json:"content,omitempty" yaml:"content,omitempty"`
}
Parameter is an OpenAPI Parameter Object.
type ParameterRef ¶
type ParameterRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Parameter
}
ParameterRef is a parameter or a $ref to one.
type Parameters ¶
type Parameters []*ParameterRef
Parameters is an operation or path item's parameter list.
type ParametersMap ¶
type ParametersMap map[string]*ParameterRef
ParametersMap is the components' named parameters.
type PathItem ¶
type PathItem struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Connect *Operation `json:"connect,omitempty" yaml:"connect,omitempty"`
Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
Get *Operation `json:"get,omitempty" yaml:"get,omitempty"`
Head *Operation `json:"head,omitempty" yaml:"head,omitempty"`
Options *Operation `json:"options,omitempty" yaml:"options,omitempty"`
Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
Post *Operation `json:"post,omitempty" yaml:"post,omitempty"`
Put *Operation `json:"put,omitempty" yaml:"put,omitempty"`
Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"`
Query *Operation `json:"query,omitempty" yaml:"query,omitempty"` // OpenAPI >=3.2
Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"`
Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
// AdditionalOperations maps custom HTTP methods to operations (OpenAPI 3.2).
// Keys must not repeat the methods that have their own fields above.
AdditionalOperations map[string]*Operation `json:"additionalOperations,omitempty" yaml:"additionalOperations,omitempty"`
}
PathItem is an OpenAPI Path Item Object.
func (*PathItem) GetOperation ¶
GetOperation returns the operation registered for method, or nil.
func (*PathItem) Operations ¶
Operations returns the path item's operations keyed by HTTP method, including QUERY and AdditionalOperations. A fixed field wins when an additional key collides with it.
func (*PathItem) SetOperation ¶
SetOperation registers operation under method, replacing any previous one. A nil operation clears it. Methods other than the fixed path-item fields are stored in AdditionalOperations.
type Paths ¶
type Paths struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
Paths is an OpenAPI Paths Object. The entries live in an unexported map, as they do in kin-openapi, so Map returns a copy and iteration order is not part of the value.
func (*Paths) Find ¶
Find returns the path item whose template matches key.
A direct key wins. Otherwise the match ignores template variable names (a "{name*}" wildcard still matches only the same normalized pattern). For example Find("/person/{name}") returns the item stored at "/person/{personName}".
func (*Paths) Map ¶
Map returns a copy of the paths. The copy is empty, never nil, when paths is nil or has no entries. Iteration order is not significant.
type RequestBodies ¶
type RequestBodies map[string]*RequestBodyRef
RequestBodies are the components' named request bodies.
type RequestBody ¶
type RequestBody struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Content Content `json:"content" yaml:"content"`
}
RequestBody is an OpenAPI Request Body Object.
type RequestBodyRef ¶
type RequestBodyRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *RequestBody
}
RequestBodyRef is a request body or a $ref to one.
type Response ¶
type Response struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Headers Headers `json:"headers,omitempty" yaml:"headers,omitempty"`
Content Content `json:"content,omitempty" yaml:"content,omitempty"`
Links Links `json:"links,omitempty" yaml:"links,omitempty"`
}
Response is an OpenAPI Response Object.
type ResponseBodies ¶
type ResponseBodies map[string]*ResponseRef
ResponseBodies are the components' named responses.
type ResponseRef ¶
type ResponseRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *Response
}
ResponseRef is a response or a $ref to one.
type Responses ¶
type Responses struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// contains filtered or unexported fields
}
Responses is an OpenAPI Responses Object.
func (*Responses) Default ¶
func (responses *Responses) Default() *ResponseRef
Default returns the default response, or nil.
func (*Responses) Map ¶
func (responses *Responses) Map() map[string]*ResponseRef
Map returns a copy of the responses. The copy is empty, never nil, when responses is nil or has no entries.
func (*Responses) Set ¶
func (responses *Responses) Set(key string, value *ResponseRef)
Set adds or replaces key. responses must be non-nil.
func (*Responses) Status ¶
func (responses *Responses) Status(status int) *ResponseRef
Status returns the response for status. An exact key wins. Otherwise a patterned key is used from the status class, such as 201 falling through to "2XX". Statuses outside 100–599 have no patterned key.
func (*Responses) Value ¶
func (responses *Responses) Value(key string) *ResponseRef
Value returns the response for key, or nil.
type Schema ¶
type Schema struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
OneOf SchemaRefs `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
AnyOf SchemaRefs `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
AllOf SchemaRefs `json:"allOf,omitempty" yaml:"allOf,omitempty"`
Not *SchemaRef `json:"not,omitempty" yaml:"not,omitempty"`
Type *Types `json:"type,omitempty" yaml:"type,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"`
Default any `json:"default,omitempty" yaml:"default,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
// Array-related, here for struct compactness
UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
// Number-related, here for struct compactness
ExclusiveMin ExclusiveBound `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` // Number for v3.1+ otherwise boolean
ExclusiveMax ExclusiveBound `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` // Number for v3.1+ otherwise boolean
// Properties
Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty"`
ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
WriteOnly bool `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
XML *XML `json:"xml,omitempty" yaml:"xml,omitempty"`
// Number
Min *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
Max *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
// String
MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"`
MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
// Array
MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"`
MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
Items *SchemaRef `json:"items,omitempty" yaml:"items,omitempty"`
// Object
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
Properties Schemas `json:"properties,omitempty" yaml:"properties,omitempty"`
MinProps uint64 `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
MaxProps *uint64 `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
AdditionalProperties AdditionalProperties `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
Const any `json:"const,omitempty" yaml:"const,omitempty"` // OpenAPI >=3.1
Examples []any `json:"examples,omitempty" yaml:"examples,omitempty"` // OpenAPI >=3.1
PrefixItems SchemaRefs `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"` // OpenAPI >=3.1
Contains *SchemaRef `json:"contains,omitempty" yaml:"contains,omitempty"` // OpenAPI >=3.1
MinContains *uint64 `json:"minContains,omitempty" yaml:"minContains,omitempty"` // OpenAPI >=3.1
MaxContains *uint64 `json:"maxContains,omitempty" yaml:"maxContains,omitempty"` // OpenAPI >=3.1
PatternProperties Schemas `json:"patternProperties,omitempty" yaml:"patternProperties,omitempty"` // OpenAPI >=3.1
DependentSchemas Schemas `json:"dependentSchemas,omitempty" yaml:"dependentSchemas,omitempty"` // OpenAPI >=3.1
PropertyNames *SchemaRef `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"` // OpenAPI >=3.1
UnevaluatedItems BoolSchema `json:"unevaluatedItems,omitempty" yaml:"unevaluatedItems,omitempty"` // OpenAPI >=3.1
UnevaluatedProperties BoolSchema `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"` // OpenAPI >=3.1
If *SchemaRef `json:"if,omitempty" yaml:"if,omitempty"` // OpenAPI >=3.1
Then *SchemaRef `json:"then,omitempty" yaml:"then,omitempty"` // OpenAPI >=3.1
Else *SchemaRef `json:"else,omitempty" yaml:"else,omitempty"` // OpenAPI >=3.1
DependentRequired map[string][]string `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"` // OpenAPI >=3.1
// Always is set when the schema was written as a JSON Schema boolean
// schema rather than an object: true accepts every instance, false
// accepts none. Nil for an ordinary object schema. OpenAPI >=3.1.
Always *bool `json:"-" yaml:"-"`
Defs Schemas `json:"$defs,omitempty" yaml:"$defs,omitempty"` // OpenAPI >=3.1
SchemaDialect string `json:"$schema,omitempty" yaml:"$schema,omitempty"` // OpenAPI >=3.1
Comment string `json:"$comment,omitempty" yaml:"$comment,omitempty"` // OpenAPI >=3.1
SchemaID string `json:"$id,omitempty" yaml:"$id,omitempty"` // OpenAPI >=3.1
Anchor string `json:"$anchor,omitempty" yaml:"$anchor,omitempty"` // OpenAPI >=3.1
DynamicRef string `json:"$dynamicRef,omitempty" yaml:"$dynamicRef,omitempty"` // OpenAPI >=3.1
DynamicAnchor string `json:"$dynamicAnchor,omitempty" yaml:"$dynamicAnchor,omitempty"` // OpenAPI >=3.1
ContentMediaType string `json:"contentMediaType,omitempty" yaml:"contentMediaType,omitempty"` // OpenAPI >=3.1
ContentEncoding string `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"` // OpenAPI >=3.1
ContentSchema *SchemaRef `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"` // OpenAPI >=3.1
}
Schema is an OpenAPI Schema Object. Field order and json keywords match kin-openapi's Schema: the generator reflects over every field to name the keywords an allOf merge cannot fold, so a missing or reordered field changes that result.
func NewObjectSchema ¶
func NewObjectSchema() *Schema
NewObjectSchema builds a schema of type object with an empty property map.
func NewStringSchema ¶
func NewStringSchema() *Schema
NewStringSchema builds a schema of type string.
func (*Schema) WithAnyAdditionalProperties ¶
WithAnyAdditionalProperties sets additionalProperties to true.
func (*Schema) WithMaxLength ¶
WithMaxLength sets maxLength.
func (*Schema) WithProperty ¶
WithProperty sets a property to propertySchema.
func (*Schema) WithPropertyRef ¶
WithPropertyRef sets a property to ref.
func (*Schema) WithoutAdditionalProperties ¶
WithoutAdditionalProperties sets additionalProperties to false.
type SchemaRef ¶
type SchemaRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Ref string
Value *Schema
}
SchemaRef is a schema or a $ref to one. Ref is the authored reference. When both are set, Ref names the reference and Value is what it resolved to.
func NewSchemaRef ¶
NewSchemaRef builds a SchemaRef.
type SchemaRefs ¶
type SchemaRefs []*SchemaRef
SchemaRefs is a list of schema references, as in allOf, anyOf and oneOf.
type SecurityRequirement ¶
SecurityRequirement maps a security scheme name to the scopes it requires.
type SecurityRequirements ¶
type SecurityRequirements []SecurityRequirement
SecurityRequirements is a list of alternative security requirements.
type SecurityScheme ¶
type SecurityScheme struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
In string `json:"in,omitempty" yaml:"in,omitempty"`
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
BearerFormat string `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
OpenIdConnectUrl string `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
}
SecurityScheme is an OpenAPI Security Scheme Object. OAuth flows are omitted: the generator does not read them.
type SecuritySchemeRef ¶
type SecuritySchemeRef struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
// Summary and Description are OpenAPI 3.1 reference-object fields.
Summary *string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Ref string
Value *SecurityScheme
}
SecuritySchemeRef is a security scheme or a $ref to one.
type SecuritySchemes ¶
type SecuritySchemes map[string]*SecuritySchemeRef
SecuritySchemes are the components' named security schemes.
type Server ¶
type Server struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
URL string `json:"url" yaml:"url"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Variables ServerVariables `json:"variables,omitempty" yaml:"variables,omitempty"`
}
Server is an OpenAPI Server Object.
type ServerVariable ¶
type ServerVariable struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"`
Default string `json:"default,omitempty" yaml:"default,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
ServerVariable is an OpenAPI Server Variable Object.
type ServerVariables ¶
type ServerVariables map[string]*ServerVariable
ServerVariables maps a variable name to its definition.
type Tag ¶
type Tag struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}
Tag is an OpenAPI Tag Object.
type Types ¶
type Types []string
Types is the type or types of a schema. OpenAPI 3.0 has one entry; OpenAPI 3.1 may have several, including "null".
func (*Types) Includes ¶
Includes reports whether typ is one of the types. Nil types include nothing.
type XML ¶
type XML struct {
Extensions map[string]any `json:"-" yaml:"-"`
Origin *Origin `json:"-" yaml:"-"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
Prefix string `json:"prefix,omitempty" yaml:"prefix,omitempty"`
Attribute bool `json:"attribute,omitempty" yaml:"attribute,omitempty"`
Wrapped bool `json:"wrapped,omitempty" yaml:"wrapped,omitempty"`
}
XML is an OpenAPI XML Object.