Documentation ¶
Index ¶
- func NewSessionContext(ctx context.Context) context.Context
- type Callback
- type CallbackRef
- type Callbacks
- type Components
- type Contact
- type Content
- type CustomExtension
- type Discriminator
- type Encoding
- type Example
- type Examples
- type Extension
- type ExternalDocumentation
- type Headers
- type Info
- type License
- type Link
- type Links
- type MediaType
- type OAuthFlow
- type OAuthFlows
- type OpenAPI
- type Operation
- type Parameter
- type Parameters
- type ParametersMap
- type PathItem
- type Paths
- type RequestBodies
- type RequestBody
- type Response
- type Responses
- type Schema
- type SchemaList
- type Schemas
- type SecurityRequirement
- type SecurityRequirements
- type SecurityScheme
- type SecuritySchemes
- type Server
- type ServerVariable
- type Servers
- type Session
- func (s *Session) AddDefer(fn func() error)
- func (s *Session) Close() error
- func (s *Session) LookupCallback(location string, ref string) (*CallbackRef, error)
- func (s *Session) LookupExample(location string, ref string) (*Example, error)
- func (s *Session) LookupHeaders(location string, ref string) (*Parameter, error)
- func (s *Session) LookupLink(location string, ref string) (*Link, error)
- func (s *Session) LookupParameter(location string, ref string) (*Parameter, error)
- func (s *Session) LookupRequestBody(location string, ref string) (*RequestBody, error)
- func (s *Session) LookupResponse(location string, ref string) (*Response, error)
- func (s *Session) LookupSchema(location string, ref string) (*Schema, error)
- func (s *Session) LookupSecurityScheme(location string, ref string) (*SecurityScheme, error)
- func (s *Session) RegisterComponents(location string, components *Components)
- type Tag
- type Tags
- type XML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CallbackRef ¶
type CallbackRef struct { Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Callback `yaml:",inline"` }
func (*CallbackRef) UnmarshalYAML ¶
func (s *CallbackRef) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Callbacks ¶
type Callbacks map[string]*CallbackRef
type Components ¶
type Components struct { Extension `json:",omitempty" yaml:",inline"` 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 Responses `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 specified by OpenAPI/Swagger standard version 3.0.
func (*Components) MarshalJSON ¶
func (c *Components) MarshalJSON() ([]byte, error)
func (*Components) UnmarshalJSON ¶
func (c *Components) UnmarshalJSON(b []byte) error
func (*Components) UnmarshalYAML ¶
func (s *Components) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Contact ¶
type Contact struct { Extension `json:",omitempty" yaml:",inline"` Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` Email string `json:"email,omitempty" yaml:"email,omitempty"` }
Info represents document info
func (*Contact) MarshalJSON ¶
func (*Contact) UnmarshalJSON ¶
type CustomExtension ¶
type CustomExtension Extension
CustomExtension represents custom extension
func (*CustomExtension) UnmarshalYAML ¶
func (p *CustomExtension) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Discriminator ¶
type Encoding ¶
type Encoding struct { Extension `json:",omitempty" yaml:",inline"` 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 specified by OpenAPI/Swagger 3.0 standard.
func (*Encoding) MarshalJSON ¶
func (*Encoding) UnmarshalJSON ¶
type Example ¶
type Example struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Value interface{} `json:"value,omitempty" yaml:"value,omitempty"` ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"` }
func (*Example) MarshalJSON ¶
func (*Example) UnmarshalJSON ¶
type ExternalDocumentation ¶
type ExternalDocumentation struct { Extension `json:",omitempty" yaml:",inline"` Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` }
func (*ExternalDocumentation) MarshalJSON ¶
func (e *ExternalDocumentation) MarshalJSON() ([]byte, error)
func (*ExternalDocumentation) UnmarshalJSON ¶
func (e *ExternalDocumentation) UnmarshalJSON(b []byte) error
func (*ExternalDocumentation) UnmarshalYAML ¶
func (e *ExternalDocumentation) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Info ¶
type Info struct { Extension `json:",omitempty" yaml:",inline"` Title string `json:"title" yaml:"title"` // Required 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"` // Required }
Info represents document info
func (*Info) MarshalJSON ¶
func (*Info) UnmarshalJSON ¶
type License ¶
type License struct { Extension `json:",omitempty" yaml:",inline"` Name string `json:"name" yaml:"name"` // Required URL string `json:"url,omitempty" yaml:"url,omitempty"` }
Info represents document info
func (*License) MarshalJSON ¶
func (*License) UnmarshalJSON ¶
type Link ¶
type Link struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Parameters map[string]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"` Server *Server `json:"server,omitempty" yaml:"server,omitempty"` RequestBody interface{} `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` }
func (*Link) MarshalJSON ¶
func (*Link) UnmarshalJSON ¶
type MediaType ¶
type MediaType struct { Extension `json:",omitempty" yaml:",inline"` Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"` }
MediaType is specified by OpenAPI/Swagger 3.0 standard.
func (*MediaType) MarshalJSON ¶
func (*MediaType) UnmarshalJSON ¶
type OAuthFlow ¶
type OAuthFlow struct { Extension `json:",omitempty" yaml:",inline"` AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,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"` }
func (*OAuthFlow) MarshalJSON ¶
func (*OAuthFlow) UnmarshalJSON ¶
type OAuthFlows ¶
type OAuthFlows struct { Extension `json:",omitempty" yaml:",inline"` 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"` }
func (*OAuthFlows) MarshalJSON ¶
func (o *OAuthFlows) MarshalJSON() ([]byte, error)
func (*OAuthFlows) UnmarshalJSON ¶
func (o *OAuthFlows) UnmarshalJSON(b []byte) error
func (*OAuthFlows) UnmarshalYAML ¶
func (s *OAuthFlows) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type OpenAPI ¶
type OpenAPI struct { OpenAPI string `json:"openapi" yaml:"openapi"` // Required Components Components `json:"components,omitempty" yaml:"components,omitempty"` Info *Info `json:"info" yaml:"info"` // Required Paths Paths `json:"paths" yaml:"paths"` // Required 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 *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
OpenAPI represents OpenAPI 3.0 document
type Operation ¶
type Operation struct { Extension `json:",omitempty" yaml:",inline"` // Optional tags for documentation. Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` // Optional short summary. Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` // Optional description. Should use CommonMark syntax. Description string `json:"description,omitempty" yaml:"description,omitempty"` // Optional operation ID. OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"` // Optional parameters. Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"` // Optional body parameter. RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` // Responses. Responses Responses `json:"responses" yaml:"responses"` // Required // Optional callbacks Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` // Optional security requirements that overrides top-level security. Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"` // Optional servers that overrides top-level servers. Servers *Servers `json:"servers,omitempty" yaml:"servers,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
func (*Operation) MarshalJSON ¶
func (*Operation) UnmarshalJSON ¶
type Parameter ¶
type Parameter struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,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"` 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 *Schema `json:"schema,omitempty" yaml:"schema,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` Content Content `json:"content,omitempty" yaml:"content,omitempty"` }
func (*Parameter) MarshalJSON ¶
func (*Parameter) UnmarshalJSON ¶
type Parameters ¶
type Parameters []*Parameter
type ParametersMap ¶
type PathItem ¶
type PathItem struct { Extension `json:",omitempty" yaml:",inline"` 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"` Servers Servers `json:"servers,omitempty" yaml:"servers,omitempty"` Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"` }
Paths represents a path defined by OpenAPI/Swagger standard version 3.0.
func (*PathItem) MarshalJSON ¶
func (*PathItem) UnmarshalJSON ¶
type RequestBodies ¶
type RequestBodies map[string]*RequestBody
type RequestBody ¶
type RequestBody struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Content Content `json:"content,omitempty" yaml:"content,omitempty"` }
RequestBody is specified by OpenAPI/Swagger 3.0 standard.
func (*RequestBody) MarshalJSON ¶
func (r *RequestBody) MarshalJSON() ([]byte, error)
func (*RequestBody) UnmarshalJSON ¶
func (r *RequestBody) UnmarshalJSON(b []byte) error
func (*RequestBody) UnmarshalYAML ¶
func (s *RequestBody) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Response ¶
type Response struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` 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 specified by OpenAPI/Swagger 3.0 standard.
func (*Response) MarshalJSON ¶
func (*Response) UnmarshalJSON ¶
type Schema ¶
type Schema struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Type string `json:"type,omitempty" yaml:"type,omitempty"` AllOf SchemaList `json:"allOf,omitempty" yaml:"allOf,omitempty"` OneOf SchemaList `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` AnyOf SchemaList `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` Not *Schema `json:"not,omitempty" yaml:"not,omitempty"` Items *Schema `json:"items,omitempty" yaml:"items,omitempty"` Properties Schemas `json:"properties,omitempty" yaml:"properties,omitempty"` AdditionalPropertiesAllowed *bool `multijson:"additionalProperties,omitempty" json:"-" yaml:"-"` // In this order... AdditionalProperties *Schema `multijson:"additionalProperties,omitempty" json:"-" yaml:"-"` // ...for multijson Description string `json:"description,omitempty" yaml:"description,omitempty"` Format string `json:"format,omitempty" yaml:"format,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` // Properties Nullable bool `json:"nullable,omitempty" yaml:"nullable,omitempty"` Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,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"` XML *XML `json:"xml,omitempty" yaml:"xml,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Example interface{} `json:"example,omitempty" yaml:"example,omitempty"` Title string `json:"title,omitempty" yaml:"title,omitempty"` MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` Max *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"` ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` Min *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"` ExclusiveMin bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` MinLength uint64 `json:"minLength,omitempty" yaml:"minLength,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` MaxItems *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` MinItems uint64 `json:"minItems,omitempty" yaml:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` MaxProps *uint64 `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` MinProps uint64 `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` Required []string `json:"required,omitempty" yaml:"required,omitempty"` Enum []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"` }
func (*Schema) MarshalJSON ¶
func (*Schema) UnmarshalJSON ¶
type SchemaList ¶
type SchemaList []*Schema
type SecurityRequirement ¶
type SecurityRequirements ¶
type SecurityRequirements []SecurityRequirement
type SecurityScheme ¶
type SecurityScheme struct { Extension `json:",omitempty" yaml:",inline"` Ref string `json:"$ref,omitempty" yaml:"$ref,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 string `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"` }
func (*SecurityScheme) MarshalJSON ¶
func (s *SecurityScheme) MarshalJSON() ([]byte, error)
func (*SecurityScheme) UnmarshalJSON ¶
func (s *SecurityScheme) UnmarshalJSON(b []byte) error
func (*SecurityScheme) UnmarshalYAML ¶
func (s *SecurityScheme) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type SecuritySchemes ¶
type SecuritySchemes map[string]*SecurityScheme
type Server ¶
type Server struct { Extension `json:",omitempty" yaml:",inline"` URL string `json:"url" yaml:"url"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Variables map[string]ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"` }
Server represents a server node defined is specified by OpenAPI/Swagger standard version 3.0.
func (*Server) MarshalJSON ¶
func (*Server) UnmarshalJSON ¶
type ServerVariable ¶
type ServerVariable struct { Extension `json:",omitempty" yaml:",inline"` 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 represents server variables defined by OpenAPI/Swagger standard version 3.0.
func (*ServerVariable) MarshalJSON ¶
func (s *ServerVariable) MarshalJSON() ([]byte, error)
func (*ServerVariable) UnmarshalJSON ¶
func (s *ServerVariable) UnmarshalJSON(b []byte) error
func (*ServerVariable) UnmarshalYAML ¶
func (s *ServerVariable) UnmarshalYAML(ctx context.Context, fn func(dest interface{}) error) error
type Servers ¶
type Servers []Server
Server represents a server node defined is specified by OpenAPI/Swagger standard version 3.0.
type Session ¶
type Session struct { Location string // contains filtered or unexported fields }
func NewSession ¶
func NewSession() *Session
func (*Session) LookupCallback ¶
func (s *Session) LookupCallback(location string, ref string) (*CallbackRef, error)
LookupLink lookup callback
func (*Session) LookupExample ¶
LookupExample lookup example
func (*Session) LookupHeaders ¶
LookupHeaders lookup headers
func (*Session) LookupLink ¶
LookupLink lookup link
func (*Session) LookupParameter ¶
LookupParameter lookup parameters
func (*Session) LookupRequestBody ¶
func (s *Session) LookupRequestBody(location string, ref string) (*RequestBody, error)
LookupRequestBody lookup request body
func (*Session) LookupResponse ¶
LookupResponse lookup response
func (*Session) LookupSchema ¶
LookupSchema lookups schema
func (*Session) LookupSecurityScheme ¶
func (s *Session) LookupSecurityScheme(location string, ref string) (*SecurityScheme, error)
LookupSecurityScheme lookup security scheme
func (*Session) RegisterComponents ¶
func (s *Session) RegisterComponents(location string, components *Components)
RegisterComponents returns location components
type Tag ¶
type Tag struct { Extension `json:",omitempty" yaml:",inline"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
func (*Tag) MarshalJSON ¶
func (*Tag) UnmarshalJSON ¶
type XML ¶
type XML struct { Extension `json:",omitempty" yaml:",inline"` Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Prefix string `json:"prefix,omitempty"` Attribute bool `json:"attribute,omitempty"` Wrapped bool `json:"wrapped,omitempty"` }