Documentation
¶
Index ¶
- Constants
- func MarshalJSON(value any) ([]byte, error)
- func MarshalYAML(value any) ([]byte, error)
- type Callback
- type Components
- type Config
- type Contact
- type ContentUnit
- type Discriminator
- type Document
- type Encoding
- type Example
- type ExternalDocs
- type Header
- type Info
- type License
- type Link
- type MediaType
- type OAuthFlow
- type OAuthFlows
- type Operation
- type Parameter
- type ParameterIn
- type PathItem
- type PathParser
- type ReflectorConfig
- type RequestBody
- type Response
- type Schema
- type SecurityRequirement
- type SecurityScheme
- type SecuritySchemeAPIKeyIn
- type Server
- type ServerVariable
- type Tag
- type TypeMapping
- type XML
Constants ¶
const ( // Version300 is OpenAPI 3.0.0. Version300 = "3.0.0" // Version301 is OpenAPI 3.0.1. Version301 = "3.0.1" // Version302 is OpenAPI 3.0.2. Version302 = "3.0.2" // Version303 is OpenAPI 3.0.3. Version303 = "3.0.3" // Version304 is OpenAPI 3.0.4. Version304 = "3.0.4" // Version310 is OpenAPI 3.1.0. Version310 = "3.1.0" // Version311 is OpenAPI 3.1.1. Version311 = "3.1.1" // Version312 is OpenAPI 3.1.2. Version312 = "3.1.2" // Version320 is OpenAPI 3.2.0. Version320 = "3.2.0" )
Variables ¶
This section is empty.
Functions ¶
func MarshalJSON ¶ added in v0.5.0
MarshalJSON marshals an OpenAPI value while merging x-* extensions into objects.
func MarshalYAML ¶ added in v0.5.0
MarshalYAML marshals an OpenAPI value while merging x-* extensions into objects.
Types ¶
type Callback ¶ added in v0.5.0
type Callback struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Expressions map[string]*PathItem `json:"-" yaml:"-"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Callback represents the OpenAPI Callback Object.
type Components ¶ added in v0.5.0
type Components struct {
Schemas map[string]*Schema `json:"schemas,omitempty" yaml:"schemas,omitempty"`
Responses map[string]*Response `json:"responses,omitempty" yaml:"responses,omitempty"`
Parameters map[string]*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Examples map[string]*Example `json:"examples,omitempty" yaml:"examples,omitempty"`
RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
SecuritySchemes map[string]*SecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
Links map[string]*Link `json:"links,omitempty" yaml:"links,omitempty"`
Callbacks map[string]*Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
PathItems map[string]*PathItem `json:"pathItems,omitempty" yaml:"pathItems,omitempty"`
MediaTypes map[string]*MediaType `json:"mediaTypes,omitempty" yaml:"mediaTypes,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Components represents the OpenAPI Components Object.
type Config ¶
type Config struct {
OpenAPIVersion string
Self string
Title string
InfoSummary string
Version string
Description *string
JSONSchemaDialect string
Contact *Contact
License *License
TermsOfService *string
Servers []Server
SecuritySchemes map[string]*SecurityScheme
Security []SecurityRequirement
Tags []Tag
ExternalDocs *ExternalDocs
ReflectorConfig *ReflectorConfig
StripTrailingSlash bool
PathParser PathParser
DocumentCustomizers []func(*Document)
DocsPath string
SpecPath string
CacheAge *int
DisableDocs bool
UIProvider config.Provider
SwaggerUIConfig *config.SwaggerUI
StoplightElementsConfig *config.StoplightElements
ReDocConfig *config.ReDoc
ScalarConfig *config.Scalar
RapiDocConfig *config.RapiDoc
UIOption specui.Option
}
Config is the main configuration struct for generating an OpenAPI document. It contains all the necessary information and options to customize the generated document, including metadata, server information, security schemes, and UI configuration.
type Contact ¶
type Contact struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Email string `json:"email,omitempty" yaml:"email,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Contact represents the OpenAPI Contact Object.
type ContentUnit ¶ added in v0.2.0
type ContentUnit struct {
Structure any
HTTPStatus int
ContentType string
IsDefault bool
Summary string
Description string
Encoding map[string]string
Example any
Examples map[string]*Example
Required bool
Format string
}
ContentUnit is an internal content descriptor used by option builders.
type Discriminator ¶ added in v0.5.0
type Discriminator struct {
PropertyName string `json:"propertyName" yaml:"propertyName"`
Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"`
DefaultMapping string `json:"defaultMapping,omitempty" yaml:"defaultMapping,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Discriminator represents the OpenAPI Discriminator Object.
type Document ¶ added in v0.5.0
type Document struct {
OpenAPI string `json:"openapi" yaml:"openapi"`
Self string `json:"$self,omitempty" yaml:"$self,omitempty"`
Info Info `json:"info" yaml:"info"`
JSONSchemaDialect string `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"`
Servers []Server `json:"servers,omitempty" yaml:"servers,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Tags []Tag `json:"tags,omitempty" yaml:"tags,omitempty"`
Security []SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"`
Paths map[string]*PathItem `json:"paths" yaml:"paths"`
Webhooks map[string]*PathItem `json:"webhooks,omitempty" yaml:"webhooks,omitempty"`
Components *Components `json:"components,omitempty" yaml:"components,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Document represents an OpenAPI document root object.
type Encoding ¶ added in v0.5.0
type Encoding struct {
ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"`
Headers map[string]*Header `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 map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"`
PrefixEncoding []*Encoding `json:"prefixEncoding,omitempty" yaml:"prefixEncoding,omitempty"`
ItemEncoding *Encoding `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Encoding represents the OpenAPI Encoding Object.
type Example ¶ added in v0.5.0
type Example struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
DataValue any `json:"dataValue,omitempty" yaml:"dataValue,omitempty"`
Value any `json:"value,omitempty" yaml:"value,omitempty"`
ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
SerializedValue string `json:"serializedValue,omitempty" yaml:"serializedValue,omitempty"`
// Deprecated: OpenAPI 3.2 uses serializedValue. This field is accepted for
// source compatibility but is not serialized.
SerializedExample any `json:"-" yaml:"-"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Example represents the OpenAPI Example Object.
type ExternalDocs ¶
type ExternalDocs struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
URL string `json:"url" yaml:"url"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
ExternalDocs represents the OpenAPI External Documentation Object.
type Header ¶ added in v0.5.0
type Header struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,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"`
Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples map[string]*Example `json:"examples,omitempty" yaml:"examples,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Header represents the OpenAPI Header Object.
type Info ¶ added in v0.5.0
type Info struct {
Title string `json:"title" yaml:"title"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
TermsOfService *string `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"`
Contact *Contact `json:"contact,omitempty" yaml:"contact,omitempty"`
License *License `json:"license,omitempty" yaml:"license,omitempty"`
Version string `json:"version" yaml:"version"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Info represents the OpenAPI Info Object.
type License ¶
type License struct {
Name string `json:"name" yaml:"name"`
Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
License represents the OpenAPI License Object.
type Link ¶ added in v0.5.0
type Link struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
Parameters map[string]any `json:"parameters,omitempty" yaml:"parameters,omitempty"`
RequestBody any `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Server *Server `json:"server,omitempty" yaml:"server,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Link represents the OpenAPI Link Object.
type MediaType ¶ added in v0.5.0
type MediaType struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
ItemSchema *Schema `json:"itemSchema,omitempty" yaml:"itemSchema,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples map[string]*Example `json:"examples,omitempty" yaml:"examples,omitempty"`
Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"`
PrefixEncoding []*Encoding `json:"prefixEncoding,omitempty" yaml:"prefixEncoding,omitempty"`
ItemEncoding *Encoding `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
MediaType represents the OpenAPI Media Type Object.
type OAuthFlow ¶ added in v0.5.0
type OAuthFlow struct {
AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
DeviceAuthorizationURL string `json:"deviceAuthorizationUrl,omitempty" yaml:"deviceAuthorizationUrl,omitempty"`
TokenURL string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
RefreshURL *string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
Scopes map[string]string `json:"scopes" yaml:"scopes"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
OAuthFlow represents one OpenAPI OAuth Flow Object.
type OAuthFlows ¶
type OAuthFlows struct {
Implicit *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"`
Password *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"`
ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
DeviceAuthorization *OAuthFlow `json:"deviceAuthorization,omitempty" yaml:"deviceAuthorization,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
OAuthFlows represents the OpenAPI OAuth Flows Object.
type Operation ¶ added in v0.5.0
type Operation struct {
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`
Parameters []*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
Responses map[string]*Response `json:"responses" yaml:"responses"`
Callbacks map[string]*Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
Security []SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"`
Servers []Server `json:"servers,omitempty" yaml:"servers,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Operation represents the OpenAPI Operation Object.
type Parameter ¶ added in v0.5.0
type Parameter struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
In string `json:"in,omitempty" yaml:"in,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,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"`
Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples map[string]*Example `json:"examples,omitempty" yaml:"examples,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Parameter represents the OpenAPI Parameter Object.
type ParameterIn ¶ added in v0.3.6
type ParameterIn string
ParameterIn is the location of a parameter.
const ( // ParameterInPath indicates a path parameter. ParameterInPath ParameterIn = "path" // ParameterInQuery indicates a query parameter. ParameterInQuery ParameterIn = "query" // ParameterInQueryString indicates an OpenAPI 3.2 querystring parameter. ParameterInQueryString ParameterIn = "querystring" // ParameterInHeader indicates a header parameter. ParameterInHeader ParameterIn = "header" // ParameterInCookie indicates a cookie parameter. ParameterInCookie ParameterIn = "cookie" )
type PathItem ¶ added in v0.5.0
type PathItem struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Get *Operation `json:"get,omitempty" yaml:"get,omitempty"`
Put *Operation `json:"put,omitempty" yaml:"put,omitempty"`
Post *Operation `json:"post,omitempty" yaml:"post,omitempty"`
Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
Options *Operation `json:"options,omitempty" yaml:"options,omitempty"`
Head *Operation `json:"head,omitempty" yaml:"head,omitempty"`
Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"`
Query *Operation `json:"query,omitempty" yaml:"query,omitempty"`
AdditionalOperations map[string]*Operation `json:"additionalOperations,omitempty" yaml:"additionalOperations,omitempty"`
Servers []Server `json:"servers,omitempty" yaml:"servers,omitempty"`
Parameters []*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
PathItem represents the OpenAPI Path Item Object.
type PathParser ¶ added in v0.1.4
PathParser is an interface that defines a method for parsing a path string and returning a modified version of it. This can be used to customize how paths are represented in the generated OpenAPI document, allowing for transformations such as converting path parameters to a specific format or applying any other necessary modifications to the path strings.
type ReflectorConfig ¶
type ReflectorConfig struct {
InlineRefs bool
StripDefNamePrefix []string
InterceptDefName func(t reflect.Type, defaultDefName string) string
DefNameCallerPkg string
TypeMappings []TypeMapping
ParameterTagMapping map[ParameterIn]string
}
ReflectorConfig contains configuration options for the reflection process used to generate the OpenAPI document from Go types. It allows customization of how types are reflected, including inline references, stripping of definition name prefixes, and custom type mappings.
type RequestBody ¶ added in v0.5.0
type RequestBody struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Content map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
RequestBody represents the OpenAPI Request Body Object.
type Response ¶ added in v0.5.0
type Response struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"`
Content map[string]MediaType `json:"content,omitempty" yaml:"content,omitempty"`
Links map[string]*Link `json:"links,omitempty" yaml:"links,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Response represents the OpenAPI Response Object.
type Schema ¶ added in v0.5.0
type Schema struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Schema string `json:"$schema,omitempty" yaml:"$schema,omitempty"`
ID string `json:"$id,omitempty" yaml:"$id,omitempty"`
Defs map[string]*Schema `json:"$defs,omitempty" yaml:"$defs,omitempty"`
Anchor string `json:"$anchor,omitempty" yaml:"$anchor,omitempty"`
DynamicAnchor string `json:"$dynamicAnchor,omitempty" yaml:"$dynamicAnchor,omitempty"`
DynamicRef string `json:"$dynamicRef,omitempty" yaml:"$dynamicRef,omitempty"`
Vocabulary map[string]bool `json:"$vocabulary,omitempty" yaml:"$vocabulary,omitempty"`
Comment string `json:"$comment,omitempty" yaml:"$comment,omitempty"`
Title string `json:"title,omitempty" yaml:"title,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Type any `json:"type,omitempty" yaml:"type,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"`
Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty"`
Default any `json:"default,omitempty" yaml:"default,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
Examples []any `json:"examples,omitempty" yaml:"examples,omitempty"`
Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"`
Const any `json:"const,omitempty" yaml:"const,omitempty"`
MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
ExclusiveMaximum any `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
Minimum *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
ExclusiveMinimum any `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
MaxLength *int `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
MinLength *int `json:"minLength,omitempty" yaml:"minLength,omitempty"`
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
MaxItems *int `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
MinItems *int `json:"minItems,omitempty" yaml:"minItems,omitempty"`
UniqueItems *bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
MaxProperties *int `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
MinProperties *int `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
Required []string `json:"required,omitempty" yaml:"required,omitempty"`
Properties map[string]*Schema `json:"properties,omitempty" yaml:"properties,omitempty"`
PatternProperties map[string]*Schema `json:"patternProperties,omitempty" yaml:"patternProperties,omitempty"`
Items *Schema `json:"items,omitempty" yaml:"items,omitempty"`
PrefixItems []*Schema `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"`
Contains *Schema `json:"contains,omitempty" yaml:"contains,omitempty"`
MaxContains *int `json:"maxContains,omitempty" yaml:"maxContains,omitempty"`
MinContains *int `json:"minContains,omitempty" yaml:"minContains,omitempty"`
AdditionalProperties any `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
UnevaluatedProperties any `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"`
PropertyNames *Schema `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"`
DependentRequired map[string][]string `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"`
DependentSchemas map[string]*Schema `json:"dependentSchemas,omitempty" yaml:"dependentSchemas,omitempty"`
AllOf []*Schema `json:"allOf,omitempty" yaml:"allOf,omitempty"`
AnyOf []*Schema `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
OneOf []*Schema `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
Not *Schema `json:"not,omitempty" yaml:"not,omitempty"`
If *Schema `json:"if,omitempty" yaml:"if,omitempty"`
Then *Schema `json:"then,omitempty" yaml:"then,omitempty"`
Else *Schema `json:"else,omitempty" yaml:"else,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
WriteOnly bool `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
ContentEncoding string `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"`
ContentMediaType string `json:"contentMediaType,omitempty" yaml:"contentMediaType,omitempty"`
ContentSchema *Schema `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"`
Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
XML *XML `json:"xml,omitempty" yaml:"xml,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Schema represents the OpenAPI Schema Object.
type SecurityRequirement ¶ added in v0.5.0
SecurityRequirement represents one OpenAPI Security Requirement Object.
type SecurityScheme ¶
type SecurityScheme struct {
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
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 SecuritySchemeAPIKeyIn `json:"in,omitempty" yaml:"in,omitempty"`
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
BearerFormat *string `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
Flows *OAuthFlows `json:"flows,omitempty" yaml:"flows,omitempty"`
OpenIDConnectURL string `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
OAuth2MetadataURL string `json:"oauth2MetadataUrl,omitempty" yaml:"oauth2MetadataUrl,omitempty"`
Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
SecurityScheme represents the OpenAPI Security Scheme Object.
type SecuritySchemeAPIKeyIn ¶
type SecuritySchemeAPIKeyIn string
SecuritySchemeAPIKeyIn is the location of an API key security scheme.
const ( // SecuritySchemeAPIKeyInQuery indicates an API key in query. SecuritySchemeAPIKeyInQuery SecuritySchemeAPIKeyIn = "query" // SecuritySchemeAPIKeyInHeader indicates an API key in header. SecuritySchemeAPIKeyInHeader SecuritySchemeAPIKeyIn = "header" // SecuritySchemeAPIKeyInCookie indicates an API key in cookie. SecuritySchemeAPIKeyInCookie SecuritySchemeAPIKeyIn = "cookie" )
type Server ¶
type Server struct {
URL string `json:"url" yaml:"url"`
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Variables map[string]ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Server represents the OpenAPI Server Object.
type ServerVariable ¶
type ServerVariable struct {
Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"`
Default string `json:"default" yaml:"default"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
ServerVariable represents the OpenAPI Server Variable Object.
type Tag ¶
type Tag struct {
Name string `json:"name" yaml:"name"`
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
Parent string `json:"parent,omitempty" yaml:"parent,omitempty"`
Kind string `json:"kind,omitempty" yaml:"kind,omitempty"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
Tag represents the OpenAPI Tag Object.
type TypeMapping ¶
TypeMapping represents a mapping between a source type and a destination type. It is used in the reflection process to specify how certain types should be mapped when generating the OpenAPI document. The Src field represents the original type, while the Dst field represents the type that should be used in the generated document.
type XML ¶ added in v0.5.0
type XML struct {
NodeType string `json:"nodeType,omitempty" yaml:"nodeType,omitempty"`
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"`
Extensions map[string]any `json:"-" yaml:"-"`
Extra map[string]any `json:"-" yaml:"-"`
}
XML represents the OpenAPI XML Object.