Documentation ¶
Overview ¶
Package openapi3 parses and writes OpenAPI 3 specification documents.
See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md
Index ¶
- Constants
- Variables
- func BoolPtr(value bool) *bool
- func DefineIPv4Format()
- func DefineIPv6Format()
- func DefineStringFormat(name string, pattern string)
- func DefineStringFormatCallback(name string, callback FormatCallback)
- func Float64Ptr(value float64) *float64
- func Int64Ptr(value int64) *int64
- func RegisterArrayUniqueItemsChecker(fn SliceUniqueItemsChecker)
- func Uint64Ptr(value uint64) *uint64
- func ValidateIdentifier(value string) error
- type Callback
- type CallbackRef
- type Callbacks
- type Components
- type Contact
- type Content
- func NewContent() Content
- func NewContentWithFormDataSchema(schema *Schema) Content
- func NewContentWithFormDataSchemaRef(schema *SchemaRef) Content
- func NewContentWithJSONSchema(schema *Schema) Content
- func NewContentWithJSONSchemaRef(schema *SchemaRef) Content
- func NewContentWithSchema(schema *Schema, consumes []string) Content
- func NewContentWithSchemaRef(schema *SchemaRef, consumes []string) Content
- type Discriminator
- type Encoding
- func (encoding *Encoding) MarshalJSON() ([]byte, error)
- func (encoding *Encoding) SerializationMethod() *SerializationMethod
- func (encoding *Encoding) UnmarshalJSON(data []byte) error
- func (value *Encoding) Validate(ctx context.Context) error
- func (encoding *Encoding) WithHeader(name string, header *Header) *Encoding
- func (encoding *Encoding) WithHeaderRef(name string, ref *HeaderRef) *Encoding
- type Example
- type ExampleRef
- type Examples
- type ExtensionProps
- type ExternalDocs
- type Format
- type FormatCallback
- type Header
- type HeaderRef
- type Headers
- type Info
- type License
- type Link
- type LinkRef
- type Links
- type Loader
- func (loader *Loader) LoadFromData(data []byte) (*T, error)
- func (loader *Loader) LoadFromDataWithPath(data []byte, location *url.URL) (*T, error)
- func (loader *Loader) LoadFromFile(location string) (*T, error)
- func (loader *Loader) LoadFromURI(location *url.URL) (*T, error)
- func (loader *Loader) ResolveRefsIn(doc *T, location *url.URL) (err error)
- type MediaType
- func (mediaType MediaType) JSONLookup(token string) (interface{}, error)
- func (mediaType *MediaType) MarshalJSON() ([]byte, error)
- func (mediaType *MediaType) UnmarshalJSON(data []byte) error
- func (value *MediaType) Validate(ctx context.Context) error
- func (mediaType *MediaType) WithEncoding(name string, enc *Encoding) *MediaType
- func (mediaType *MediaType) WithExample(name string, value interface{}) *MediaType
- func (mediaType *MediaType) WithSchema(schema *Schema) *MediaType
- func (mediaType *MediaType) WithSchemaRef(schema *SchemaRef) *MediaType
- type MultiError
- type OAuthFlow
- type OAuthFlows
- type Operation
- func (operation *Operation) AddParameter(p *Parameter)
- func (operation *Operation) AddResponse(status int, response *Response)
- func (operation Operation) JSONLookup(token string) (interface{}, error)
- func (operation *Operation) MarshalJSON() ([]byte, error)
- func (operation *Operation) UnmarshalJSON(data []byte) error
- func (value *Operation) Validate(ctx context.Context) error
- type Parameter
- func (value Parameter) JSONLookup(token string) (interface{}, error)
- func (parameter *Parameter) MarshalJSON() ([]byte, error)
- func (parameter *Parameter) SerializationMethod() (*SerializationMethod, error)
- func (parameter *Parameter) UnmarshalJSON(data []byte) error
- func (value *Parameter) Validate(ctx context.Context) error
- func (parameter *Parameter) WithDescription(value string) *Parameter
- func (parameter *Parameter) WithRequired(value bool) *Parameter
- func (parameter *Parameter) WithSchema(value *Schema) *Parameter
- type ParameterRef
- type Parameters
- type ParametersMap
- type PathItem
- func (pathItem *PathItem) GetOperation(method string) *Operation
- func (pathItem *PathItem) MarshalJSON() ([]byte, error)
- func (pathItem *PathItem) Operations() map[string]*Operation
- func (pathItem *PathItem) SetOperation(method string, operation *Operation)
- func (pathItem *PathItem) UnmarshalJSON(data []byte) error
- func (value *PathItem) Validate(ctx context.Context) error
- type Paths
- type Ref
- type RequestBodies
- type RequestBody
- func (requestBody *RequestBody) GetMediaType(mediaType string) *MediaType
- func (requestBody *RequestBody) MarshalJSON() ([]byte, error)
- func (requestBody *RequestBody) UnmarshalJSON(data []byte) error
- func (value *RequestBody) Validate(ctx context.Context) error
- func (requestBody *RequestBody) WithContent(content Content) *RequestBody
- func (requestBody *RequestBody) WithDescription(value string) *RequestBody
- func (requestBody *RequestBody) WithFormDataSchema(value *Schema) *RequestBody
- func (requestBody *RequestBody) WithFormDataSchemaRef(value *SchemaRef) *RequestBody
- func (requestBody *RequestBody) WithJSONSchema(value *Schema) *RequestBody
- func (requestBody *RequestBody) WithJSONSchemaRef(value *SchemaRef) *RequestBody
- func (requestBody *RequestBody) WithRequired(value bool) *RequestBody
- func (requestBody *RequestBody) WithSchema(value *Schema, consumes []string) *RequestBody
- func (requestBody *RequestBody) WithSchemaRef(value *SchemaRef, consumes []string) *RequestBody
- type RequestBodyRef
- type Response
- func (response *Response) MarshalJSON() ([]byte, error)
- func (response *Response) UnmarshalJSON(data []byte) error
- func (value *Response) Validate(ctx context.Context) error
- func (response *Response) WithContent(content Content) *Response
- func (response *Response) WithDescription(value string) *Response
- func (response *Response) WithJSONSchema(schema *Schema) *Response
- func (response *Response) WithJSONSchemaRef(schema *SchemaRef) *Response
- type ResponseRef
- type Responses
- type Schema
- func NewAllOfSchema(schemas ...*Schema) *Schema
- func NewAnyOfSchema(schemas ...*Schema) *Schema
- func NewArraySchema() *Schema
- func NewBoolSchema() *Schema
- func NewBytesSchema() *Schema
- func NewDateTimeSchema() *Schema
- func NewFloat64Schema() *Schema
- func NewInt32Schema() *Schema
- func NewInt64Schema() *Schema
- func NewIntegerSchema() *Schema
- func NewObjectSchema() *Schema
- func NewOneOfSchema(schemas ...*Schema) *Schema
- func NewSchema() *Schema
- func NewStringSchema() *Schema
- func NewUUIDSchema() *Schema
- func (schema *Schema) IsEmpty() bool
- func (schema *Schema) IsMatching(value interface{}) bool
- func (schema *Schema) IsMatchingJSONArray(value []interface{}) bool
- func (schema *Schema) IsMatchingJSONBoolean(value bool) bool
- func (schema *Schema) IsMatchingJSONNumber(value float64) bool
- func (schema *Schema) IsMatchingJSONObject(value map[string]interface{}) bool
- func (schema *Schema) IsMatchingJSONString(value string) bool
- func (schema Schema) JSONLookup(token string) (interface{}, error)
- func (schema *Schema) MarshalJSON() ([]byte, error)
- func (schema *Schema) NewRef() *SchemaRef
- func (schema *Schema) UnmarshalJSON(data []byte) error
- func (value *Schema) Validate(ctx context.Context) error
- func (schema *Schema) VisitJSON(value interface{}, opts ...SchemaValidationOption) error
- func (schema *Schema) VisitJSONArray(value []interface{}) error
- func (schema *Schema) VisitJSONBoolean(value bool) error
- func (schema *Schema) VisitJSONNumber(value float64) error
- func (schema *Schema) VisitJSONObject(value map[string]interface{}) error
- func (schema *Schema) VisitJSONString(value string) error
- func (schema *Schema) WithAdditionalProperties(v *Schema) *Schema
- func (schema *Schema) WithAnyAdditionalProperties() *Schema
- func (schema *Schema) WithDefault(defaultValue interface{}) *Schema
- func (schema *Schema) WithEnum(values ...interface{}) *Schema
- func (schema *Schema) WithExclusiveMax(value bool) *Schema
- func (schema *Schema) WithExclusiveMin(value bool) *Schema
- func (schema *Schema) WithFormat(value string) *Schema
- func (schema *Schema) WithItems(value *Schema) *Schema
- func (schema *Schema) WithLength(i int64) *Schema
- func (schema *Schema) WithLengthDecodedBase64(i int64) *Schema
- func (schema *Schema) WithMax(value float64) *Schema
- func (schema *Schema) WithMaxItems(i int64) *Schema
- func (schema *Schema) WithMaxLength(i int64) *Schema
- func (schema *Schema) WithMaxLengthDecodedBase64(i int64) *Schema
- func (schema *Schema) WithMaxProperties(i int64) *Schema
- func (schema *Schema) WithMin(value float64) *Schema
- func (schema *Schema) WithMinItems(i int64) *Schema
- func (schema *Schema) WithMinLength(i int64) *Schema
- func (schema *Schema) WithMinLengthDecodedBase64(i int64) *Schema
- func (schema *Schema) WithMinProperties(i int64) *Schema
- func (schema *Schema) WithNullable() *Schema
- func (schema *Schema) WithPattern(pattern string) *Schema
- func (schema *Schema) WithProperties(properties map[string]*Schema) *Schema
- func (schema *Schema) WithProperty(name string, propertySchema *Schema) *Schema
- func (schema *Schema) WithPropertyRef(name string, ref *SchemaRef) *Schema
- func (schema *Schema) WithUniqueItems(unique bool) *Schema
- type SchemaError
- type SchemaRef
- type SchemaRefs
- type SchemaValidationOption
- type Schemas
- type SecurityRequirement
- type SecurityRequirements
- type SecurityScheme
- func (ss *SecurityScheme) MarshalJSON() ([]byte, error)
- func (ss *SecurityScheme) UnmarshalJSON(data []byte) error
- func (value *SecurityScheme) Validate(ctx context.Context) error
- func (ss *SecurityScheme) WithBearerFormat(value string) *SecurityScheme
- func (ss *SecurityScheme) WithDescription(value string) *SecurityScheme
- func (ss *SecurityScheme) WithIn(value string) *SecurityScheme
- func (ss *SecurityScheme) WithName(value string) *SecurityScheme
- func (ss *SecurityScheme) WithScheme(value string) *SecurityScheme
- func (ss *SecurityScheme) WithType(value string) *SecurityScheme
- type SecuritySchemeRef
- type SecuritySchemes
- type SerializationMethod
- type Server
- type ServerVariable
- type Servers
- type SliceUniqueItemsChecker
- type T
- type Tag
- type Tags
Examples ¶
Constants ¶
const ( ParameterInPath = "path" ParameterInQuery = "query" ParameterInHeader = "header" ParameterInCookie = "cookie" )
const ( SerializationSimple = "simple" SerializationLabel = "label" SerializationMatrix = "matrix" SerializationForm = "form" SerializationSpaceDelimited = "spaceDelimited" SerializationPipeDelimited = "pipeDelimited" SerializationDeepObject = "deepObject" )
const (
// FormatOfStringForUUIDOfRFC4122 is an optional predefined format for UUID v1-v5 as specified by RFC4122
FormatOfStringForUUIDOfRFC4122 = `^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`
)
Variables ¶
var ( // SchemaErrorDetailsDisabled disables printing of details about schema errors. SchemaErrorDetailsDisabled = false //SchemaFormatValidationDisabled disables validation of schema type formats. SchemaFormatValidationDisabled = false // ErrOneOfConflict is the SchemaError Origin when data matches more than one oneOf schema ErrOneOfConflict = errors.New("input matches more than one oneOf schemas") // ErrSchemaInputNaN may be returned when validating a number ErrSchemaInputNaN = errors.New("floating point NaN is not allowed") // ErrSchemaInputInf may be returned when validating a number ErrSchemaInputInf = errors.New("floating point Inf is not allowed") )
var IdentifierRegExp = regexp.MustCompile(identifierPattern)
IdentifierRegExp verifies whether Component object key matches 'identifierPattern' pattern, according to OapiAPI v3.x.0. Hovever, to be able supporting legacy OpenAPI v2.x, there is a need to customize above pattern in orde not to fail converted v2-v3 validation
var SchemaStringFormats = make(map[string]Format, 8)
SchemaStringFormats allows for validating strings format
Functions ¶
func DefineIPv4Format ¶ added in v0.27.0
func DefineIPv4Format()
DefineIPv4Format opts in ipv4 format validation on top of OAS 3 spec
func DefineIPv6Format ¶ added in v0.27.0
func DefineIPv6Format()
DefineIPv6Format opts in ipv6 format validation on top of OAS 3 spec
func DefineStringFormat ¶
DefineStringFormat Defines a new regexp pattern for a given format
func DefineStringFormatCallback ¶ added in v0.27.0
func DefineStringFormatCallback(name string, callback FormatCallback)
DefineStringFormatCallback adds a validation function for a specific schema format entry
func Float64Ptr ¶
Float64Ptr is a helper for defining OpenAPI schemas.
func RegisterArrayUniqueItemsChecker ¶ added in v0.3.0
func RegisterArrayUniqueItemsChecker(fn SliceUniqueItemsChecker)
RegisterArrayUniqueItemsChecker is used to register a customized function used to check if JSON array have unique items.
func ValidateIdentifier ¶
Types ¶
type CallbackRef ¶
func (CallbackRef) JSONLookup ¶ added in v0.33.0
func (value CallbackRef) JSONLookup(token string) (interface{}, error)
func (*CallbackRef) MarshalJSON ¶
func (value *CallbackRef) MarshalJSON() ([]byte, error)
func (*CallbackRef) UnmarshalJSON ¶
func (value *CallbackRef) UnmarshalJSON(data []byte) error
type Callbacks ¶ added in v0.33.0
type Callbacks map[string]*CallbackRef
func (Callbacks) JSONLookup ¶ added in v0.33.0
type Components ¶
type Components struct { ExtensionProps 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 NewComponents ¶
func NewComponents() Components
func (*Components) MarshalJSON ¶
func (components *Components) MarshalJSON() ([]byte, error)
func (*Components) UnmarshalJSON ¶
func (components *Components) UnmarshalJSON(data []byte) error
type Contact ¶
type Contact struct { ExtensionProps Name string `json:"name,omitempty" yaml:"name,omitempty"` URL string `json:"url,omitempty" yaml:"url,omitempty"` Email string `json:"email,omitempty" yaml:"email,omitempty"` }
Contact is specified by OpenAPI/Swagger standard version 3.0.
func (*Contact) MarshalJSON ¶
func (*Contact) UnmarshalJSON ¶
type Content ¶
Content is specified by OpenAPI/Swagger 3.0 standard.
func NewContent ¶
func NewContent() Content
func NewContentWithFormDataSchema ¶ added in v0.17.0
func NewContentWithFormDataSchemaRef ¶ added in v0.17.0
func NewContentWithSchema ¶ added in v0.29.0
func NewContentWithSchemaRef ¶ added in v0.29.0
type Discriminator ¶ added in v0.2.0
type Discriminator struct { ExtensionProps PropertyName string `json:"propertyName" yaml:"propertyName"` Mapping map[string]string `json:"mapping,omitempty" yaml:"mapping,omitempty"` }
Discriminator is specified by OpenAPI/Swagger standard version 3.0.
func (*Discriminator) MarshalJSON ¶ added in v0.2.0
func (value *Discriminator) MarshalJSON() ([]byte, error)
func (*Discriminator) UnmarshalJSON ¶ added in v0.2.0
func (value *Discriminator) UnmarshalJSON(data []byte) error
type Encoding ¶
type Encoding struct { ExtensionProps 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 NewEncoding ¶
func NewEncoding() *Encoding
func (*Encoding) MarshalJSON ¶
func (*Encoding) SerializationMethod ¶ added in v0.2.0
func (encoding *Encoding) SerializationMethod() *SerializationMethod
SerializationMethod returns a serialization method of request body. When serialization method is not defined the method returns the default serialization method.
func (*Encoding) UnmarshalJSON ¶
func (*Encoding) WithHeader ¶
type Example ¶
type Example struct { ExtensionProps 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"` }
Example is specified by OpenAPI/Swagger 3.0 standard.
func NewExample ¶
func NewExample(value interface{}) *Example
func (*Example) MarshalJSON ¶
func (*Example) UnmarshalJSON ¶
type ExampleRef ¶
func (ExampleRef) JSONLookup ¶ added in v0.33.0
func (value ExampleRef) JSONLookup(token string) (interface{}, error)
func (*ExampleRef) MarshalJSON ¶
func (value *ExampleRef) MarshalJSON() ([]byte, error)
func (*ExampleRef) UnmarshalJSON ¶
func (value *ExampleRef) UnmarshalJSON(data []byte) error
type Examples ¶ added in v0.33.0
type Examples map[string]*ExampleRef
func (Examples) JSONLookup ¶ added in v0.33.0
type ExtensionProps ¶
type ExtensionProps struct {
Extensions map[string]interface{} `json:"-" yaml:"-"`
}
ExtensionProps provides support for OpenAPI extensions. It reads/writes all properties that begin with "x-".
func (*ExtensionProps) DecodeWith ¶
func (props *ExtensionProps) DecodeWith(decoder *jsoninfo.ObjectDecoder, value interface{}) error
DecodeWith will be invoked by package "jsoninfo"
Example ¶
loader := NewLoader() loader.IsExternalRefsAllowed = true spec, err := loader.LoadFromFile("testdata/testref.openapi.json") if err != nil { panic(err) } dec, err := jsoninfo.NewObjectDecoder(spec.Info.Extensions["x-my-extension"].(json.RawMessage)) if err != nil { panic(err) } var value struct { Key int `json:"k"` } if err = spec.Info.DecodeWith(dec, &value); err != nil { panic(err) } fmt.Println(value.Key)
Output: 42
func (*ExtensionProps) EncodeWith ¶
func (props *ExtensionProps) EncodeWith(encoder *jsoninfo.ObjectEncoder, value interface{}) error
EncodeWith will be invoked by package "jsoninfo"
type ExternalDocs ¶
type ExternalDocs struct { ExtensionProps Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` }
ExternalDocs is specified by OpenAPI/Swagger standard version 3.0.
func (*ExternalDocs) MarshalJSON ¶ added in v0.3.0
func (e *ExternalDocs) MarshalJSON() ([]byte, error)
func (*ExternalDocs) UnmarshalJSON ¶ added in v0.3.0
func (e *ExternalDocs) UnmarshalJSON(data []byte) error
type FormatCallback ¶ added in v0.27.0
FormatCallback custom check on exotic formats
type Header ¶
type Header struct {
Parameter
}
Header is specified by OpenAPI/Swagger 3.0 standard. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#headerObject
func (Header) JSONLookup ¶ added in v0.33.0
func (*Header) SerializationMethod ¶ added in v0.62.0
func (value *Header) SerializationMethod() (*SerializationMethod, error)
SerializationMethod returns a header's serialization method.
func (*Header) UnmarshalJSON ¶ added in v0.3.0
type HeaderRef ¶
func (HeaderRef) JSONLookup ¶ added in v0.33.0
func (*HeaderRef) MarshalJSON ¶
func (*HeaderRef) UnmarshalJSON ¶
type Headers ¶ added in v0.33.0
func (Headers) JSONLookup ¶ added in v0.33.0
type Info ¶
type Info struct { ExtensionProps 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 is specified by OpenAPI/Swagger standard version 3.0.
func (*Info) MarshalJSON ¶
func (*Info) UnmarshalJSON ¶
type License ¶
type License struct { ExtensionProps Name string `json:"name" yaml:"name"` // Required URL string `json:"url,omitempty" yaml:"url,omitempty"` }
License is specified by OpenAPI/Swagger standard version 3.0.
func (*License) MarshalJSON ¶
func (*License) UnmarshalJSON ¶
type Link ¶
type Link struct { ExtensionProps 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"` }
Link is specified by OpenAPI/Swagger standard version 3.0.
func (*Link) MarshalJSON ¶
func (*Link) UnmarshalJSON ¶
type Links ¶ added in v0.33.0
func (Links) JSONLookup ¶ added in v0.33.0
type Loader ¶ added in v0.61.0
type Loader struct { // IsExternalRefsAllowed enables visiting other files IsExternalRefsAllowed bool // ReadFromURIFunc allows overriding the any file/URL reading func ReadFromURIFunc func(loader *Loader, url *url.URL) ([]byte, error) Context context.Context // contains filtered or unexported fields }
Loader helps deserialize an OpenAPIv3 document
Example ¶
const source = `{"info":{"description":"An API"}}` doc, err := NewLoader().LoadFromData([]byte(source)) if err != nil { panic(err) } fmt.Print(doc.Info.Description)
Output: An API
func (*Loader) LoadFromData ¶ added in v0.61.0
LoadFromData loads a spec from a byte array
func (*Loader) LoadFromDataWithPath ¶ added in v0.61.0
LoadFromDataWithPath takes the OpenAPI document data in bytes and a path where the resolver can find referred elements and returns a *T with all resolved data or an error if unable to load data or resolve refs.
func (*Loader) LoadFromFile ¶ added in v0.61.0
LoadFromFile loads a spec from a local file path
func (*Loader) LoadFromURI ¶ added in v0.61.0
LoadFromURI loads a spec from a remote URL
type MediaType ¶
type MediaType struct { ExtensionProps Schema *SchemaRef `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 NewMediaType ¶
func NewMediaType() *MediaType
func (MediaType) JSONLookup ¶ added in v0.33.0
func (*MediaType) MarshalJSON ¶
func (*MediaType) UnmarshalJSON ¶
func (*MediaType) WithEncoding ¶
func (*MediaType) WithExample ¶
func (*MediaType) WithSchema ¶
func (*MediaType) WithSchemaRef ¶
type MultiError ¶ added in v0.25.0
type MultiError []error
MultiError is a collection of errors, intended for when multiple issues need to be reported upstream
func (MultiError) As ¶ added in v0.25.0
func (me MultiError) As(target interface{}) bool
As allows you to use `errors.As()` to set target to the first error within the multi error that matches the target type
func (MultiError) Error ¶ added in v0.25.0
func (me MultiError) Error() string
func (MultiError) Is ¶ added in v0.25.0
func (me MultiError) Is(target error) bool
Is allows you to determine if a generic error is in fact a MultiError using `errors.Is()` It will also return true if any of the contained errors match target
type OAuthFlow ¶
type OAuthFlow struct { ExtensionProps 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 { ExtensionProps 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 (flows *OAuthFlows) MarshalJSON() ([]byte, error)
func (*OAuthFlows) UnmarshalJSON ¶
func (flows *OAuthFlows) UnmarshalJSON(data []byte) error
type Operation ¶
type Operation struct { ExtensionProps // 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 *RequestBodyRef `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 *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
Operation represents "operation" specified by" OpenAPI/Swagger 3.0 standard.
func NewOperation ¶
func NewOperation() *Operation
func (*Operation) AddParameter ¶
func (*Operation) AddResponse ¶
func (Operation) JSONLookup ¶ added in v0.33.0
func (*Operation) MarshalJSON ¶
func (*Operation) UnmarshalJSON ¶
type Parameter ¶
type Parameter struct { ExtensionProps 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 interface{} `json:"example,omitempty" yaml:"example,omitempty"` Examples Examples `json:"examples,omitempty" yaml:"examples,omitempty"` Content Content `json:"content,omitempty" yaml:"content,omitempty"` }
Parameter is specified by OpenAPI/Swagger 3.0 standard. See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#parameterObject
func NewCookieParameter ¶
func NewHeaderParameter ¶
func NewPathParameter ¶
func NewQueryParameter ¶
func (Parameter) JSONLookup ¶ added in v0.33.0
func (*Parameter) MarshalJSON ¶
func (*Parameter) SerializationMethod ¶ added in v0.2.0
func (parameter *Parameter) SerializationMethod() (*SerializationMethod, error)
SerializationMethod returns a parameter's serialization method. When a parameter's serialization method is not defined the method returns the default serialization method corresponding to a parameter's location.
func (*Parameter) UnmarshalJSON ¶
func (*Parameter) WithDescription ¶
func (*Parameter) WithRequired ¶
func (*Parameter) WithSchema ¶
type ParameterRef ¶
func (ParameterRef) JSONLookup ¶ added in v0.33.0
func (value ParameterRef) JSONLookup(token string) (interface{}, error)
func (*ParameterRef) MarshalJSON ¶
func (value *ParameterRef) MarshalJSON() ([]byte, error)
func (*ParameterRef) UnmarshalJSON ¶
func (value *ParameterRef) UnmarshalJSON(data []byte) error
type Parameters ¶
type Parameters []*ParameterRef
Parameters is specified by OpenAPI/Swagger 3.0 standard.
func NewParameters ¶
func NewParameters() Parameters
func (Parameters) GetByInAndName ¶
func (parameters Parameters) GetByInAndName(in string, name string) *Parameter
func (Parameters) JSONLookup ¶ added in v0.33.0
func (p Parameters) JSONLookup(token string) (interface{}, error)
type ParametersMap ¶ added in v0.33.0
type ParametersMap map[string]*ParameterRef
func (ParametersMap) JSONLookup ¶ added in v0.33.0
func (p ParametersMap) JSONLookup(token string) (interface{}, error)
type PathItem ¶
type PathItem struct { ExtensionProps 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"` }
func (*PathItem) GetOperation ¶
func (*PathItem) MarshalJSON ¶
func (*PathItem) Operations ¶
func (*PathItem) SetOperation ¶
func (*PathItem) UnmarshalJSON ¶
type Paths ¶
Paths is specified by OpenAPI/Swagger standard version 3.0.
func (Paths) Find ¶
Find returns a path that matches the key.
The method ignores differences in template variable names (except possible "*" suffix).
For example:
paths := openapi3.Paths { "/person/{personName}": &openapi3.PathItem{}, } pathItem := path.Find("/person/{name}")
would return the correct path item.
type Ref ¶ added in v0.33.0
type Ref struct {
Ref string `json:"$ref" yaml:"$ref"`
}
Ref is specified by OpenAPI/Swagger 3.0 standard.
type RequestBodies ¶ added in v0.33.0
type RequestBodies map[string]*RequestBodyRef
func (RequestBodies) JSONLookup ¶ added in v0.33.0
func (r RequestBodies) JSONLookup(token string) (interface{}, error)
type RequestBody ¶
type RequestBody struct { ExtensionProps 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 NewRequestBody ¶
func NewRequestBody() *RequestBody
func (*RequestBody) GetMediaType ¶
func (requestBody *RequestBody) GetMediaType(mediaType string) *MediaType
func (*RequestBody) MarshalJSON ¶
func (requestBody *RequestBody) MarshalJSON() ([]byte, error)
func (*RequestBody) UnmarshalJSON ¶
func (requestBody *RequestBody) UnmarshalJSON(data []byte) error
func (*RequestBody) WithContent ¶
func (requestBody *RequestBody) WithContent(content Content) *RequestBody
func (*RequestBody) WithDescription ¶
func (requestBody *RequestBody) WithDescription(value string) *RequestBody
func (*RequestBody) WithFormDataSchema ¶ added in v0.17.0
func (requestBody *RequestBody) WithFormDataSchema(value *Schema) *RequestBody
func (*RequestBody) WithFormDataSchemaRef ¶ added in v0.17.0
func (requestBody *RequestBody) WithFormDataSchemaRef(value *SchemaRef) *RequestBody
func (*RequestBody) WithJSONSchema ¶
func (requestBody *RequestBody) WithJSONSchema(value *Schema) *RequestBody
func (*RequestBody) WithJSONSchemaRef ¶
func (requestBody *RequestBody) WithJSONSchemaRef(value *SchemaRef) *RequestBody
func (*RequestBody) WithRequired ¶
func (requestBody *RequestBody) WithRequired(value bool) *RequestBody
func (*RequestBody) WithSchema ¶ added in v0.29.0
func (requestBody *RequestBody) WithSchema(value *Schema, consumes []string) *RequestBody
func (*RequestBody) WithSchemaRef ¶ added in v0.29.0
func (requestBody *RequestBody) WithSchemaRef(value *SchemaRef, consumes []string) *RequestBody
type RequestBodyRef ¶
type RequestBodyRef struct { Ref string Value *RequestBody }
func (RequestBodyRef) JSONLookup ¶ added in v0.33.0
func (value RequestBodyRef) JSONLookup(token string) (interface{}, error)
func (*RequestBodyRef) MarshalJSON ¶
func (value *RequestBodyRef) MarshalJSON() ([]byte, error)
func (*RequestBodyRef) UnmarshalJSON ¶
func (value *RequestBodyRef) UnmarshalJSON(data []byte) error
type Response ¶
type Response struct { ExtensionProps 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 NewResponse ¶
func NewResponse() *Response
func (*Response) MarshalJSON ¶
func (*Response) UnmarshalJSON ¶
func (*Response) WithContent ¶
func (*Response) WithDescription ¶
func (*Response) WithJSONSchema ¶
func (*Response) WithJSONSchemaRef ¶
type ResponseRef ¶
func (ResponseRef) JSONLookup ¶ added in v0.33.0
func (value ResponseRef) JSONLookup(token string) (interface{}, error)
func (*ResponseRef) MarshalJSON ¶
func (value *ResponseRef) MarshalJSON() ([]byte, error)
func (*ResponseRef) UnmarshalJSON ¶
func (value *ResponseRef) UnmarshalJSON(data []byte) error
type Responses ¶
type Responses map[string]*ResponseRef
Responses is specified by OpenAPI/Swagger 3.0 standard.
func NewResponses ¶
func NewResponses() Responses
func (Responses) Default ¶
func (responses Responses) Default() *ResponseRef
func (Responses) Get ¶
func (responses Responses) Get(status int) *ResponseRef
func (Responses) JSONLookup ¶ added in v0.33.0
type Schema ¶
type Schema struct { ExtensionProps 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 string `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 []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"` Default interface{} `json:"default,omitempty" yaml:"default,omitempty"` Example interface{} `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 bool `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` ExclusiveMax bool `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` // 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"` XML interface{} `json:"xml,omitempty" yaml:"xml,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,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"` AdditionalPropertiesAllowed *bool `multijson:"additionalProperties,omitempty" json:"-" yaml:"-"` // In this order... AdditionalProperties *SchemaRef `multijson:"additionalProperties,omitempty" json:"-" yaml:"-"` // ...for multijson Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,omitempty"` // contains filtered or unexported fields }
Schema is specified by OpenAPI/Swagger 3.0 standard.
func NewAllOfSchema ¶
func NewAnyOfSchema ¶
func NewArraySchema ¶
func NewArraySchema() *Schema
func NewBoolSchema ¶
func NewBoolSchema() *Schema
func NewBytesSchema ¶
func NewBytesSchema() *Schema
func NewDateTimeSchema ¶
func NewDateTimeSchema() *Schema
func NewFloat64Schema ¶
func NewFloat64Schema() *Schema
func NewInt32Schema ¶
func NewInt32Schema() *Schema
func NewInt64Schema ¶
func NewInt64Schema() *Schema
func NewIntegerSchema ¶
func NewIntegerSchema() *Schema
func NewObjectSchema ¶
func NewObjectSchema() *Schema
func NewOneOfSchema ¶
func NewStringSchema ¶
func NewStringSchema() *Schema
func NewUUIDSchema ¶ added in v0.3.0
func NewUUIDSchema() *Schema
func (*Schema) IsMatching ¶
func (*Schema) IsMatchingJSONArray ¶
func (*Schema) IsMatchingJSONBoolean ¶
func (*Schema) IsMatchingJSONNumber ¶
func (*Schema) IsMatchingJSONObject ¶
func (*Schema) IsMatchingJSONString ¶
func (Schema) JSONLookup ¶ added in v0.33.0
func (*Schema) MarshalJSON ¶
func (*Schema) UnmarshalJSON ¶
func (*Schema) VisitJSON ¶
func (schema *Schema) VisitJSON(value interface{}, opts ...SchemaValidationOption) error
func (*Schema) VisitJSONArray ¶
func (*Schema) VisitJSONBoolean ¶
func (*Schema) VisitJSONNumber ¶
func (*Schema) VisitJSONObject ¶
func (*Schema) VisitJSONString ¶
func (*Schema) WithAdditionalProperties ¶
func (*Schema) WithAnyAdditionalProperties ¶
func (*Schema) WithDefault ¶ added in v0.3.0
func (*Schema) WithExclusiveMax ¶
func (*Schema) WithExclusiveMin ¶
func (*Schema) WithFormat ¶
func (*Schema) WithLength ¶
func (*Schema) WithLengthDecodedBase64 ¶
func (*Schema) WithMaxItems ¶
func (*Schema) WithMaxLength ¶
func (*Schema) WithMaxLengthDecodedBase64 ¶
func (*Schema) WithMaxProperties ¶
func (*Schema) WithMinItems ¶
func (*Schema) WithMinLength ¶
func (*Schema) WithMinLengthDecodedBase64 ¶
func (*Schema) WithMinProperties ¶
func (*Schema) WithNullable ¶
func (*Schema) WithPattern ¶
func (*Schema) WithProperties ¶
func (*Schema) WithProperty ¶
func (*Schema) WithPropertyRef ¶
func (*Schema) WithUniqueItems ¶
type SchemaError ¶
type SchemaError struct { Value interface{} Schema *Schema SchemaField string Reason string Origin error // contains filtered or unexported fields }
func (*SchemaError) Error ¶
func (err *SchemaError) Error() string
func (*SchemaError) JSONPointer ¶
func (err *SchemaError) JSONPointer() []string
type SchemaRef ¶
func NewSchemaRef ¶
func (SchemaRef) JSONLookup ¶ added in v0.33.0
func (*SchemaRef) MarshalJSON ¶
func (*SchemaRef) UnmarshalJSON ¶
type SchemaRefs ¶ added in v0.33.0
type SchemaRefs []*SchemaRef
func (SchemaRefs) JSONLookup ¶ added in v0.33.0
func (s SchemaRefs) JSONLookup(token string) (interface{}, error)
type SchemaValidationOption ¶ added in v0.23.0
type SchemaValidationOption func(*schemaValidationSettings)
SchemaValidationOption describes options a user has when validating request / response bodies.
func FailFast ¶ added in v0.23.0
func FailFast() SchemaValidationOption
FailFast returns schema validation errors quicker.
func MultiErrors ¶ added in v0.25.0
func MultiErrors() SchemaValidationOption
func VisitAsRequest ¶ added in v0.23.0
func VisitAsRequest() SchemaValidationOption
func VisitAsResponse ¶ added in v0.23.0
func VisitAsResponse() SchemaValidationOption
type Schemas ¶ added in v0.33.0
func (Schemas) JSONLookup ¶ added in v0.33.0
type SecurityRequirement ¶
func NewSecurityRequirement ¶
func NewSecurityRequirement() SecurityRequirement
func (SecurityRequirement) Authenticate ¶
func (security SecurityRequirement) Authenticate(provider string, scopes ...string) SecurityRequirement
type SecurityRequirements ¶
type SecurityRequirements []SecurityRequirement
func NewSecurityRequirements ¶
func NewSecurityRequirements() *SecurityRequirements
func (SecurityRequirements) Validate ¶
func (value SecurityRequirements) Validate(ctx context.Context) error
func (*SecurityRequirements) With ¶
func (srs *SecurityRequirements) With(securityRequirement SecurityRequirement) *SecurityRequirements
type SecurityScheme ¶
type SecurityScheme struct { ExtensionProps 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 NewCSRFSecurityScheme ¶
func NewCSRFSecurityScheme() *SecurityScheme
func NewJWTSecurityScheme ¶
func NewJWTSecurityScheme() *SecurityScheme
func NewOIDCSecurityScheme ¶ added in v0.36.0
func NewOIDCSecurityScheme(oidcUrl string) *SecurityScheme
func NewSecurityScheme ¶
func NewSecurityScheme() *SecurityScheme
func (*SecurityScheme) MarshalJSON ¶
func (ss *SecurityScheme) MarshalJSON() ([]byte, error)
func (*SecurityScheme) UnmarshalJSON ¶
func (ss *SecurityScheme) UnmarshalJSON(data []byte) error
func (*SecurityScheme) WithBearerFormat ¶
func (ss *SecurityScheme) WithBearerFormat(value string) *SecurityScheme
func (*SecurityScheme) WithDescription ¶
func (ss *SecurityScheme) WithDescription(value string) *SecurityScheme
func (*SecurityScheme) WithIn ¶
func (ss *SecurityScheme) WithIn(value string) *SecurityScheme
func (*SecurityScheme) WithName ¶
func (ss *SecurityScheme) WithName(value string) *SecurityScheme
func (*SecurityScheme) WithScheme ¶
func (ss *SecurityScheme) WithScheme(value string) *SecurityScheme
func (*SecurityScheme) WithType ¶
func (ss *SecurityScheme) WithType(value string) *SecurityScheme
type SecuritySchemeRef ¶
type SecuritySchemeRef struct { Ref string Value *SecurityScheme }
func (SecuritySchemeRef) JSONLookup ¶ added in v0.33.0
func (value SecuritySchemeRef) JSONLookup(token string) (interface{}, error)
func (*SecuritySchemeRef) MarshalJSON ¶
func (value *SecuritySchemeRef) MarshalJSON() ([]byte, error)
func (*SecuritySchemeRef) UnmarshalJSON ¶
func (value *SecuritySchemeRef) UnmarshalJSON(data []byte) error
type SecuritySchemes ¶ added in v0.33.0
type SecuritySchemes map[string]*SecuritySchemeRef
func (SecuritySchemes) JSONLookup ¶ added in v0.33.0
func (s SecuritySchemes) JSONLookup(token string) (interface{}, error)
type SerializationMethod ¶ added in v0.2.0
SerializationMethod describes a serialization method of HTTP request's parameters and body.
type Server ¶
type Server struct { ExtensionProps 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 is specified by OpenAPI/Swagger standard version 3.0.
func (*Server) MarshalJSON ¶ added in v0.40.0
func (Server) ParameterNames ¶
func (*Server) UnmarshalJSON ¶ added in v0.40.0
type ServerVariable ¶
type ServerVariable struct { ExtensionProps 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 specified by OpenAPI/Swagger standard version 3.0.
func (*ServerVariable) MarshalJSON ¶ added in v0.43.0
func (serverVariable *ServerVariable) MarshalJSON() ([]byte, error)
func (*ServerVariable) UnmarshalJSON ¶ added in v0.43.0
func (serverVariable *ServerVariable) UnmarshalJSON(data []byte) error
type Servers ¶
type Servers []*Server
Servers is specified by OpenAPI/Swagger standard version 3.0.
type SliceUniqueItemsChecker ¶ added in v0.3.0
type SliceUniqueItemsChecker func(items []interface{}) bool
SliceUniqueItemsChecker is an function used to check if an given slice have unique items.
type T ¶ added in v0.61.0
type T struct { ExtensionProps 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 *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` }
T is the root of an OpenAPI v3 document
func (*T) AddOperation ¶ added in v0.61.0
func (*T) MarshalJSON ¶ added in v0.61.0
func (*T) UnmarshalJSON ¶ added in v0.61.0
type Tag ¶
type Tag struct { ExtensionProps 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 specified by OpenAPI/Swagger 3.0 standard.
func (*Tag) MarshalJSON ¶ added in v0.43.0
func (*Tag) UnmarshalJSON ¶ added in v0.43.0
Source Files ¶
- callback.go
- components.go
- content.go
- discriminator.go
- doc.go
- encoding.go
- errors.go
- examples.go
- extension.go
- external_docs.go
- header.go
- info.go
- link.go
- loader.go
- media_type.go
- openapi3.go
- operation.go
- parameter.go
- path_item.go
- paths.go
- refs.go
- request_body.go
- response.go
- schema.go
- schema_formats.go
- schema_validation_settings.go
- security_requirements.go
- security_scheme.go
- serialization_method.go
- server.go
- tag.go