openapi3

package
v0.2.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package openapi3 provides entities and helpers to manage OpenAPI 3.0.x schema.

Package openapi3 contains JSON mapping structures.

Index

Examples

Constants

View Source
const (
	ParameterInPath   = ParameterIn("path")
	ParameterInQuery  = ParameterIn("query")
	ParameterInHeader = ParameterIn("header")
	ParameterInCookie = ParameterIn("cookie")
)

ParameterIn values enumeration.

View Source
const (
	SchemaTypeArray   = SchemaType("array")
	SchemaTypeBoolean = SchemaType("boolean")
	SchemaTypeInteger = SchemaType("integer")
	SchemaTypeNumber  = SchemaType("number")
	SchemaTypeObject  = SchemaType("object")
	SchemaTypeString  = SchemaType("string")
)

SchemaType values enumeration.

View Source
const (
	EncodingStyleForm           = EncodingStyle("form")
	EncodingStyleSpaceDelimited = EncodingStyle("spaceDelimited")
	EncodingStylePipeDelimited  = EncodingStyle("pipeDelimited")
	EncodingStyleDeepObject     = EncodingStyle("deepObject")
)

EncodingStyle values enumeration.

View Source
const (
	PathParameterStyleMatrix = PathParameterStyle("matrix")
	PathParameterStyleLabel  = PathParameterStyle("label")
	PathParameterStyleSimple = PathParameterStyle("simple")
)

PathParameterStyle values enumeration.

View Source
const (
	QueryParameterStyleForm           = QueryParameterStyle("form")
	QueryParameterStyleSpaceDelimited = QueryParameterStyle("spaceDelimited")
	QueryParameterStylePipeDelimited  = QueryParameterStyle("pipeDelimited")
	QueryParameterStyleDeepObject     = QueryParameterStyle("deepObject")
)

QueryParameterStyle values enumeration.

View Source
const (
	APIKeySecuritySchemeInHeader = APIKeySecuritySchemeIn("header")
	APIKeySecuritySchemeInQuery  = APIKeySecuritySchemeIn("query")
	APIKeySecuritySchemeInCookie = APIKeySecuritySchemeIn("cookie")
)

APIKeySecuritySchemeIn values enumeration.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeySecurityScheme

type APIKeySecurityScheme struct {
	Name          string                 `json:"name"` // Required.
	In            APIKeySecuritySchemeIn `json:"in"`   // Required.
	Description   *string                `json:"description,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

APIKeySecurityScheme structure is generated from "#/definitions/APIKeySecurityScheme".

func (APIKeySecurityScheme) MarshalJSON

func (a APIKeySecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*APIKeySecurityScheme) UnmarshalJSON

func (a *APIKeySecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*APIKeySecurityScheme) WithDescription

func (a *APIKeySecurityScheme) WithDescription(val string) *APIKeySecurityScheme

WithDescription sets Description value.

func (*APIKeySecurityScheme) WithIn

WithIn sets In value.

func (*APIKeySecurityScheme) WithMapOfAnything

func (a *APIKeySecurityScheme) WithMapOfAnything(val map[string]interface{}) *APIKeySecurityScheme

WithMapOfAnything sets MapOfAnything value.

func (*APIKeySecurityScheme) WithMapOfAnythingItem

func (a *APIKeySecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *APIKeySecurityScheme

WithMapOfAnythingItem sets MapOfAnything item value.

func (*APIKeySecurityScheme) WithName

WithName sets Name value.

type APIKeySecuritySchemeIn

type APIKeySecuritySchemeIn string

APIKeySecuritySchemeIn is an enum type.

func (APIKeySecuritySchemeIn) MarshalJSON

func (i APIKeySecuritySchemeIn) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*APIKeySecuritySchemeIn) UnmarshalJSON

func (i *APIKeySecuritySchemeIn) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type AuthorizationCodeOAuthFlow

type AuthorizationCodeOAuthFlow struct {
	// Format: uri-reference.
	// Required.
	AuthorizationURL string `json:"authorizationUrl"`
	// Format: uri-reference.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri-reference.
	Scopes        map[string]string      `json:"scopes,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

AuthorizationCodeOAuthFlow structure is generated from "#/definitions/AuthorizationCodeOAuthFlow".

func (AuthorizationCodeOAuthFlow) MarshalJSON

func (a AuthorizationCodeOAuthFlow) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*AuthorizationCodeOAuthFlow) UnmarshalJSON

func (a *AuthorizationCodeOAuthFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*AuthorizationCodeOAuthFlow) WithAuthorizationURL

func (a *AuthorizationCodeOAuthFlow) WithAuthorizationURL(val string) *AuthorizationCodeOAuthFlow

WithAuthorizationURL sets AuthorizationURL value.

func (*AuthorizationCodeOAuthFlow) WithMapOfAnything

func (a *AuthorizationCodeOAuthFlow) WithMapOfAnything(val map[string]interface{}) *AuthorizationCodeOAuthFlow

WithMapOfAnything sets MapOfAnything value.

func (*AuthorizationCodeOAuthFlow) WithMapOfAnythingItem

func (a *AuthorizationCodeOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *AuthorizationCodeOAuthFlow

WithMapOfAnythingItem sets MapOfAnything item value.

func (*AuthorizationCodeOAuthFlow) WithRefreshURL

WithRefreshURL sets RefreshURL value.

func (*AuthorizationCodeOAuthFlow) WithScopes

WithScopes sets Scopes value.

func (*AuthorizationCodeOAuthFlow) WithScopesItem

WithScopesItem sets Scopes item value.

func (*AuthorizationCodeOAuthFlow) WithTokenURL

WithTokenURL sets TokenURL value.

type Bearer

type Bearer struct{}

Bearer structure is generated from "#/definitions/HTTPSecurityScheme/oneOf/0".

Bearer.

Bearer.

func (Bearer) MarshalJSON

func (b Bearer) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Bearer) UnmarshalJSON

func (b *Bearer) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Callback

type Callback struct {
	MapOfAnything        map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
	AdditionalProperties map[string]PathItem    `json:"-"` // All unmatched properties.
}

Callback structure is generated from "#/definitions/Callback".

func (Callback) MarshalJSON

func (c Callback) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Callback) UnmarshalJSON

func (c *Callback) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Callback) WithAdditionalProperties

func (c *Callback) WithAdditionalProperties(val map[string]PathItem) *Callback

WithAdditionalProperties sets AdditionalProperties value.

func (*Callback) WithAdditionalPropertiesItem

func (c *Callback) WithAdditionalPropertiesItem(key string, val PathItem) *Callback

WithAdditionalPropertiesItem sets AdditionalProperties item value.

func (*Callback) WithMapOfAnything

func (c *Callback) WithMapOfAnything(val map[string]interface{}) *Callback

WithMapOfAnything sets MapOfAnything value.

func (*Callback) WithMapOfAnythingItem

func (c *Callback) WithMapOfAnythingItem(key string, val interface{}) *Callback

WithMapOfAnythingItem sets MapOfAnything item value.

type CallbackOrRef

type CallbackOrRef struct {
	CallbackReference *CallbackReference `json:"-"`
	Callback          *Callback          `json:"-"`
}

CallbackOrRef structure is generated from "#/definitions/CallbackOrRef".

func (*CallbackOrRef) CallbackEns

func (c *CallbackOrRef) CallbackEns() *Callback

CallbackEns ensures returned Callback is not nil.

func (*CallbackOrRef) CallbackReferenceEns

func (c *CallbackOrRef) CallbackReferenceEns() *CallbackReference

CallbackReferenceEns ensures returned CallbackReference is not nil.

func (CallbackOrRef) MarshalJSON

func (c CallbackOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*CallbackOrRef) UnmarshalJSON

func (c *CallbackOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*CallbackOrRef) WithCallback

func (c *CallbackOrRef) WithCallback(val Callback) *CallbackOrRef

WithCallback sets Callback value.

func (*CallbackOrRef) WithCallbackReference

func (c *CallbackOrRef) WithCallbackReference(val CallbackReference) *CallbackOrRef

WithCallbackReference sets CallbackReference value.

type CallbackReference

type CallbackReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

CallbackReference structure is generated from "#/definitions/CallbackReference".

func (*CallbackReference) UnmarshalJSON

func (c *CallbackReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*CallbackReference) WithRef

func (c *CallbackReference) WithRef(val string) *CallbackReference

WithRef sets Ref value.

type ClientCredentialsFlow

type ClientCredentialsFlow struct {
	// Format: uri-reference.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri-reference.
	Scopes        map[string]string      `json:"scopes,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

ClientCredentialsFlow structure is generated from "#/definitions/ClientCredentialsFlow".

func (ClientCredentialsFlow) MarshalJSON

func (c ClientCredentialsFlow) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ClientCredentialsFlow) UnmarshalJSON

func (c *ClientCredentialsFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ClientCredentialsFlow) WithMapOfAnything

func (c *ClientCredentialsFlow) WithMapOfAnything(val map[string]interface{}) *ClientCredentialsFlow

WithMapOfAnything sets MapOfAnything value.

func (*ClientCredentialsFlow) WithMapOfAnythingItem

func (c *ClientCredentialsFlow) WithMapOfAnythingItem(key string, val interface{}) *ClientCredentialsFlow

WithMapOfAnythingItem sets MapOfAnything item value.

func (*ClientCredentialsFlow) WithRefreshURL

func (c *ClientCredentialsFlow) WithRefreshURL(val string) *ClientCredentialsFlow

WithRefreshURL sets RefreshURL value.

func (*ClientCredentialsFlow) WithScopes

func (c *ClientCredentialsFlow) WithScopes(val map[string]string) *ClientCredentialsFlow

WithScopes sets Scopes value.

func (*ClientCredentialsFlow) WithScopesItem

func (c *ClientCredentialsFlow) WithScopesItem(key string, val string) *ClientCredentialsFlow

WithScopesItem sets Scopes item value.

func (*ClientCredentialsFlow) WithTokenURL

func (c *ClientCredentialsFlow) WithTokenURL(val string) *ClientCredentialsFlow

WithTokenURL sets TokenURL value.

type Components

type Components struct {
	Schemas         *ComponentsSchemas         `json:"schemas,omitempty"`
	Responses       *ComponentsResponses       `json:"responses,omitempty"`
	Parameters      *ComponentsParameters      `json:"parameters,omitempty"`
	Examples        *ComponentsExamples        `json:"examples,omitempty"`
	RequestBodies   *ComponentsRequestBodies   `json:"requestBodies,omitempty"`
	Headers         *ComponentsHeaders         `json:"headers,omitempty"`
	SecuritySchemes *ComponentsSecuritySchemes `json:"securitySchemes,omitempty"`
	Links           *ComponentsLinks           `json:"links,omitempty"`
	Callbacks       *ComponentsCallbacks       `json:"callbacks,omitempty"`
	MapOfAnything   map[string]interface{}     `json:"-"` // Key must match pattern: `^x-`.
}

Components structure is generated from "#/definitions/Components".

func (*Components) CallbacksEns

func (c *Components) CallbacksEns() *ComponentsCallbacks

CallbacksEns ensures returned Callbacks is not nil.

func (*Components) ExamplesEns

func (c *Components) ExamplesEns() *ComponentsExamples

ExamplesEns ensures returned Examples is not nil.

func (*Components) HeadersEns

func (c *Components) HeadersEns() *ComponentsHeaders

HeadersEns ensures returned Headers is not nil.

func (*Components) LinksEns

func (c *Components) LinksEns() *ComponentsLinks

LinksEns ensures returned Links is not nil.

func (Components) MarshalJSON

func (c Components) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Components) ParametersEns

func (c *Components) ParametersEns() *ComponentsParameters

ParametersEns ensures returned Parameters is not nil.

func (*Components) RequestBodiesEns

func (c *Components) RequestBodiesEns() *ComponentsRequestBodies

RequestBodiesEns ensures returned RequestBodies is not nil.

func (*Components) ResponsesEns

func (c *Components) ResponsesEns() *ComponentsResponses

ResponsesEns ensures returned Responses is not nil.

func (*Components) SchemasEns

func (c *Components) SchemasEns() *ComponentsSchemas

SchemasEns ensures returned Schemas is not nil.

func (*Components) SecuritySchemesEns

func (c *Components) SecuritySchemesEns() *ComponentsSecuritySchemes

SecuritySchemesEns ensures returned SecuritySchemes is not nil.

func (*Components) UnmarshalJSON

func (c *Components) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Components) WithCallbacks

func (c *Components) WithCallbacks(val ComponentsCallbacks) *Components

WithCallbacks sets Callbacks value.

func (*Components) WithExamples

func (c *Components) WithExamples(val ComponentsExamples) *Components

WithExamples sets Examples value.

func (*Components) WithHeaders

func (c *Components) WithHeaders(val ComponentsHeaders) *Components

WithHeaders sets Headers value.

func (c *Components) WithLinks(val ComponentsLinks) *Components

WithLinks sets Links value.

func (*Components) WithMapOfAnything

func (c *Components) WithMapOfAnything(val map[string]interface{}) *Components

WithMapOfAnything sets MapOfAnything value.

func (*Components) WithMapOfAnythingItem

func (c *Components) WithMapOfAnythingItem(key string, val interface{}) *Components

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Components) WithParameters

func (c *Components) WithParameters(val ComponentsParameters) *Components

WithParameters sets Parameters value.

func (*Components) WithRequestBodies

func (c *Components) WithRequestBodies(val ComponentsRequestBodies) *Components

WithRequestBodies sets RequestBodies value.

func (*Components) WithResponses

func (c *Components) WithResponses(val ComponentsResponses) *Components

WithResponses sets Responses value.

func (*Components) WithSchemas

func (c *Components) WithSchemas(val ComponentsSchemas) *Components

WithSchemas sets Schemas value.

func (*Components) WithSecuritySchemes

func (c *Components) WithSecuritySchemes(val ComponentsSecuritySchemes) *Components

WithSecuritySchemes sets SecuritySchemes value.

type ComponentsCallbacks

type ComponentsCallbacks struct {
	MapOfCallbackOrRefValues map[string]CallbackOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsCallbacks structure is generated from "#/definitions/Components->callbacks".

func (ComponentsCallbacks) MarshalJSON

func (c ComponentsCallbacks) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsCallbacks) UnmarshalJSON

func (c *ComponentsCallbacks) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsCallbacks) WithMapOfCallbackOrRefValues

func (c *ComponentsCallbacks) WithMapOfCallbackOrRefValues(val map[string]CallbackOrRef) *ComponentsCallbacks

WithMapOfCallbackOrRefValues sets MapOfCallbackOrRefValues value.

func (*ComponentsCallbacks) WithMapOfCallbackOrRefValuesItem

func (c *ComponentsCallbacks) WithMapOfCallbackOrRefValuesItem(key string, val CallbackOrRef) *ComponentsCallbacks

WithMapOfCallbackOrRefValuesItem sets MapOfCallbackOrRefValues item value.

type ComponentsExamples

type ComponentsExamples struct {
	MapOfExampleOrRefValues map[string]ExampleOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsExamples structure is generated from "#/definitions/Components->examples".

func (ComponentsExamples) MarshalJSON

func (c ComponentsExamples) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsExamples) UnmarshalJSON

func (c *ComponentsExamples) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsExamples) WithMapOfExampleOrRefValues

func (c *ComponentsExamples) WithMapOfExampleOrRefValues(val map[string]ExampleOrRef) *ComponentsExamples

WithMapOfExampleOrRefValues sets MapOfExampleOrRefValues value.

func (*ComponentsExamples) WithMapOfExampleOrRefValuesItem

func (c *ComponentsExamples) WithMapOfExampleOrRefValuesItem(key string, val ExampleOrRef) *ComponentsExamples

WithMapOfExampleOrRefValuesItem sets MapOfExampleOrRefValues item value.

type ComponentsHeaders

type ComponentsHeaders struct {
	MapOfHeaderOrRefValues map[string]HeaderOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsHeaders structure is generated from "#/definitions/Components->headers".

func (ComponentsHeaders) MarshalJSON

func (c ComponentsHeaders) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsHeaders) UnmarshalJSON

func (c *ComponentsHeaders) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsHeaders) WithMapOfHeaderOrRefValues

func (c *ComponentsHeaders) WithMapOfHeaderOrRefValues(val map[string]HeaderOrRef) *ComponentsHeaders

WithMapOfHeaderOrRefValues sets MapOfHeaderOrRefValues value.

func (*ComponentsHeaders) WithMapOfHeaderOrRefValuesItem

func (c *ComponentsHeaders) WithMapOfHeaderOrRefValuesItem(key string, val HeaderOrRef) *ComponentsHeaders

WithMapOfHeaderOrRefValuesItem sets MapOfHeaderOrRefValues item value.

type ComponentsLinks struct {
	MapOfLinkOrRefValues map[string]LinkOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsLinks structure is generated from "#/definitions/Components->links".

func (ComponentsLinks) MarshalJSON

func (c ComponentsLinks) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsLinks) UnmarshalJSON

func (c *ComponentsLinks) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsLinks) WithMapOfLinkOrRefValues

func (c *ComponentsLinks) WithMapOfLinkOrRefValues(val map[string]LinkOrRef) *ComponentsLinks

WithMapOfLinkOrRefValues sets MapOfLinkOrRefValues value.

func (*ComponentsLinks) WithMapOfLinkOrRefValuesItem

func (c *ComponentsLinks) WithMapOfLinkOrRefValuesItem(key string, val LinkOrRef) *ComponentsLinks

WithMapOfLinkOrRefValuesItem sets MapOfLinkOrRefValues item value.

type ComponentsParameters

type ComponentsParameters struct {
	MapOfParameterOrRefValues map[string]ParameterOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsParameters structure is generated from "#/definitions/Components->parameters".

func (ComponentsParameters) MarshalJSON

func (c ComponentsParameters) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsParameters) UnmarshalJSON

func (c *ComponentsParameters) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsParameters) WithMapOfParameterOrRefValues

func (c *ComponentsParameters) WithMapOfParameterOrRefValues(val map[string]ParameterOrRef) *ComponentsParameters

WithMapOfParameterOrRefValues sets MapOfParameterOrRefValues value.

func (*ComponentsParameters) WithMapOfParameterOrRefValuesItem

func (c *ComponentsParameters) WithMapOfParameterOrRefValuesItem(key string, val ParameterOrRef) *ComponentsParameters

WithMapOfParameterOrRefValuesItem sets MapOfParameterOrRefValues item value.

type ComponentsRequestBodies

type ComponentsRequestBodies struct {
	MapOfRequestBodyOrRefValues map[string]RequestBodyOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsRequestBodies structure is generated from "#/definitions/Components->requestBodies".

func (ComponentsRequestBodies) MarshalJSON

func (c ComponentsRequestBodies) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsRequestBodies) UnmarshalJSON

func (c *ComponentsRequestBodies) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsRequestBodies) WithMapOfRequestBodyOrRefValues

func (c *ComponentsRequestBodies) WithMapOfRequestBodyOrRefValues(val map[string]RequestBodyOrRef) *ComponentsRequestBodies

WithMapOfRequestBodyOrRefValues sets MapOfRequestBodyOrRefValues value.

func (*ComponentsRequestBodies) WithMapOfRequestBodyOrRefValuesItem

func (c *ComponentsRequestBodies) WithMapOfRequestBodyOrRefValuesItem(key string, val RequestBodyOrRef) *ComponentsRequestBodies

WithMapOfRequestBodyOrRefValuesItem sets MapOfRequestBodyOrRefValues item value.

type ComponentsResponses

type ComponentsResponses struct {
	MapOfResponseOrRefValues map[string]ResponseOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsResponses structure is generated from "#/definitions/Components->responses".

func (ComponentsResponses) MarshalJSON

func (c ComponentsResponses) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsResponses) UnmarshalJSON

func (c *ComponentsResponses) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsResponses) WithMapOfResponseOrRefValues

func (c *ComponentsResponses) WithMapOfResponseOrRefValues(val map[string]ResponseOrRef) *ComponentsResponses

WithMapOfResponseOrRefValues sets MapOfResponseOrRefValues value.

func (*ComponentsResponses) WithMapOfResponseOrRefValuesItem

func (c *ComponentsResponses) WithMapOfResponseOrRefValuesItem(key string, val ResponseOrRef) *ComponentsResponses

WithMapOfResponseOrRefValuesItem sets MapOfResponseOrRefValues item value.

type ComponentsSchemas

type ComponentsSchemas struct {
	MapOfSchemaOrRefValues map[string]SchemaOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsSchemas structure is generated from "#/definitions/Components->schemas".

func (ComponentsSchemas) MarshalJSON

func (c ComponentsSchemas) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsSchemas) UnmarshalJSON

func (c *ComponentsSchemas) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsSchemas) WithMapOfSchemaOrRefValues

func (c *ComponentsSchemas) WithMapOfSchemaOrRefValues(val map[string]SchemaOrRef) *ComponentsSchemas

WithMapOfSchemaOrRefValues sets MapOfSchemaOrRefValues value.

func (*ComponentsSchemas) WithMapOfSchemaOrRefValuesItem

func (c *ComponentsSchemas) WithMapOfSchemaOrRefValuesItem(key string, val SchemaOrRef) *ComponentsSchemas

WithMapOfSchemaOrRefValuesItem sets MapOfSchemaOrRefValues item value.

type ComponentsSecuritySchemes

type ComponentsSecuritySchemes struct {
	MapOfSecuritySchemeOrRefValues map[string]SecuritySchemeOrRef `json:"-"` // Key must match pattern: `^[a-zA-Z0-9\.\-_]+$`.
}

ComponentsSecuritySchemes structure is generated from "#/definitions/Components->securitySchemes".

func (ComponentsSecuritySchemes) MarshalJSON

func (c ComponentsSecuritySchemes) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ComponentsSecuritySchemes) UnmarshalJSON

func (c *ComponentsSecuritySchemes) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValues

func (c *ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValues(val map[string]SecuritySchemeOrRef) *ComponentsSecuritySchemes

WithMapOfSecuritySchemeOrRefValues sets MapOfSecuritySchemeOrRefValues value.

func (*ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValuesItem

func (c *ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValuesItem(key string, val SecuritySchemeOrRef) *ComponentsSecuritySchemes

WithMapOfSecuritySchemeOrRefValuesItem sets MapOfSecuritySchemeOrRefValues item value.

type Contact

type Contact struct {
	Name          *string                `json:"name,omitempty"`
	URL           *string                `json:"url,omitempty"`   // Format: uri-reference.
	Email         *string                `json:"email,omitempty"` // Format: email.
	MapOfAnything map[string]interface{} `json:"-"`               // Key must match pattern: `^x-`.
}

Contact structure is generated from "#/definitions/Contact".

func (Contact) MarshalJSON

func (c Contact) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Contact) UnmarshalJSON

func (c *Contact) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Contact) WithEmail

func (c *Contact) WithEmail(val string) *Contact

WithEmail sets Email value.

func (*Contact) WithMapOfAnything

func (c *Contact) WithMapOfAnything(val map[string]interface{}) *Contact

WithMapOfAnything sets MapOfAnything value.

func (*Contact) WithMapOfAnythingItem

func (c *Contact) WithMapOfAnythingItem(key string, val interface{}) *Contact

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Contact) WithName

func (c *Contact) WithName(val string) *Contact

WithName sets Name value.

func (*Contact) WithURL

func (c *Contact) WithURL(val string) *Contact

WithURL sets URL value.

type CookieParameter

type CookieParameter struct{}

CookieParameter structure is generated from "#/definitions/ParameterLocation/oneOf/3".

Cookie Parameter.

Parameter in cookie.

func (CookieParameter) MarshalJSON

func (c CookieParameter) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*CookieParameter) UnmarshalJSON

func (c *CookieParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Discriminator

type Discriminator struct {
	PropertyName string            `json:"propertyName"` // Required.
	Mapping      map[string]string `json:"mapping,omitempty"`
}

Discriminator structure is generated from "#/definitions/Discriminator".

func (*Discriminator) UnmarshalJSON

func (d *Discriminator) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Discriminator) WithMapping

func (d *Discriminator) WithMapping(val map[string]string) *Discriminator

WithMapping sets Mapping value.

func (*Discriminator) WithMappingItem

func (d *Discriminator) WithMappingItem(key string, val string) *Discriminator

WithMappingItem sets Mapping item value.

func (*Discriminator) WithPropertyName

func (d *Discriminator) WithPropertyName(val string) *Discriminator

WithPropertyName sets PropertyName value.

type Encoding

type Encoding struct {
	ContentType   *string           `json:"contentType,omitempty"`
	Headers       map[string]Header `json:"headers,omitempty"`
	Style         *EncodingStyle    `json:"style,omitempty"`
	Explode       *bool             `json:"explode,omitempty"`
	AllowReserved *bool             `json:"allowReserved,omitempty"`
}

Encoding structure is generated from "#/definitions/Encoding".

func (*Encoding) UnmarshalJSON

func (e *Encoding) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Encoding) WithAllowReserved

func (e *Encoding) WithAllowReserved(val bool) *Encoding

WithAllowReserved sets AllowReserved value.

func (*Encoding) WithContentType

func (e *Encoding) WithContentType(val string) *Encoding

WithContentType sets ContentType value.

func (*Encoding) WithExplode

func (e *Encoding) WithExplode(val bool) *Encoding

WithExplode sets Explode value.

func (*Encoding) WithHeaders

func (e *Encoding) WithHeaders(val map[string]Header) *Encoding

WithHeaders sets Headers value.

func (*Encoding) WithHeadersItem

func (e *Encoding) WithHeadersItem(key string, val Header) *Encoding

WithHeadersItem sets Headers item value.

func (*Encoding) WithStyle

func (e *Encoding) WithStyle(val EncodingStyle) *Encoding

WithStyle sets Style value.

type EncodingStyle

type EncodingStyle string

EncodingStyle is an enum type.

func (EncodingStyle) MarshalJSON

func (i EncodingStyle) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*EncodingStyle) UnmarshalJSON

func (i *EncodingStyle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Example

type Example struct {
	Summary       *string                `json:"summary,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Value         *interface{}           `json:"value,omitempty"`
	ExternalValue *string                `json:"externalValue,omitempty"` // Format: uri-reference.
	MapOfAnything map[string]interface{} `json:"-"`                       // Key must match pattern: `^x-`.
}

Example structure is generated from "#/definitions/Example".

func (Example) MarshalJSON

func (e Example) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Example) UnmarshalJSON

func (e *Example) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Example) WithDescription

func (e *Example) WithDescription(val string) *Example

WithDescription sets Description value.

func (*Example) WithExternalValue

func (e *Example) WithExternalValue(val string) *Example

WithExternalValue sets ExternalValue value.

func (*Example) WithMapOfAnything

func (e *Example) WithMapOfAnything(val map[string]interface{}) *Example

WithMapOfAnything sets MapOfAnything value.

func (*Example) WithMapOfAnythingItem

func (e *Example) WithMapOfAnythingItem(key string, val interface{}) *Example

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Example) WithSummary

func (e *Example) WithSummary(val string) *Example

WithSummary sets Summary value.

func (*Example) WithValue

func (e *Example) WithValue(val interface{}) *Example

WithValue sets Value value.

type ExampleOrRef

type ExampleOrRef struct {
	ExampleReference *ExampleReference `json:"-"`
	Example          *Example          `json:"-"`
}

ExampleOrRef structure is generated from "#/definitions/ExampleOrRef".

func (*ExampleOrRef) ExampleEns

func (e *ExampleOrRef) ExampleEns() *Example

ExampleEns ensures returned Example is not nil.

func (*ExampleOrRef) ExampleReferenceEns

func (e *ExampleOrRef) ExampleReferenceEns() *ExampleReference

ExampleReferenceEns ensures returned ExampleReference is not nil.

func (ExampleOrRef) MarshalJSON

func (e ExampleOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ExampleOrRef) UnmarshalJSON

func (e *ExampleOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ExampleOrRef) WithExample

func (e *ExampleOrRef) WithExample(val Example) *ExampleOrRef

WithExample sets Example value.

func (*ExampleOrRef) WithExampleReference

func (e *ExampleOrRef) WithExampleReference(val ExampleReference) *ExampleOrRef

WithExampleReference sets ExampleReference value.

type ExampleReference

type ExampleReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

ExampleReference structure is generated from "#/definitions/ExampleReference".

func (*ExampleReference) UnmarshalJSON

func (e *ExampleReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ExampleReference) WithRef

func (e *ExampleReference) WithRef(val string) *ExampleReference

WithRef sets Ref value.

type ExternalDocumentation

type ExternalDocumentation struct {
	Description *string `json:"description,omitempty"`
	// Format: uri-reference.
	// Required.
	URL           string                 `json:"url"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

ExternalDocumentation structure is generated from "#/definitions/ExternalDocumentation".

func (ExternalDocumentation) MarshalJSON

func (e ExternalDocumentation) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ExternalDocumentation) UnmarshalJSON

func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ExternalDocumentation) WithDescription

func (e *ExternalDocumentation) WithDescription(val string) *ExternalDocumentation

WithDescription sets Description value.

func (*ExternalDocumentation) WithMapOfAnything

func (e *ExternalDocumentation) WithMapOfAnything(val map[string]interface{}) *ExternalDocumentation

WithMapOfAnything sets MapOfAnything value.

func (*ExternalDocumentation) WithMapOfAnythingItem

func (e *ExternalDocumentation) WithMapOfAnythingItem(key string, val interface{}) *ExternalDocumentation

WithMapOfAnythingItem sets MapOfAnything item value.

func (*ExternalDocumentation) WithURL

WithURL sets URL value.

type HTTPSecurityScheme

type HTTPSecurityScheme struct {
	Scheme        string                 `json:"scheme"` // Required.
	BearerFormat  *string                `json:"bearerFormat,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Bearer        *Bearer                `json:"-"`
	NonBearer     *NonBearer             `json:"-"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

HTTPSecurityScheme structure is generated from "#/definitions/HTTPSecurityScheme".

func (*HTTPSecurityScheme) BearerEns

func (h *HTTPSecurityScheme) BearerEns() *Bearer

BearerEns ensures returned Bearer is not nil.

func (HTTPSecurityScheme) MarshalJSON

func (h HTTPSecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*HTTPSecurityScheme) NonBearerEns

func (h *HTTPSecurityScheme) NonBearerEns() *NonBearer

NonBearerEns ensures returned NonBearer is not nil.

func (*HTTPSecurityScheme) UnmarshalJSON

func (h *HTTPSecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HTTPSecurityScheme) WithBearer

func (h *HTTPSecurityScheme) WithBearer(val Bearer) *HTTPSecurityScheme

WithBearer sets Bearer value.

func (*HTTPSecurityScheme) WithBearerFormat

func (h *HTTPSecurityScheme) WithBearerFormat(val string) *HTTPSecurityScheme

WithBearerFormat sets BearerFormat value.

func (*HTTPSecurityScheme) WithDescription

func (h *HTTPSecurityScheme) WithDescription(val string) *HTTPSecurityScheme

WithDescription sets Description value.

func (*HTTPSecurityScheme) WithMapOfAnything

func (h *HTTPSecurityScheme) WithMapOfAnything(val map[string]interface{}) *HTTPSecurityScheme

WithMapOfAnything sets MapOfAnything value.

func (*HTTPSecurityScheme) WithMapOfAnythingItem

func (h *HTTPSecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *HTTPSecurityScheme

WithMapOfAnythingItem sets MapOfAnything item value.

func (*HTTPSecurityScheme) WithNonBearer

func (h *HTTPSecurityScheme) WithNonBearer(val NonBearer) *HTTPSecurityScheme

WithNonBearer sets NonBearer value.

func (*HTTPSecurityScheme) WithScheme

func (h *HTTPSecurityScheme) WithScheme(val string) *HTTPSecurityScheme

WithScheme sets Scheme value.

type HasContent

type HasContent struct {
	Content interface{} `json:"content"` // Required.
}

HasContent structure is generated from "#/definitions/SchemaXORContent/oneOf/1".

Has Content.

Some properties are not allowed if content is present.

func (*HasContent) UnmarshalJSON

func (h *HasContent) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HasContent) WithContent

func (h *HasContent) WithContent(val interface{}) *HasContent

WithContent sets Content value.

type HasSchema

type HasSchema struct {
	Schema interface{} `json:"schema"` // Required.
}

HasSchema structure is generated from "#/definitions/SchemaXORContent/oneOf/0".

Has Schema.

func (*HasSchema) UnmarshalJSON

func (h *HasSchema) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HasSchema) WithSchema

func (h *HasSchema) WithSchema(val interface{}) *HasSchema

WithSchema sets Schema value.

type Header struct {
	Description     *string                 `json:"description,omitempty"`
	Required        *bool                   `json:"required,omitempty"`
	Deprecated      *bool                   `json:"deprecated,omitempty"`
	AllowEmptyValue *bool                   `json:"allowEmptyValue,omitempty"`
	Explode         *bool                   `json:"explode,omitempty"`
	AllowReserved   *bool                   `json:"allowReserved,omitempty"`
	Schema          *SchemaOrRef            `json:"schema,omitempty"`
	Content         map[string]MediaType    `json:"content,omitempty"`
	Example         *interface{}            `json:"example,omitempty"`
	Examples        map[string]ExampleOrRef `json:"examples,omitempty"`
	MapOfAnything   map[string]interface{}  `json:"-"` // Key must match pattern: `^x-`.
}

Header structure is generated from "#/definitions/Header".

func (Header) MarshalJSON

func (h Header) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Header) SchemaEns

func (h *Header) SchemaEns() *SchemaOrRef

SchemaEns ensures returned Schema is not nil.

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Header) WithAllowEmptyValue

func (h *Header) WithAllowEmptyValue(val bool) *Header

WithAllowEmptyValue sets AllowEmptyValue value.

func (*Header) WithAllowReserved

func (h *Header) WithAllowReserved(val bool) *Header

WithAllowReserved sets AllowReserved value.

func (*Header) WithContent

func (h *Header) WithContent(val map[string]MediaType) *Header

WithContent sets Content value.

func (*Header) WithContentItem

func (h *Header) WithContentItem(key string, val MediaType) *Header

WithContentItem sets Content item value.

func (*Header) WithDeprecated

func (h *Header) WithDeprecated(val bool) *Header

WithDeprecated sets Deprecated value.

func (*Header) WithDescription

func (h *Header) WithDescription(val string) *Header

WithDescription sets Description value.

func (*Header) WithExample

func (h *Header) WithExample(val interface{}) *Header

WithExample sets Example value.

func (*Header) WithExamples

func (h *Header) WithExamples(val map[string]ExampleOrRef) *Header

WithExamples sets Examples value.

func (*Header) WithExamplesItem

func (h *Header) WithExamplesItem(key string, val ExampleOrRef) *Header

WithExamplesItem sets Examples item value.

func (*Header) WithExplode

func (h *Header) WithExplode(val bool) *Header

WithExplode sets Explode value.

func (*Header) WithMapOfAnything

func (h *Header) WithMapOfAnything(val map[string]interface{}) *Header

WithMapOfAnything sets MapOfAnything value.

func (*Header) WithMapOfAnythingItem

func (h *Header) WithMapOfAnythingItem(key string, val interface{}) *Header

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Header) WithRequired

func (h *Header) WithRequired(val bool) *Header

WithRequired sets Required value.

func (*Header) WithSchema

func (h *Header) WithSchema(val SchemaOrRef) *Header

WithSchema sets Schema value.

type HeaderOrRef

type HeaderOrRef struct {
	HeaderReference *HeaderReference `json:"-"`
	Header          *Header          `json:"-"`
}

HeaderOrRef structure is generated from "#/definitions/HeaderOrRef".

func (*HeaderOrRef) HeaderEns

func (h *HeaderOrRef) HeaderEns() *Header

HeaderEns ensures returned Header is not nil.

func (*HeaderOrRef) HeaderReferenceEns

func (h *HeaderOrRef) HeaderReferenceEns() *HeaderReference

HeaderReferenceEns ensures returned HeaderReference is not nil.

func (HeaderOrRef) MarshalJSON

func (h HeaderOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*HeaderOrRef) UnmarshalJSON

func (h *HeaderOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HeaderOrRef) WithHeader

func (h *HeaderOrRef) WithHeader(val Header) *HeaderOrRef

WithHeader sets Header value.

func (*HeaderOrRef) WithHeaderReference

func (h *HeaderOrRef) WithHeaderReference(val HeaderReference) *HeaderOrRef

WithHeaderReference sets HeaderReference value.

type HeaderParameter

type HeaderParameter struct{}

HeaderParameter structure is generated from "#/definitions/ParameterLocation/oneOf/2".

Header Parameter.

Parameter in header.

func (HeaderParameter) MarshalJSON

func (h HeaderParameter) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*HeaderParameter) UnmarshalJSON

func (h *HeaderParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type HeaderReference

type HeaderReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

HeaderReference structure is generated from "#/definitions/HeaderReference".

func (*HeaderReference) UnmarshalJSON

func (h *HeaderReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*HeaderReference) WithRef

func (h *HeaderReference) WithRef(val string) *HeaderReference

WithRef sets Ref value.

type ImplicitOAuthFlow

type ImplicitOAuthFlow struct {
	// Format: uri-reference.
	// Required.
	AuthorizationURL string                 `json:"authorizationUrl"`
	RefreshURL       *string                `json:"refreshUrl,omitempty"` // Format: uri-reference.
	Scopes           map[string]string      `json:"scopes"`               // Required.
	MapOfAnything    map[string]interface{} `json:"-"`                    // Key must match pattern: `^x-`.
}

ImplicitOAuthFlow structure is generated from "#/definitions/ImplicitOAuthFlow".

func (ImplicitOAuthFlow) MarshalJSON

func (i ImplicitOAuthFlow) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ImplicitOAuthFlow) UnmarshalJSON

func (i *ImplicitOAuthFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ImplicitOAuthFlow) WithAuthorizationURL

func (i *ImplicitOAuthFlow) WithAuthorizationURL(val string) *ImplicitOAuthFlow

WithAuthorizationURL sets AuthorizationURL value.

func (*ImplicitOAuthFlow) WithMapOfAnything

func (i *ImplicitOAuthFlow) WithMapOfAnything(val map[string]interface{}) *ImplicitOAuthFlow

WithMapOfAnything sets MapOfAnything value.

func (*ImplicitOAuthFlow) WithMapOfAnythingItem

func (i *ImplicitOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *ImplicitOAuthFlow

WithMapOfAnythingItem sets MapOfAnything item value.

func (*ImplicitOAuthFlow) WithRefreshURL

func (i *ImplicitOAuthFlow) WithRefreshURL(val string) *ImplicitOAuthFlow

WithRefreshURL sets RefreshURL value.

func (*ImplicitOAuthFlow) WithScopes

func (i *ImplicitOAuthFlow) WithScopes(val map[string]string) *ImplicitOAuthFlow

WithScopes sets Scopes value.

func (*ImplicitOAuthFlow) WithScopesItem

func (i *ImplicitOAuthFlow) WithScopesItem(key string, val string) *ImplicitOAuthFlow

WithScopesItem sets Scopes item value.

type Info

type Info struct {
	Title          string                 `json:"title"` // Required.
	Description    *string                `json:"description,omitempty"`
	TermsOfService *string                `json:"termsOfService,omitempty"` // Format: uri-reference.
	Contact        *Contact               `json:"contact,omitempty"`
	License        *License               `json:"license,omitempty"`
	Version        string                 `json:"version"` // Required.
	MapOfAnything  map[string]interface{} `json:"-"`       // Key must match pattern: `^x-`.
}

Info structure is generated from "#/definitions/Info".

func (*Info) ContactEns

func (i *Info) ContactEns() *Contact

ContactEns ensures returned Contact is not nil.

func (*Info) LicenseEns

func (i *Info) LicenseEns() *License

LicenseEns ensures returned License is not nil.

func (Info) MarshalJSON

func (i Info) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Info) UnmarshalJSON

func (i *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Info) WithContact

func (i *Info) WithContact(val Contact) *Info

WithContact sets Contact value.

func (*Info) WithDescription

func (i *Info) WithDescription(val string) *Info

WithDescription sets Description value.

func (*Info) WithLicense

func (i *Info) WithLicense(val License) *Info

WithLicense sets License value.

func (*Info) WithMapOfAnything

func (i *Info) WithMapOfAnything(val map[string]interface{}) *Info

WithMapOfAnything sets MapOfAnything value.

func (*Info) WithMapOfAnythingItem

func (i *Info) WithMapOfAnythingItem(key string, val interface{}) *Info

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Info) WithTermsOfService

func (i *Info) WithTermsOfService(val string) *Info

WithTermsOfService sets TermsOfService value.

func (*Info) WithTitle

func (i *Info) WithTitle(val string) *Info

WithTitle sets Title value.

func (*Info) WithVersion

func (i *Info) WithVersion(val string) *Info

WithVersion sets Version value.

type License

type License struct {
	Name          string                 `json:"name"`          // Required.
	URL           *string                `json:"url,omitempty"` // Format: uri-reference.
	MapOfAnything map[string]interface{} `json:"-"`             // Key must match pattern: `^x-`.
}

License structure is generated from "#/definitions/License".

func (License) MarshalJSON

func (l License) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*License) UnmarshalJSON

func (l *License) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*License) WithMapOfAnything

func (l *License) WithMapOfAnything(val map[string]interface{}) *License

WithMapOfAnything sets MapOfAnything value.

func (*License) WithMapOfAnythingItem

func (l *License) WithMapOfAnythingItem(key string, val interface{}) *License

WithMapOfAnythingItem sets MapOfAnything item value.

func (*License) WithName

func (l *License) WithName(val string) *License

WithName sets Name value.

func (*License) WithURL

func (l *License) WithURL(val string) *License

WithURL sets URL value.

type Link struct {
	OperationID   *string                `json:"operationId,omitempty"`
	OperationRef  *string                `json:"operationRef,omitempty"` // Format: uri-reference.
	Parameters    map[string]interface{} `json:"parameters,omitempty"`
	RequestBody   *interface{}           `json:"requestBody,omitempty"`
	Description   *string                `json:"description,omitempty"`
	Server        *Server                `json:"server,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Link structure is generated from "#/definitions/Link".

func (Link) MarshalJSON

func (l Link) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Link) ServerEns

func (l *Link) ServerEns() *Server

ServerEns ensures returned Server is not nil.

func (*Link) UnmarshalJSON

func (l *Link) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Link) WithDescription

func (l *Link) WithDescription(val string) *Link

WithDescription sets Description value.

func (*Link) WithMapOfAnything

func (l *Link) WithMapOfAnything(val map[string]interface{}) *Link

WithMapOfAnything sets MapOfAnything value.

func (*Link) WithMapOfAnythingItem

func (l *Link) WithMapOfAnythingItem(key string, val interface{}) *Link

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Link) WithOperationID

func (l *Link) WithOperationID(val string) *Link

WithOperationID sets OperationID value.

func (*Link) WithOperationRef

func (l *Link) WithOperationRef(val string) *Link

WithOperationRef sets OperationRef value.

func (*Link) WithParameters

func (l *Link) WithParameters(val map[string]interface{}) *Link

WithParameters sets Parameters value.

func (*Link) WithParametersItem

func (l *Link) WithParametersItem(key string, val interface{}) *Link

WithParametersItem sets Parameters item value.

func (*Link) WithRequestBody

func (l *Link) WithRequestBody(val interface{}) *Link

WithRequestBody sets RequestBody value.

func (*Link) WithServer

func (l *Link) WithServer(val Server) *Link

WithServer sets Server value.

type LinkNot

type LinkNot struct {
	OperationID  interface{} `json:"operationId"`  // Required.
	OperationRef interface{} `json:"operationRef"` // Required.
}

LinkNot structure is generated from "#/definitions/Link->not".

Operation Id and Operation Ref are mutually exclusive.

func (*LinkNot) UnmarshalJSON

func (l *LinkNot) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*LinkNot) WithOperationID

func (l *LinkNot) WithOperationID(val interface{}) *LinkNot

WithOperationID sets OperationID value.

func (*LinkNot) WithOperationRef

func (l *LinkNot) WithOperationRef(val interface{}) *LinkNot

WithOperationRef sets OperationRef value.

type LinkOrRef

type LinkOrRef struct {
	LinkReference *LinkReference `json:"-"`
	Link          *Link          `json:"-"`
}

LinkOrRef structure is generated from "#/definitions/LinkOrRef".

func (*LinkOrRef) LinkEns

func (l *LinkOrRef) LinkEns() *Link

LinkEns ensures returned Link is not nil.

func (*LinkOrRef) LinkReferenceEns

func (l *LinkOrRef) LinkReferenceEns() *LinkReference

LinkReferenceEns ensures returned LinkReference is not nil.

func (LinkOrRef) MarshalJSON

func (l LinkOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*LinkOrRef) UnmarshalJSON

func (l *LinkOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (l *LinkOrRef) WithLink(val Link) *LinkOrRef

WithLink sets Link value.

func (*LinkOrRef) WithLinkReference

func (l *LinkOrRef) WithLinkReference(val LinkReference) *LinkOrRef

WithLinkReference sets LinkReference value.

type LinkReference

type LinkReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

LinkReference structure is generated from "#/definitions/LinkReference".

func (*LinkReference) UnmarshalJSON

func (l *LinkReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*LinkReference) WithRef

func (l *LinkReference) WithRef(val string) *LinkReference

WithRef sets Ref value.

type MediaType

type MediaType struct {
	Schema        *SchemaOrRef            `json:"schema,omitempty"`
	Example       *interface{}            `json:"example,omitempty"`
	Examples      map[string]ExampleOrRef `json:"examples,omitempty"`
	Encoding      map[string]Encoding     `json:"encoding,omitempty"`
	MapOfAnything map[string]interface{}  `json:"-"` // Key must match pattern: `^x-`.
}

MediaType structure is generated from "#/definitions/MediaType".

func (MediaType) MarshalJSON

func (m MediaType) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*MediaType) SchemaEns

func (m *MediaType) SchemaEns() *SchemaOrRef

SchemaEns ensures returned Schema is not nil.

func (*MediaType) UnmarshalJSON

func (m *MediaType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*MediaType) WithEncoding

func (m *MediaType) WithEncoding(val map[string]Encoding) *MediaType

WithEncoding sets Encoding value.

func (*MediaType) WithEncodingItem

func (m *MediaType) WithEncodingItem(key string, val Encoding) *MediaType

WithEncodingItem sets Encoding item value.

func (*MediaType) WithExample

func (m *MediaType) WithExample(val interface{}) *MediaType

WithExample sets Example value.

func (*MediaType) WithExamples

func (m *MediaType) WithExamples(val map[string]ExampleOrRef) *MediaType

WithExamples sets Examples value.

func (*MediaType) WithExamplesItem

func (m *MediaType) WithExamplesItem(key string, val ExampleOrRef) *MediaType

WithExamplesItem sets Examples item value.

func (*MediaType) WithMapOfAnything

func (m *MediaType) WithMapOfAnything(val map[string]interface{}) *MediaType

WithMapOfAnything sets MapOfAnything value.

func (*MediaType) WithMapOfAnythingItem

func (m *MediaType) WithMapOfAnythingItem(key string, val interface{}) *MediaType

WithMapOfAnythingItem sets MapOfAnything item value.

func (*MediaType) WithSchema

func (m *MediaType) WithSchema(val SchemaOrRef) *MediaType

WithSchema sets Schema value.

type NonBearer

type NonBearer struct {
	Scheme *interface{} `json:"scheme,omitempty"`
}

NonBearer structure is generated from "#/definitions/HTTPSecurityScheme/oneOf/1".

Non Bearer.

Non Bearer.

func (*NonBearer) UnmarshalJSON

func (b *NonBearer) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*NonBearer) WithScheme

func (n *NonBearer) WithScheme(val interface{}) *NonBearer

WithScheme sets Scheme value.

type OAuth2SecurityScheme

type OAuth2SecurityScheme struct {
	Flows         OAuthFlows             `json:"flows"` // Required.
	Description   *string                `json:"description,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

OAuth2SecurityScheme structure is generated from "#/definitions/OAuth2SecurityScheme".

func (OAuth2SecurityScheme) MarshalJSON

func (o OAuth2SecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OAuth2SecurityScheme) UnmarshalJSON

func (o *OAuth2SecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OAuth2SecurityScheme) WithDescription

func (o *OAuth2SecurityScheme) WithDescription(val string) *OAuth2SecurityScheme

WithDescription sets Description value.

func (*OAuth2SecurityScheme) WithFlows

WithFlows sets Flows value.

func (*OAuth2SecurityScheme) WithMapOfAnything

func (o *OAuth2SecurityScheme) WithMapOfAnything(val map[string]interface{}) *OAuth2SecurityScheme

WithMapOfAnything sets MapOfAnything value.

func (*OAuth2SecurityScheme) WithMapOfAnythingItem

func (o *OAuth2SecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *OAuth2SecurityScheme

WithMapOfAnythingItem sets MapOfAnything item value.

type OAuthFlows

type OAuthFlows struct {
	Implicit          *ImplicitOAuthFlow          `json:"implicit,omitempty"`
	Password          *PasswordOAuthFlow          `json:"password,omitempty"`
	ClientCredentials *ClientCredentialsFlow      `json:"clientCredentials,omitempty"`
	AuthorizationCode *AuthorizationCodeOAuthFlow `json:"authorizationCode,omitempty"`
	MapOfAnything     map[string]interface{}      `json:"-"` // Key must match pattern: `^x-`.
}

OAuthFlows structure is generated from "#/definitions/OAuthFlows".

func (*OAuthFlows) AuthorizationCodeEns

func (o *OAuthFlows) AuthorizationCodeEns() *AuthorizationCodeOAuthFlow

AuthorizationCodeEns ensures returned AuthorizationCode is not nil.

func (*OAuthFlows) ClientCredentialsEns

func (o *OAuthFlows) ClientCredentialsEns() *ClientCredentialsFlow

ClientCredentialsEns ensures returned ClientCredentials is not nil.

func (*OAuthFlows) ImplicitEns

func (o *OAuthFlows) ImplicitEns() *ImplicitOAuthFlow

ImplicitEns ensures returned Implicit is not nil.

func (OAuthFlows) MarshalJSON

func (o OAuthFlows) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OAuthFlows) PasswordEns

func (o *OAuthFlows) PasswordEns() *PasswordOAuthFlow

PasswordEns ensures returned Password is not nil.

func (*OAuthFlows) UnmarshalJSON

func (o *OAuthFlows) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OAuthFlows) WithAuthorizationCode

func (o *OAuthFlows) WithAuthorizationCode(val AuthorizationCodeOAuthFlow) *OAuthFlows

WithAuthorizationCode sets AuthorizationCode value.

func (*OAuthFlows) WithClientCredentials

func (o *OAuthFlows) WithClientCredentials(val ClientCredentialsFlow) *OAuthFlows

WithClientCredentials sets ClientCredentials value.

func (*OAuthFlows) WithImplicit

func (o *OAuthFlows) WithImplicit(val ImplicitOAuthFlow) *OAuthFlows

WithImplicit sets Implicit value.

func (*OAuthFlows) WithMapOfAnything

func (o *OAuthFlows) WithMapOfAnything(val map[string]interface{}) *OAuthFlows

WithMapOfAnything sets MapOfAnything value.

func (*OAuthFlows) WithMapOfAnythingItem

func (o *OAuthFlows) WithMapOfAnythingItem(key string, val interface{}) *OAuthFlows

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OAuthFlows) WithPassword

func (o *OAuthFlows) WithPassword(val PasswordOAuthFlow) *OAuthFlows

WithPassword sets Password value.

type OpenIDConnectSecurityScheme

type OpenIDConnectSecurityScheme struct {
	// Format: uri-reference.
	// Required.
	OpenIDConnectURL string                 `json:"openIdConnectUrl"`
	Description      *string                `json:"description,omitempty"`
	MapOfAnything    map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

OpenIDConnectSecurityScheme structure is generated from "#/definitions/OpenIdConnectSecurityScheme".

func (OpenIDConnectSecurityScheme) MarshalJSON

func (o OpenIDConnectSecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*OpenIDConnectSecurityScheme) UnmarshalJSON

func (o *OpenIDConnectSecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*OpenIDConnectSecurityScheme) WithDescription

WithDescription sets Description value.

func (*OpenIDConnectSecurityScheme) WithMapOfAnything

func (o *OpenIDConnectSecurityScheme) WithMapOfAnything(val map[string]interface{}) *OpenIDConnectSecurityScheme

WithMapOfAnything sets MapOfAnything value.

func (*OpenIDConnectSecurityScheme) WithMapOfAnythingItem

func (o *OpenIDConnectSecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *OpenIDConnectSecurityScheme

WithMapOfAnythingItem sets MapOfAnything item value.

func (*OpenIDConnectSecurityScheme) WithOpenIDConnectURL

func (o *OpenIDConnectSecurityScheme) WithOpenIDConnectURL(val string) *OpenIDConnectSecurityScheme

WithOpenIDConnectURL sets OpenIDConnectURL value.

type Operation

type Operation struct {
	Tags          []string                 `json:"tags,omitempty"`
	Summary       *string                  `json:"summary,omitempty"`
	Description   *string                  `json:"description,omitempty"`
	ExternalDocs  *ExternalDocumentation   `json:"externalDocs,omitempty"`
	ID            *string                  `json:"operationId,omitempty"`
	Parameters    []ParameterOrRef         `json:"parameters,omitempty"`
	RequestBody   *RequestBodyOrRef        `json:"requestBody,omitempty"`
	Responses     Responses                `json:"responses"` // Required.
	Callbacks     map[string]CallbackOrRef `json:"callbacks,omitempty"`
	Deprecated    *bool                    `json:"deprecated,omitempty"`
	Security      []map[string][]string    `json:"security,omitempty"`
	Servers       []Server                 `json:"servers,omitempty"`
	MapOfAnything map[string]interface{}   `json:"-"` // Key must match pattern: `^x-`.
}

Operation structure is generated from "#/definitions/Operation".

func (*Operation) ExternalDocsEns

func (o *Operation) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Operation) MarshalJSON

func (o Operation) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Operation) RequestBodyEns

func (o *Operation) RequestBodyEns() *RequestBodyOrRef

RequestBodyEns ensures returned RequestBody is not nil.

func (Operation) UnknownParamIsForbidden

func (o Operation) UnknownParamIsForbidden(in ParameterIn) bool

UnknownParamIsForbidden indicates forbidden unknown parameters.

func (*Operation) UnmarshalJSON

func (o *Operation) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Operation) WithCallbacks

func (o *Operation) WithCallbacks(val map[string]CallbackOrRef) *Operation

WithCallbacks sets Callbacks value.

func (*Operation) WithCallbacksItem

func (o *Operation) WithCallbacksItem(key string, val CallbackOrRef) *Operation

WithCallbacksItem sets Callbacks item value.

func (*Operation) WithDeprecated

func (o *Operation) WithDeprecated(val bool) *Operation

WithDeprecated sets Deprecated value.

func (*Operation) WithDescription

func (o *Operation) WithDescription(val string) *Operation

WithDescription sets Description value.

func (*Operation) WithExternalDocs

func (o *Operation) WithExternalDocs(val ExternalDocumentation) *Operation

WithExternalDocs sets ExternalDocs value.

func (*Operation) WithID

func (o *Operation) WithID(val string) *Operation

WithID sets ID value.

func (*Operation) WithMapOfAnything

func (o *Operation) WithMapOfAnything(val map[string]interface{}) *Operation

WithMapOfAnything sets MapOfAnything value.

func (*Operation) WithMapOfAnythingItem

func (o *Operation) WithMapOfAnythingItem(key string, val interface{}) *Operation

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Operation) WithParameters

func (o *Operation) WithParameters(val ...ParameterOrRef) *Operation

WithParameters sets Parameters value.

func (*Operation) WithRequestBody

func (o *Operation) WithRequestBody(val RequestBodyOrRef) *Operation

WithRequestBody sets RequestBody value.

func (*Operation) WithResponses

func (o *Operation) WithResponses(val Responses) *Operation

WithResponses sets Responses value.

func (*Operation) WithSecurity

func (o *Operation) WithSecurity(val ...map[string][]string) *Operation

WithSecurity sets Security value.

func (*Operation) WithServers

func (o *Operation) WithServers(val ...Server) *Operation

WithServers sets Servers value.

func (*Operation) WithSummary

func (o *Operation) WithSummary(val string) *Operation

WithSummary sets Summary value.

func (*Operation) WithTags

func (o *Operation) WithTags(val ...string) *Operation

WithTags sets Tags value.

type OperationContext deprecated

type OperationContext struct {
	Operation  *Operation
	Input      interface{}
	HTTPMethod string

	ReqQueryMapping    map[string]string
	ReqPathMapping     map[string]string
	ReqCookieMapping   map[string]string
	ReqHeaderMapping   map[string]string
	ReqFormDataMapping map[string]string

	Output            interface{}
	HTTPStatus        int
	RespContentType   string
	RespHeaderMapping map[string]string

	ProcessingResponse bool
	ProcessingIn       string
}

OperationContext describes operation.

Deprecated: use Reflector.NewOperationContext, exported access might be revoked in the future.

func OperationCtx deprecated

func OperationCtx(rc *jsonschema.ReflectContext) (OperationContext, bool)

OperationCtx retrieves operation context from reflect context.

Deprecated: use openapi.OperationCtx.

type OperationExposer

type OperationExposer interface {
	Operation() *Operation
}

OperationExposer grants access to underlying *Operation.

type Parameter

type Parameter struct {
	Name             string                  `json:"name"` // Required.
	In               ParameterIn             `json:"in"`   // Required.
	Description      *string                 `json:"description,omitempty"`
	Required         *bool                   `json:"required,omitempty"`
	Deprecated       *bool                   `json:"deprecated,omitempty"`
	AllowEmptyValue  *bool                   `json:"allowEmptyValue,omitempty"`
	Style            *string                 `json:"style,omitempty"`
	Explode          *bool                   `json:"explode,omitempty"`
	AllowReserved    *bool                   `json:"allowReserved,omitempty"`
	Schema           *SchemaOrRef            `json:"schema,omitempty"`
	Content          map[string]MediaType    `json:"content,omitempty"`
	Example          *interface{}            `json:"example,omitempty"`
	Examples         map[string]ExampleOrRef `json:"examples,omitempty"`
	SchemaXORContent *SchemaXORContent       `json:"-"`
	Location         *ParameterLocation      `json:"-"`
	MapOfAnything    map[string]interface{}  `json:"-"` // Key must match pattern: `^x-`.
}

Parameter structure is generated from "#/definitions/Parameter".

func (*Parameter) LocationEns

func (p *Parameter) LocationEns() *ParameterLocation

LocationEns ensures returned Location is not nil.

func (Parameter) MarshalJSON

func (p Parameter) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Parameter) SchemaEns

func (p *Parameter) SchemaEns() *SchemaOrRef

SchemaEns ensures returned Schema is not nil.

func (*Parameter) SchemaXORContentEns

func (p *Parameter) SchemaXORContentEns() *SchemaXORContent

SchemaXORContentEns ensures returned SchemaXORContent is not nil.

func (Parameter) ToParameterOrRef

func (p Parameter) ToParameterOrRef() ParameterOrRef

ToParameterOrRef exposes Parameter in general form.

func (*Parameter) UnmarshalJSON

func (p *Parameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Parameter) WithAllowEmptyValue

func (p *Parameter) WithAllowEmptyValue(val bool) *Parameter

WithAllowEmptyValue sets AllowEmptyValue value.

func (*Parameter) WithAllowReserved

func (p *Parameter) WithAllowReserved(val bool) *Parameter

WithAllowReserved sets AllowReserved value.

func (*Parameter) WithContent

func (p *Parameter) WithContent(val map[string]MediaType) *Parameter

WithContent sets Content value.

func (*Parameter) WithContentItem

func (p *Parameter) WithContentItem(key string, val MediaType) *Parameter

WithContentItem sets Content item value.

func (*Parameter) WithDeprecated

func (p *Parameter) WithDeprecated(val bool) *Parameter

WithDeprecated sets Deprecated value.

func (*Parameter) WithDescription

func (p *Parameter) WithDescription(val string) *Parameter

WithDescription sets Description value.

func (*Parameter) WithExample

func (p *Parameter) WithExample(val interface{}) *Parameter

WithExample sets Example value.

func (*Parameter) WithExamples

func (p *Parameter) WithExamples(val map[string]ExampleOrRef) *Parameter

WithExamples sets Examples value.

func (*Parameter) WithExamplesItem

func (p *Parameter) WithExamplesItem(key string, val ExampleOrRef) *Parameter

WithExamplesItem sets Examples item value.

func (*Parameter) WithExplode

func (p *Parameter) WithExplode(val bool) *Parameter

WithExplode sets Explode value.

func (*Parameter) WithIn

func (p *Parameter) WithIn(val ParameterIn) *Parameter

WithIn sets In value.

func (*Parameter) WithLocation

func (p *Parameter) WithLocation(val ParameterLocation) *Parameter

WithLocation sets Location value.

func (*Parameter) WithMapOfAnything

func (p *Parameter) WithMapOfAnything(val map[string]interface{}) *Parameter

WithMapOfAnything sets MapOfAnything value.

func (*Parameter) WithMapOfAnythingItem

func (p *Parameter) WithMapOfAnythingItem(key string, val interface{}) *Parameter

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Parameter) WithName

func (p *Parameter) WithName(val string) *Parameter

WithName sets Name value.

func (*Parameter) WithRequired

func (p *Parameter) WithRequired(val bool) *Parameter

WithRequired sets Required value.

func (*Parameter) WithSchema

func (p *Parameter) WithSchema(val SchemaOrRef) *Parameter

WithSchema sets Schema value.

func (*Parameter) WithSchemaXORContent

func (p *Parameter) WithSchemaXORContent(val SchemaXORContent) *Parameter

WithSchemaXORContent sets SchemaXORContent value.

func (*Parameter) WithStyle

func (p *Parameter) WithStyle(val string) *Parameter

WithStyle sets Style value.

type ParameterIn

type ParameterIn string

ParameterIn is an enum type.

func (ParameterIn) MarshalJSON

func (i ParameterIn) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterIn) UnmarshalJSON

func (i *ParameterIn) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type ParameterLocation

type ParameterLocation struct {
	PathParameter   *PathParameter   `json:"-"`
	QueryParameter  *QueryParameter  `json:"-"`
	HeaderParameter *HeaderParameter `json:"-"`
	CookieParameter *CookieParameter `json:"-"`
}

ParameterLocation structure is generated from "#/definitions/ParameterLocation".

Parameter location.

func (*ParameterLocation) CookieParameterEns

func (p *ParameterLocation) CookieParameterEns() *CookieParameter

CookieParameterEns ensures returned CookieParameter is not nil.

func (*ParameterLocation) HeaderParameterEns

func (p *ParameterLocation) HeaderParameterEns() *HeaderParameter

HeaderParameterEns ensures returned HeaderParameter is not nil.

func (ParameterLocation) MarshalJSON

func (p ParameterLocation) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterLocation) PathParameterEns

func (p *ParameterLocation) PathParameterEns() *PathParameter

PathParameterEns ensures returned PathParameter is not nil.

func (*ParameterLocation) QueryParameterEns

func (p *ParameterLocation) QueryParameterEns() *QueryParameter

QueryParameterEns ensures returned QueryParameter is not nil.

func (*ParameterLocation) UnmarshalJSON

func (p *ParameterLocation) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ParameterLocation) WithCookieParameter

func (p *ParameterLocation) WithCookieParameter(val CookieParameter) *ParameterLocation

WithCookieParameter sets CookieParameter value.

func (*ParameterLocation) WithHeaderParameter

func (p *ParameterLocation) WithHeaderParameter(val HeaderParameter) *ParameterLocation

WithHeaderParameter sets HeaderParameter value.

func (*ParameterLocation) WithPathParameter

func (p *ParameterLocation) WithPathParameter(val PathParameter) *ParameterLocation

WithPathParameter sets PathParameter value.

func (*ParameterLocation) WithQueryParameter

func (p *ParameterLocation) WithQueryParameter(val QueryParameter) *ParameterLocation

WithQueryParameter sets QueryParameter value.

type ParameterOrRef

type ParameterOrRef struct {
	ParameterReference *ParameterReference `json:"-"`
	Parameter          *Parameter          `json:"-"`
}

ParameterOrRef structure is generated from "#/definitions/ParameterOrRef".

func (ParameterOrRef) MarshalJSON

func (p ParameterOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ParameterOrRef) ParameterEns

func (p *ParameterOrRef) ParameterEns() *Parameter

ParameterEns ensures returned Parameter is not nil.

func (*ParameterOrRef) ParameterReferenceEns

func (p *ParameterOrRef) ParameterReferenceEns() *ParameterReference

ParameterReferenceEns ensures returned ParameterReference is not nil.

func (*ParameterOrRef) UnmarshalJSON

func (p *ParameterOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ParameterOrRef) WithParameter

func (p *ParameterOrRef) WithParameter(val Parameter) *ParameterOrRef

WithParameter sets Parameter value.

func (*ParameterOrRef) WithParameterReference

func (p *ParameterOrRef) WithParameterReference(val ParameterReference) *ParameterOrRef

WithParameterReference sets ParameterReference value.

type ParameterReference

type ParameterReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

ParameterReference structure is generated from "#/definitions/ParameterReference".

func (*ParameterReference) UnmarshalJSON

func (p *ParameterReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ParameterReference) WithRef

func (p *ParameterReference) WithRef(val string) *ParameterReference

WithRef sets Ref value.

type PasswordOAuthFlow

type PasswordOAuthFlow struct {
	// Format: uri-reference.
	// Required.
	TokenURL      string                 `json:"tokenUrl"`
	RefreshURL    *string                `json:"refreshUrl,omitempty"` // Format: uri-reference.
	Scopes        map[string]string      `json:"scopes,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

PasswordOAuthFlow structure is generated from "#/definitions/PasswordOAuthFlow".

func (PasswordOAuthFlow) MarshalJSON

func (p PasswordOAuthFlow) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*PasswordOAuthFlow) UnmarshalJSON

func (p *PasswordOAuthFlow) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*PasswordOAuthFlow) WithMapOfAnything

func (p *PasswordOAuthFlow) WithMapOfAnything(val map[string]interface{}) *PasswordOAuthFlow

WithMapOfAnything sets MapOfAnything value.

func (*PasswordOAuthFlow) WithMapOfAnythingItem

func (p *PasswordOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *PasswordOAuthFlow

WithMapOfAnythingItem sets MapOfAnything item value.

func (*PasswordOAuthFlow) WithRefreshURL

func (p *PasswordOAuthFlow) WithRefreshURL(val string) *PasswordOAuthFlow

WithRefreshURL sets RefreshURL value.

func (*PasswordOAuthFlow) WithScopes

func (p *PasswordOAuthFlow) WithScopes(val map[string]string) *PasswordOAuthFlow

WithScopes sets Scopes value.

func (*PasswordOAuthFlow) WithScopesItem

func (p *PasswordOAuthFlow) WithScopesItem(key string, val string) *PasswordOAuthFlow

WithScopesItem sets Scopes item value.

func (*PasswordOAuthFlow) WithTokenURL

func (p *PasswordOAuthFlow) WithTokenURL(val string) *PasswordOAuthFlow

WithTokenURL sets TokenURL value.

type PathItem

type PathItem struct {
	Ref                  *string                `json:"$ref,omitempty"`
	Summary              *string                `json:"summary,omitempty"`
	Description          *string                `json:"description,omitempty"`
	Servers              []Server               `json:"servers,omitempty"`
	Parameters           []ParameterOrRef       `json:"parameters,omitempty"`
	MapOfOperationValues map[string]Operation   `json:"-"` // Key must match pattern: `^(get|put|post|delete|options|head|patch|trace)$`.
	MapOfAnything        map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

PathItem structure is generated from "#/definitions/PathItem".

func (PathItem) MarshalJSON

func (p PathItem) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*PathItem) UnmarshalJSON

func (p *PathItem) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*PathItem) WithDescription

func (p *PathItem) WithDescription(val string) *PathItem

WithDescription sets Description value.

func (*PathItem) WithMapOfAnything

func (p *PathItem) WithMapOfAnything(val map[string]interface{}) *PathItem

WithMapOfAnything sets MapOfAnything value.

func (*PathItem) WithMapOfAnythingItem

func (p *PathItem) WithMapOfAnythingItem(key string, val interface{}) *PathItem

WithMapOfAnythingItem sets MapOfAnything item value.

func (*PathItem) WithMapOfOperationValues

func (p *PathItem) WithMapOfOperationValues(val map[string]Operation) *PathItem

WithMapOfOperationValues sets MapOfOperationValues value.

func (*PathItem) WithMapOfOperationValuesItem

func (p *PathItem) WithMapOfOperationValuesItem(key string, val Operation) *PathItem

WithMapOfOperationValuesItem sets MapOfOperationValues item value.

func (*PathItem) WithOperation deprecated

func (p *PathItem) WithOperation(method string, operation Operation) *PathItem

WithOperation sets Operation to PathItem.

Deprecated: use Spec.AddOperation.

func (*PathItem) WithParameters

func (p *PathItem) WithParameters(val ...ParameterOrRef) *PathItem

WithParameters sets Parameters value.

func (*PathItem) WithRef

func (p *PathItem) WithRef(val string) *PathItem

WithRef sets Ref value.

func (*PathItem) WithServers

func (p *PathItem) WithServers(val ...Server) *PathItem

WithServers sets Servers value.

func (*PathItem) WithSummary

func (p *PathItem) WithSummary(val string) *PathItem

WithSummary sets Summary value.

type PathParameter

type PathParameter struct {
	Style *PathParameterStyle `json:"style,omitempty"`
}

PathParameter structure is generated from "#/definitions/ParameterLocation/oneOf/0".

Path Parameter.

Parameter in path.

func (PathParameter) MarshalJSON

func (p PathParameter) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*PathParameter) UnmarshalJSON

func (p *PathParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*PathParameter) WithStyle

func (p *PathParameter) WithStyle(val PathParameterStyle) *PathParameter

WithStyle sets Style value.

type PathParameterStyle

type PathParameterStyle string

PathParameterStyle is an enum type.

func (PathParameterStyle) MarshalJSON

func (i PathParameterStyle) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*PathParameterStyle) UnmarshalJSON

func (i *PathParameterStyle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Paths

type Paths struct {
	MapOfPathItemValues map[string]PathItem    `json:"-"` // Key must match pattern: `^\/`.
	MapOfAnything       map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Paths structure is generated from "#/definitions/Paths".

func (Paths) MarshalJSON

func (p Paths) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Paths) UnmarshalJSON

func (p *Paths) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Paths) WithMapOfAnything

func (p *Paths) WithMapOfAnything(val map[string]interface{}) *Paths

WithMapOfAnything sets MapOfAnything value.

func (*Paths) WithMapOfAnythingItem

func (p *Paths) WithMapOfAnythingItem(key string, val interface{}) *Paths

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Paths) WithMapOfPathItemValues

func (p *Paths) WithMapOfPathItemValues(val map[string]PathItem) *Paths

WithMapOfPathItemValues sets MapOfPathItemValues value.

func (*Paths) WithMapOfPathItemValuesItem

func (p *Paths) WithMapOfPathItemValuesItem(key string, val PathItem) *Paths

WithMapOfPathItemValuesItem sets MapOfPathItemValues item value.

type QueryParameter

type QueryParameter struct {
	Style *QueryParameterStyle `json:"style,omitempty"`
}

QueryParameter structure is generated from "#/definitions/ParameterLocation/oneOf/1".

Query Parameter.

Parameter in query.

func (QueryParameter) MarshalJSON

func (q QueryParameter) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*QueryParameter) UnmarshalJSON

func (q *QueryParameter) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*QueryParameter) WithStyle

WithStyle sets Style value.

type QueryParameterStyle

type QueryParameterStyle string

QueryParameterStyle is an enum type.

func (QueryParameterStyle) MarshalJSON

func (i QueryParameterStyle) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*QueryParameterStyle) UnmarshalJSON

func (i *QueryParameterStyle) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type Reflector

type Reflector struct {
	jsonschema.Reflector
	Spec *Spec
}

Reflector builds OpenAPI Schema with reflected structures.

Example (Options)
r := openapi3.Reflector{}

// Reflector embeds jsonschema.Reflector and it is possible to configure optional behavior.
r.Reflector.DefaultOptions = append(r.Reflector.DefaultOptions,
	jsonschema.InterceptNullability(func(params jsonschema.InterceptNullabilityParams) {
		// Removing nullability from non-pointer slices (regardless of omitempty).
		if params.Type.Kind() != reflect.Ptr && params.Schema.HasType(jsonschema.Null) && params.Schema.HasType(jsonschema.Array) {
			*params.Schema.Type = jsonschema.Array.Type()
		}
	}))

type req struct {
	Foo []int `json:"foo"`
}

oc, _ := r.NewOperationContext(http.MethodPost, "/foo")
oc.AddReqStructure(new(req))

_ = r.AddOperation(oc)

j, _ := assertjson.MarshalIndentCompact(r.Spec, "", " ", 120)

fmt.Println(string(j))
Output:

{
 "openapi":"3.0.3","info":{"title":"","version":""},
 "paths":{
  "/foo":{
   "post":{
    "requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Openapi3TestReq"}}}},
    "responses":{"204":{"description":"No Content"}}
   }
  }
 },
 "components":{"schemas":{"Openapi3TestReq":{"type":"object","properties":{"foo":{"type":"array","items":{"type":"integer"}}}}}}
}

func NewReflector

func NewReflector() *Reflector

NewReflector creates an instance of OpenAPI 3.0 reflector.

func (*Reflector) AddOperation

func (r *Reflector) AddOperation(oc openapi.OperationContext) error

AddOperation configures operation request and response schema.

Example
reflector := openapi3.NewReflector()
reflector.Spec = &openapi3.Spec{Openapi: "3.0.3"}
reflector.Spec.Info.
	WithTitle("Things API").
	WithVersion("1.2.3").
	WithDescription("Put something here")

type req struct {
	ID     string `path:"id" example:"XXX-XXXXX"`
	Locale string `query:"locale" pattern:"^[a-z]{2}-[A-Z]{2}$"`
	Title  string `json:"string"`
	Amount uint   `json:"amount"`
	Items  []struct {
		Count uint   `json:"count"`
		Name  string `json:"name"`
	} `json:"items,omitempty"`
}

type resp struct {
	ID     string `json:"id" example:"XXX-XXXXX"`
	Amount uint   `json:"amount"`
	Items  []struct {
		Count uint   `json:"count"`
		Name  string `json:"name"`
	} `json:"items,omitempty"`
	UpdatedAt time.Time `json:"updated_at"`
}

putOp, _ := reflector.NewOperationContext(http.MethodPut, "/things/{id}")

putOp.AddReqStructure(new(req))
putOp.AddRespStructure(new(resp))
putOp.AddRespStructure(new([]resp), openapi.WithHTTPStatus(http.StatusConflict))
handleError(reflector.AddOperation(putOp))

getOp, _ := reflector.NewOperationContext(http.MethodGet, "/things/{id}")
getOp.AddReqStructure(new(req))
getOp.AddRespStructure(new(resp))
handleError(reflector.AddOperation(getOp))

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.0.3
info:
  description: Put something here
  title: Things API
  version: 1.2.3
paths:
  /things/{id}:
    get:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - in: path
        name: id
        required: true
        schema:
          example: XXX-XXXXX
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Openapi3TestResp'
          description: OK
    put:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - in: path
        name: id
        required: true
        schema:
          example: XXX-XXXXX
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Openapi3TestReq'
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Openapi3TestResp'
          description: OK
        "409":
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/Openapi3TestResp'
                type: array
          description: Conflict
components:
  schemas:
    Openapi3TestReq:
      properties:
        amount:
          minimum: 0
          type: integer
        items:
          items:
            properties:
              count:
                minimum: 0
                type: integer
              name:
                type: string
            type: object
          type: array
        string:
          type: string
      type: object
    Openapi3TestResp:
      properties:
        amount:
          minimum: 0
          type: integer
        id:
          example: XXX-XXXXX
          type: string
        items:
          items:
            properties:
              count:
                minimum: 0
                type: integer
              name:
                type: string
            type: object
          type: array
        updated_at:
          format: date-time
          type: string
      type: object
Example (QueryObject)
package main

import (
	"fmt"
	"log"
	"net/http"

	"github.com/STARRISEPH/openapi-go/openapi3"
)

func main() {
	reflector := openapi3.NewReflector()
	reflector.Spec.Info.
		WithTitle("Things API").
		WithVersion("1.2.3").
		WithDescription("Put something here")

	type jsonFilter struct {
		Foo    string `json:"foo"`
		Bar    int    `json:"bar"`
		Deeper struct {
			Val string `json:"val"`
		} `json:"deeper"`
	}

	type deepObjectFilter struct {
		Baz    bool    `query:"baz"`
		Quux   float64 `query:"quux"`
		Deeper struct {
			Val string `query:"val"`
		} `query:"deeper"`
	}

	type req struct {
		ID     string `path:"id" example:"XXX-XXXXX"`
		Locale string `query:"locale" pattern:"^[a-z]{2}-[A-Z]{2}$"`
		// Object values can be serialized in JSON (with json field tags in the value struct).
		JSONFilter jsonFilter `query:"json_filter"`
		// Or as deepObject (with same field tag as parent, .e.g query).
		DeepObjectFilter deepObjectFilter `query:"deep_object_filter"`
	}

	getOp, _ := reflector.NewOperationContext(http.MethodGet, "/things/{id}")

	getOp.AddReqStructure(new(req))
	_ = reflector.AddOperation(getOp)

	schema, err := reflector.Spec.MarshalYAML()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(string(schema))

}
Output:

openapi: 3.0.3
info:
  description: Put something here
  title: Things API
  version: 1.2.3
paths:
  /things/{id}:
    get:
      parameters:
      - in: query
        name: locale
        schema:
          pattern: ^[a-z]{2}-[A-Z]{2}$
          type: string
      - content:
          application/json:
            schema:
              $ref: '#/components/schemas/Openapi3TestJsonFilter'
        in: query
        name: json_filter
      - explode: true
        in: query
        name: deep_object_filter
        schema:
          $ref: '#/components/schemas/Openapi3TestDeepObjectFilter'
        style: deepObject
      - in: path
        name: id
        required: true
        schema:
          example: XXX-XXXXX
          type: string
      responses:
        "204":
          description: No Content
components:
  schemas:
    Openapi3TestDeepObjectFilter:
      properties:
        baz:
          type: boolean
        deeper:
          properties:
            val:
              type: string
          type: object
        quux:
          type: number
      type: object
    Openapi3TestJsonFilter:
      properties:
        bar:
          type: integer
        deeper:
          properties:
            val:
              type: string
          type: object
        foo:
          type: string
      type: object

func (*Reflector) JSONSchemaReflector

func (r *Reflector) JSONSchemaReflector() *jsonschema.Reflector

JSONSchemaReflector provides access to a low-level struct reflector.

func (*Reflector) NewOperationContext

func (r *Reflector) NewOperationContext(method, pathPattern string) (openapi.OperationContext, error)

NewOperationContext initializes openapi.OperationContext to be prepared and added later with Reflector.AddOperation.

func (*Reflector) ResolveJSONSchemaRef

func (r *Reflector) ResolveJSONSchemaRef(ref string) (s jsonschema.SchemaOrBool, found bool)

ResolveJSONSchemaRef builds JSON Schema from OpenAPI Component Schema reference.

Can be used in jsonschema.Schema IsTrivial().

func (*Reflector) SetJSONResponse deprecated

func (r *Reflector) SetJSONResponse(o *Operation, output interface{}, httpStatus int) error

SetJSONResponse sets up operation JSON response.

Deprecated: use AddOperation with openapi.OperationContext AddRespStructure.

func (*Reflector) SetRequest deprecated

func (r *Reflector) SetRequest(o *Operation, input interface{}, httpMethod string) error

SetRequest sets up operation parameters.

Deprecated: instrument openapi.OperationContext and use AddOperation.

func (*Reflector) SetStringResponse deprecated

func (r *Reflector) SetStringResponse(o *Operation, httpStatus int, contentType string) error

SetStringResponse sets unstructured response.

Deprecated: use AddOperation with openapi.OperationContext AddRespStructure.

func (*Reflector) SetupRequest deprecated

func (r *Reflector) SetupRequest(c OperationContext) error

SetupRequest sets up operation parameters.

Deprecated: instrument openapi.OperationContext and use AddOperation.

func (*Reflector) SetupResponse deprecated

func (r *Reflector) SetupResponse(oc OperationContext) error

SetupResponse sets up operation response.

Deprecated: use AddOperation with openapi.OperationContext AddRespStructure.

func (*Reflector) SpecEns

func (r *Reflector) SpecEns() *Spec

SpecEns ensures returned Spec is not nil.

func (*Reflector) SpecSchema

func (r *Reflector) SpecSchema() openapi.SpecSchema

SpecSchema returns OpenAPI spec schema.

func (*Reflector) WalkRequestJSONSchemas

func (r *Reflector) WalkRequestJSONSchemas(
	method string,
	cu openapi.ContentUnit,
	cb openapi.JSONSchemaCallback,
	done func(oc openapi.OperationContext),
) error

WalkRequestJSONSchemas iterates over request parameters of a ContentUnit and call user function for param schemas.

func (*Reflector) WalkResponseJSONSchemas

func (r *Reflector) WalkResponseJSONSchemas(cu openapi.ContentUnit, cb openapi.JSONSchemaCallback, done func(oc openapi.OperationContext)) error

WalkResponseJSONSchemas provides JSON schemas for response structure.

type RequestBody

type RequestBody struct {
	Description   *string                `json:"description,omitempty"`
	Content       map[string]MediaType   `json:"content"` // Required.
	Required      *bool                  `json:"required,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

RequestBody structure is generated from "#/definitions/RequestBody".

func (RequestBody) MarshalJSON

func (r RequestBody) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*RequestBody) UnmarshalJSON

func (r *RequestBody) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*RequestBody) WithContent

func (r *RequestBody) WithContent(val map[string]MediaType) *RequestBody

WithContent sets Content value.

func (*RequestBody) WithContentItem

func (r *RequestBody) WithContentItem(key string, val MediaType) *RequestBody

WithContentItem sets Content item value.

func (*RequestBody) WithDescription

func (r *RequestBody) WithDescription(val string) *RequestBody

WithDescription sets Description value.

func (*RequestBody) WithMapOfAnything

func (r *RequestBody) WithMapOfAnything(val map[string]interface{}) *RequestBody

WithMapOfAnything sets MapOfAnything value.

func (*RequestBody) WithMapOfAnythingItem

func (r *RequestBody) WithMapOfAnythingItem(key string, val interface{}) *RequestBody

WithMapOfAnythingItem sets MapOfAnything item value.

func (*RequestBody) WithRequired

func (r *RequestBody) WithRequired(val bool) *RequestBody

WithRequired sets Required value.

type RequestBodyEnforcer deprecated

type RequestBodyEnforcer interface {
	ForceRequestBody()
}

RequestBodyEnforcer enables request body for GET and HEAD methods.

Should be implemented on input structure, function body can be empty. Forcing request body is not recommended and should only be used for backwards compatibility.

Deprecated: use openapi.RequestBodyEnforcer.

type RequestBodyOrRef

type RequestBodyOrRef struct {
	RequestBodyReference *RequestBodyReference `json:"-"`
	RequestBody          *RequestBody          `json:"-"`
}

RequestBodyOrRef structure is generated from "#/definitions/RequestBodyOrRef".

func (RequestBodyOrRef) MarshalJSON

func (r RequestBodyOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*RequestBodyOrRef) RequestBodyEns

func (r *RequestBodyOrRef) RequestBodyEns() *RequestBody

RequestBodyEns ensures returned RequestBody is not nil.

func (*RequestBodyOrRef) RequestBodyReferenceEns

func (r *RequestBodyOrRef) RequestBodyReferenceEns() *RequestBodyReference

RequestBodyReferenceEns ensures returned RequestBodyReference is not nil.

func (*RequestBodyOrRef) UnmarshalJSON

func (r *RequestBodyOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*RequestBodyOrRef) WithRequestBody

func (r *RequestBodyOrRef) WithRequestBody(val RequestBody) *RequestBodyOrRef

WithRequestBody sets RequestBody value.

func (*RequestBodyOrRef) WithRequestBodyReference

func (r *RequestBodyOrRef) WithRequestBodyReference(val RequestBodyReference) *RequestBodyOrRef

WithRequestBodyReference sets RequestBodyReference value.

type RequestBodyReference

type RequestBodyReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

RequestBodyReference structure is generated from "#/definitions/RequestBodyReference".

func (*RequestBodyReference) UnmarshalJSON

func (r *RequestBodyReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*RequestBodyReference) WithRef

WithRef sets Ref value.

type RequestJSONBodyEnforcer deprecated

type RequestJSONBodyEnforcer interface {
	ForceJSONRequestBody()
}

RequestJSONBodyEnforcer enables JSON request body for structures with `formData` tags.

Should be implemented on input structure, function body can be empty.

Deprecated: use openapi.RequestJSONBodyEnforcer.

type Response

type Response struct {
	Description   string                 `json:"description"` // Required.
	Headers       map[string]HeaderOrRef `json:"headers,omitempty"`
	Content       map[string]MediaType   `json:"content,omitempty"`
	Links         map[string]LinkOrRef   `json:"links,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Response structure is generated from "#/definitions/Response".

func (Response) MarshalJSON

func (r Response) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Response) UnmarshalJSON

func (r *Response) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Response) WithContent

func (r *Response) WithContent(val map[string]MediaType) *Response

WithContent sets Content value.

func (*Response) WithContentItem

func (r *Response) WithContentItem(key string, val MediaType) *Response

WithContentItem sets Content item value.

func (*Response) WithDescription

func (r *Response) WithDescription(val string) *Response

WithDescription sets Description value.

func (*Response) WithHeaders

func (r *Response) WithHeaders(val map[string]HeaderOrRef) *Response

WithHeaders sets Headers value.

func (*Response) WithHeadersItem

func (r *Response) WithHeadersItem(key string, val HeaderOrRef) *Response

WithHeadersItem sets Headers item value.

func (r *Response) WithLinks(val map[string]LinkOrRef) *Response

WithLinks sets Links value.

func (*Response) WithLinksItem

func (r *Response) WithLinksItem(key string, val LinkOrRef) *Response

WithLinksItem sets Links item value.

func (*Response) WithMapOfAnything

func (r *Response) WithMapOfAnything(val map[string]interface{}) *Response

WithMapOfAnything sets MapOfAnything value.

func (*Response) WithMapOfAnythingItem

func (r *Response) WithMapOfAnythingItem(key string, val interface{}) *Response

WithMapOfAnythingItem sets MapOfAnything item value.

type ResponseOrRef

type ResponseOrRef struct {
	ResponseReference *ResponseReference `json:"-"`
	Response          *Response          `json:"-"`
}

ResponseOrRef structure is generated from "#/definitions/ResponseOrRef".

func (ResponseOrRef) MarshalJSON

func (r ResponseOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ResponseOrRef) ResponseEns

func (r *ResponseOrRef) ResponseEns() *Response

ResponseEns ensures returned Response is not nil.

func (*ResponseOrRef) ResponseReferenceEns

func (r *ResponseOrRef) ResponseReferenceEns() *ResponseReference

ResponseReferenceEns ensures returned ResponseReference is not nil.

func (*ResponseOrRef) UnmarshalJSON

func (r *ResponseOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ResponseOrRef) WithResponse

func (r *ResponseOrRef) WithResponse(val Response) *ResponseOrRef

WithResponse sets Response value.

func (*ResponseOrRef) WithResponseReference

func (r *ResponseOrRef) WithResponseReference(val ResponseReference) *ResponseOrRef

WithResponseReference sets ResponseReference value.

type ResponseReference

type ResponseReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

ResponseReference structure is generated from "#/definitions/ResponseReference".

func (*ResponseReference) UnmarshalJSON

func (r *ResponseReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ResponseReference) WithRef

func (r *ResponseReference) WithRef(val string) *ResponseReference

WithRef sets Ref value.

type Responses

type Responses struct {
	Default                  *ResponseOrRef           `json:"default,omitempty"`
	MapOfResponseOrRefValues map[string]ResponseOrRef `json:"-"` // Key must match pattern: `^[1-5](?:\d{2}|XX)$`.
	MapOfAnything            map[string]interface{}   `json:"-"` // Key must match pattern: `^x-`.
}

Responses structure is generated from "#/definitions/Responses".

func (*Responses) DefaultEns

func (r *Responses) DefaultEns() *ResponseOrRef

DefaultEns ensures returned Default is not nil.

func (Responses) MarshalJSON

func (r Responses) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Responses) UnmarshalJSON

func (r *Responses) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Responses) WithDefault

func (r *Responses) WithDefault(val ResponseOrRef) *Responses

WithDefault sets Default value.

func (*Responses) WithMapOfAnything

func (r *Responses) WithMapOfAnything(val map[string]interface{}) *Responses

WithMapOfAnything sets MapOfAnything value.

func (*Responses) WithMapOfAnythingItem

func (r *Responses) WithMapOfAnythingItem(key string, val interface{}) *Responses

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Responses) WithMapOfResponseOrRefValues

func (r *Responses) WithMapOfResponseOrRefValues(val map[string]ResponseOrRef) *Responses

WithMapOfResponseOrRefValues sets MapOfResponseOrRefValues value.

func (*Responses) WithMapOfResponseOrRefValuesItem

func (r *Responses) WithMapOfResponseOrRefValuesItem(key string, val ResponseOrRef) *Responses

WithMapOfResponseOrRefValuesItem sets MapOfResponseOrRefValues item value.

type Schema

type Schema struct {
	Title                *string                     `json:"title,omitempty"`
	MultipleOf           *float64                    `json:"multipleOf,omitempty"`
	Maximum              *float64                    `json:"maximum,omitempty"`
	ExclusiveMaximum     *bool                       `json:"exclusiveMaximum,omitempty"`
	Minimum              *float64                    `json:"minimum,omitempty"`
	ExclusiveMinimum     *bool                       `json:"exclusiveMinimum,omitempty"`
	MaxLength            *int64                      `json:"maxLength,omitempty"`
	MinLength            *int64                      `json:"minLength,omitempty"`
	Pattern              *string                     `json:"pattern,omitempty"` // Format: regex.
	MaxItems             *int64                      `json:"maxItems,omitempty"`
	MinItems             *int64                      `json:"minItems,omitempty"`
	UniqueItems          *bool                       `json:"uniqueItems,omitempty"`
	MaxProperties        *int64                      `json:"maxProperties,omitempty"`
	MinProperties        *int64                      `json:"minProperties,omitempty"`
	Required             []string                    `json:"required,omitempty"`
	Enum                 []interface{}               `json:"enum,omitempty"`
	Type                 *SchemaType                 `json:"type,omitempty"`
	Not                  *SchemaOrRef                `json:"not,omitempty"`
	AllOf                []SchemaOrRef               `json:"allOf,omitempty"`
	OneOf                []SchemaOrRef               `json:"oneOf,omitempty"`
	AnyOf                []SchemaOrRef               `json:"anyOf,omitempty"`
	Items                *SchemaOrRef                `json:"items,omitempty"`
	Properties           map[string]SchemaOrRef      `json:"properties,omitempty"`
	AdditionalProperties *SchemaAdditionalProperties `json:"additionalProperties,omitempty"`
	Description          *string                     `json:"description,omitempty"`
	Format               *string                     `json:"format,omitempty"`
	Default              *interface{}                `json:"default,omitempty"`
	Nullable             *bool                       `json:"nullable,omitempty"`
	Discriminator        *Discriminator              `json:"discriminator,omitempty"`
	ReadOnly             *bool                       `json:"readOnly,omitempty"`
	WriteOnly            *bool                       `json:"writeOnly,omitempty"`
	Example              *interface{}                `json:"example,omitempty"`
	ExternalDocs         *ExternalDocumentation      `json:"externalDocs,omitempty"`
	Deprecated           *bool                       `json:"deprecated,omitempty"`
	XML                  *XML                        `json:"xml,omitempty"`
	MapOfAnything        map[string]interface{}      `json:"-"` // Key must match pattern: `^x-`.
	ReflectType          reflect.Type                `json:"-"`
}

Schema structure is generated from "#/definitions/Schema".

func (*Schema) AdditionalPropertiesEns

func (s *Schema) AdditionalPropertiesEns() *SchemaAdditionalProperties

AdditionalPropertiesEns ensures returned AdditionalProperties is not nil.

func (*Schema) DiscriminatorEns

func (s *Schema) DiscriminatorEns() *Discriminator

DiscriminatorEns ensures returned Discriminator is not nil.

func (*Schema) ExternalDocsEns

func (s *Schema) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (*Schema) ItemsEns

func (s *Schema) ItemsEns() *SchemaOrRef

ItemsEns ensures returned Items is not nil.

func (Schema) MarshalJSON

func (s Schema) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Schema) NotEns

func (s *Schema) NotEns() *SchemaOrRef

NotEns ensures returned Not is not nil.

func (*Schema) UnmarshalJSON

func (s *Schema) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Schema) WithAdditionalProperties

func (s *Schema) WithAdditionalProperties(val SchemaAdditionalProperties) *Schema

WithAdditionalProperties sets AdditionalProperties value.

func (*Schema) WithAllOf

func (s *Schema) WithAllOf(val ...SchemaOrRef) *Schema

WithAllOf sets AllOf value.

func (*Schema) WithAnyOf

func (s *Schema) WithAnyOf(val ...SchemaOrRef) *Schema

WithAnyOf sets AnyOf value.

func (*Schema) WithDefault

func (s *Schema) WithDefault(val interface{}) *Schema

WithDefault sets Default value.

func (*Schema) WithDeprecated

func (s *Schema) WithDeprecated(val bool) *Schema

WithDeprecated sets Deprecated value.

func (*Schema) WithDescription

func (s *Schema) WithDescription(val string) *Schema

WithDescription sets Description value.

func (*Schema) WithDiscriminator

func (s *Schema) WithDiscriminator(val Discriminator) *Schema

WithDiscriminator sets Discriminator value.

func (*Schema) WithEnum

func (s *Schema) WithEnum(val ...interface{}) *Schema

WithEnum sets Enum value.

func (*Schema) WithExample

func (s *Schema) WithExample(val interface{}) *Schema

WithExample sets Example value.

func (*Schema) WithExclusiveMaximum

func (s *Schema) WithExclusiveMaximum(val bool) *Schema

WithExclusiveMaximum sets ExclusiveMaximum value.

func (*Schema) WithExclusiveMinimum

func (s *Schema) WithExclusiveMinimum(val bool) *Schema

WithExclusiveMinimum sets ExclusiveMinimum value.

func (*Schema) WithExternalDocs

func (s *Schema) WithExternalDocs(val ExternalDocumentation) *Schema

WithExternalDocs sets ExternalDocs value.

func (*Schema) WithFormat

func (s *Schema) WithFormat(val string) *Schema

WithFormat sets Format value.

func (*Schema) WithItems

func (s *Schema) WithItems(val SchemaOrRef) *Schema

WithItems sets Items value.

func (*Schema) WithMapOfAnything

func (s *Schema) WithMapOfAnything(val map[string]interface{}) *Schema

WithMapOfAnything sets MapOfAnything value.

func (*Schema) WithMapOfAnythingItem

func (s *Schema) WithMapOfAnythingItem(key string, val interface{}) *Schema

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Schema) WithMaxItems

func (s *Schema) WithMaxItems(val int64) *Schema

WithMaxItems sets MaxItems value.

func (*Schema) WithMaxLength

func (s *Schema) WithMaxLength(val int64) *Schema

WithMaxLength sets MaxLength value.

func (*Schema) WithMaxProperties

func (s *Schema) WithMaxProperties(val int64) *Schema

WithMaxProperties sets MaxProperties value.

func (*Schema) WithMaximum

func (s *Schema) WithMaximum(val float64) *Schema

WithMaximum sets Maximum value.

func (*Schema) WithMinItems

func (s *Schema) WithMinItems(val int64) *Schema

WithMinItems sets MinItems value.

func (*Schema) WithMinLength

func (s *Schema) WithMinLength(val int64) *Schema

WithMinLength sets MinLength value.

func (*Schema) WithMinProperties

func (s *Schema) WithMinProperties(val int64) *Schema

WithMinProperties sets MinProperties value.

func (*Schema) WithMinimum

func (s *Schema) WithMinimum(val float64) *Schema

WithMinimum sets Minimum value.

func (*Schema) WithMultipleOf

func (s *Schema) WithMultipleOf(val float64) *Schema

WithMultipleOf sets MultipleOf value.

func (*Schema) WithNot

func (s *Schema) WithNot(val SchemaOrRef) *Schema

WithNot sets Not value.

func (*Schema) WithNullable

func (s *Schema) WithNullable(val bool) *Schema

WithNullable sets Nullable value.

func (*Schema) WithOneOf

func (s *Schema) WithOneOf(val ...SchemaOrRef) *Schema

WithOneOf sets OneOf value.

func (*Schema) WithPattern

func (s *Schema) WithPattern(val string) *Schema

WithPattern sets Pattern value.

func (*Schema) WithProperties

func (s *Schema) WithProperties(val map[string]SchemaOrRef) *Schema

WithProperties sets Properties value.

func (*Schema) WithPropertiesItem

func (s *Schema) WithPropertiesItem(key string, val SchemaOrRef) *Schema

WithPropertiesItem sets Properties item value.

func (*Schema) WithReadOnly

func (s *Schema) WithReadOnly(val bool) *Schema

WithReadOnly sets ReadOnly value.

func (*Schema) WithRequired

func (s *Schema) WithRequired(val ...string) *Schema

WithRequired sets Required value.

func (*Schema) WithTitle

func (s *Schema) WithTitle(val string) *Schema

WithTitle sets Title value.

func (*Schema) WithType

func (s *Schema) WithType(val SchemaType) *Schema

WithType sets Type value.

func (*Schema) WithUniqueItems

func (s *Schema) WithUniqueItems(val bool) *Schema

WithUniqueItems sets UniqueItems value.

func (*Schema) WithWriteOnly

func (s *Schema) WithWriteOnly(val bool) *Schema

WithWriteOnly sets WriteOnly value.

func (*Schema) WithXML

func (s *Schema) WithXML(val XML) *Schema

WithXML sets XML value.

func (*Schema) XMLEns

func (s *Schema) XMLEns() *XML

XMLEns ensures returned XML is not nil.

type SchemaAdditionalProperties

type SchemaAdditionalProperties struct {
	SchemaOrRef *SchemaOrRef `json:"-"`
	Bool        *bool        `json:"-"`
}

SchemaAdditionalProperties structure is generated from "#/definitions/Schema->additionalProperties".

func (SchemaAdditionalProperties) MarshalJSON

func (s SchemaAdditionalProperties) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SchemaAdditionalProperties) SchemaOrRefEns

func (s *SchemaAdditionalProperties) SchemaOrRefEns() *SchemaOrRef

SchemaOrRefEns ensures returned SchemaOrRef is not nil.

func (*SchemaAdditionalProperties) UnmarshalJSON

func (s *SchemaAdditionalProperties) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SchemaAdditionalProperties) WithBool

WithBool sets Bool value.

func (*SchemaAdditionalProperties) WithSchemaOrRef

WithSchemaOrRef sets SchemaOrRef value.

type SchemaOrRef

type SchemaOrRef struct {
	Schema          *Schema          `json:"-"`
	SchemaReference *SchemaReference `json:"-"`
}

SchemaOrRef structure is generated from "#/definitions/SchemaOrRef".

func (*SchemaOrRef) FromJSONSchema

func (s *SchemaOrRef) FromJSONSchema(schema jsonschema.SchemaOrBool)

FromJSONSchema loads OpenAPI Schema from JSON Schema.

func (SchemaOrRef) MarshalJSON

func (s SchemaOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SchemaOrRef) SchemaEns

func (s *SchemaOrRef) SchemaEns() *Schema

SchemaEns ensures returned Schema is not nil.

func (*SchemaOrRef) SchemaReferenceEns

func (s *SchemaOrRef) SchemaReferenceEns() *SchemaReference

SchemaReferenceEns ensures returned SchemaReference is not nil.

func (*SchemaOrRef) ToJSONSchema

func (s *SchemaOrRef) ToJSONSchema(spec *Spec) jsonschema.SchemaOrBool

ToJSONSchema converts OpenAPI Schema to JSON Schema.

Local references are resolved against `#/components/schemas` in spec.

func (*SchemaOrRef) UnmarshalJSON

func (s *SchemaOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SchemaOrRef) WithSchema

func (s *SchemaOrRef) WithSchema(val Schema) *SchemaOrRef

WithSchema sets Schema value.

func (*SchemaOrRef) WithSchemaReference

func (s *SchemaOrRef) WithSchemaReference(val SchemaReference) *SchemaOrRef

WithSchemaReference sets SchemaReference value.

type SchemaReference

type SchemaReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

SchemaReference structure is generated from "#/definitions/SchemaReference".

func (*SchemaReference) UnmarshalJSON

func (s *SchemaReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SchemaReference) WithRef

func (s *SchemaReference) WithRef(val string) *SchemaReference

WithRef sets Ref value.

type SchemaType

type SchemaType string

SchemaType is an enum type.

func (SchemaType) MarshalJSON

func (i SchemaType) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SchemaType) UnmarshalJSON

func (i *SchemaType) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

type SchemaXORContent

type SchemaXORContent struct {
	HasSchema  *HasSchema  `json:"-"`
	HasContent *HasContent `json:"-"`
}

SchemaXORContent structure is generated from "#/definitions/SchemaXORContent".

Schema and content are mutually exclusive, at least one is required.

func (*SchemaXORContent) HasContentEns

func (s *SchemaXORContent) HasContentEns() *HasContent

HasContentEns ensures returned HasContent is not nil.

func (*SchemaXORContent) HasSchemaEns

func (s *SchemaXORContent) HasSchemaEns() *HasSchema

HasSchemaEns ensures returned HasSchema is not nil.

func (SchemaXORContent) MarshalJSON

func (s SchemaXORContent) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SchemaXORContent) UnmarshalJSON

func (s *SchemaXORContent) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SchemaXORContent) WithHasContent

func (s *SchemaXORContent) WithHasContent(val HasContent) *SchemaXORContent

WithHasContent sets HasContent value.

func (*SchemaXORContent) WithHasSchema

func (s *SchemaXORContent) WithHasSchema(val HasSchema) *SchemaXORContent

WithHasSchema sets HasSchema value.

type SchemaXORContentNot

type SchemaXORContentNot struct {
	Schema  interface{} `json:"schema"`  // Required.
	Content interface{} `json:"content"` // Required.
}

SchemaXORContentNot structure is generated from "#/definitions/SchemaXORContent->not".

func (*SchemaXORContentNot) UnmarshalJSON

func (s *SchemaXORContentNot) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SchemaXORContentNot) WithContent

func (s *SchemaXORContentNot) WithContent(val interface{}) *SchemaXORContentNot

WithContent sets Content value.

func (*SchemaXORContentNot) WithSchema

func (s *SchemaXORContentNot) WithSchema(val interface{}) *SchemaXORContentNot

WithSchema sets Schema value.

type SecurityScheme

type SecurityScheme struct {
	APIKeySecurityScheme        *APIKeySecurityScheme        `json:"-"`
	HTTPSecurityScheme          *HTTPSecurityScheme          `json:"-"`
	OAuth2SecurityScheme        *OAuth2SecurityScheme        `json:"-"`
	OpenIDConnectSecurityScheme *OpenIDConnectSecurityScheme `json:"-"`
}

SecurityScheme structure is generated from "#/definitions/SecurityScheme".

func (*SecurityScheme) APIKeySecuritySchemeEns

func (s *SecurityScheme) APIKeySecuritySchemeEns() *APIKeySecurityScheme

APIKeySecuritySchemeEns ensures returned APIKeySecurityScheme is not nil.

func (*SecurityScheme) HTTPSecuritySchemeEns

func (s *SecurityScheme) HTTPSecuritySchemeEns() *HTTPSecurityScheme

HTTPSecuritySchemeEns ensures returned HTTPSecurityScheme is not nil.

func (SecurityScheme) MarshalJSON

func (s SecurityScheme) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecurityScheme) OAuth2SecuritySchemeEns

func (s *SecurityScheme) OAuth2SecuritySchemeEns() *OAuth2SecurityScheme

OAuth2SecuritySchemeEns ensures returned OAuth2SecurityScheme is not nil.

func (*SecurityScheme) OpenIDConnectSecuritySchemeEns

func (s *SecurityScheme) OpenIDConnectSecuritySchemeEns() *OpenIDConnectSecurityScheme

OpenIDConnectSecuritySchemeEns ensures returned OpenIDConnectSecurityScheme is not nil.

func (*SecurityScheme) UnmarshalJSON

func (s *SecurityScheme) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecurityScheme) WithAPIKeySecurityScheme

func (s *SecurityScheme) WithAPIKeySecurityScheme(val APIKeySecurityScheme) *SecurityScheme

WithAPIKeySecurityScheme sets APIKeySecurityScheme value.

func (*SecurityScheme) WithHTTPSecurityScheme

func (s *SecurityScheme) WithHTTPSecurityScheme(val HTTPSecurityScheme) *SecurityScheme

WithHTTPSecurityScheme sets HTTPSecurityScheme value.

func (*SecurityScheme) WithOAuth2SecurityScheme

func (s *SecurityScheme) WithOAuth2SecurityScheme(val OAuth2SecurityScheme) *SecurityScheme

WithOAuth2SecurityScheme sets OAuth2SecurityScheme value.

func (*SecurityScheme) WithOpenIDConnectSecurityScheme

func (s *SecurityScheme) WithOpenIDConnectSecurityScheme(val OpenIDConnectSecurityScheme) *SecurityScheme

WithOpenIDConnectSecurityScheme sets OpenIDConnectSecurityScheme value.

type SecuritySchemeOrRef

type SecuritySchemeOrRef struct {
	SecuritySchemeReference *SecuritySchemeReference `json:"-"`
	SecurityScheme          *SecurityScheme          `json:"-"`
}

SecuritySchemeOrRef structure is generated from "#/definitions/SecuritySchemeOrRef".

func (SecuritySchemeOrRef) MarshalJSON

func (s SecuritySchemeOrRef) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*SecuritySchemeOrRef) SecuritySchemeEns

func (s *SecuritySchemeOrRef) SecuritySchemeEns() *SecurityScheme

SecuritySchemeEns ensures returned SecurityScheme is not nil.

func (*SecuritySchemeOrRef) SecuritySchemeReferenceEns

func (s *SecuritySchemeOrRef) SecuritySchemeReferenceEns() *SecuritySchemeReference

SecuritySchemeReferenceEns ensures returned SecuritySchemeReference is not nil.

func (*SecuritySchemeOrRef) UnmarshalJSON

func (s *SecuritySchemeOrRef) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeOrRef) WithSecurityScheme

func (s *SecuritySchemeOrRef) WithSecurityScheme(val SecurityScheme) *SecuritySchemeOrRef

WithSecurityScheme sets SecurityScheme value.

func (*SecuritySchemeOrRef) WithSecuritySchemeReference

func (s *SecuritySchemeOrRef) WithSecuritySchemeReference(val SecuritySchemeReference) *SecuritySchemeOrRef

WithSecuritySchemeReference sets SecuritySchemeReference value.

type SecuritySchemeReference

type SecuritySchemeReference struct {
	// Format: uri-reference.
	// Required.
	Ref string `json:"$ref"`
}

SecuritySchemeReference structure is generated from "#/definitions/SecuritySchemeReference".

func (*SecuritySchemeReference) UnmarshalJSON

func (s *SecuritySchemeReference) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*SecuritySchemeReference) WithRef

WithRef sets Ref value.

type Server

type Server struct {
	URL           string                    `json:"url"` // Required.
	Description   *string                   `json:"description,omitempty"`
	Variables     map[string]ServerVariable `json:"variables,omitempty"`
	MapOfAnything map[string]interface{}    `json:"-"` // Key must match pattern: `^x-`.
}

Server structure is generated from "#/definitions/Server".

func (Server) MarshalJSON

func (s Server) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Server) UnmarshalJSON

func (s *Server) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Server) WithDescription

func (s *Server) WithDescription(val string) *Server

WithDescription sets Description value.

func (*Server) WithMapOfAnything

func (s *Server) WithMapOfAnything(val map[string]interface{}) *Server

WithMapOfAnything sets MapOfAnything value.

func (*Server) WithMapOfAnythingItem

func (s *Server) WithMapOfAnythingItem(key string, val interface{}) *Server

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Server) WithURL

func (s *Server) WithURL(val string) *Server

WithURL sets URL value.

func (*Server) WithVariables

func (s *Server) WithVariables(val map[string]ServerVariable) *Server

WithVariables sets Variables value.

func (*Server) WithVariablesItem

func (s *Server) WithVariablesItem(key string, val ServerVariable) *Server

WithVariablesItem sets Variables item value.

type ServerVariable

type ServerVariable struct {
	Enum          []string               `json:"enum,omitempty"`
	Default       string                 `json:"default"` // Required.
	Description   *string                `json:"description,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

ServerVariable structure is generated from "#/definitions/ServerVariable".

func (ServerVariable) MarshalJSON

func (s ServerVariable) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*ServerVariable) UnmarshalJSON

func (s *ServerVariable) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*ServerVariable) WithDefault

func (s *ServerVariable) WithDefault(val string) *ServerVariable

WithDefault sets Default value.

func (*ServerVariable) WithDescription

func (s *ServerVariable) WithDescription(val string) *ServerVariable

WithDescription sets Description value.

func (*ServerVariable) WithEnum

func (s *ServerVariable) WithEnum(val ...string) *ServerVariable

WithEnum sets Enum value.

func (*ServerVariable) WithMapOfAnything

func (s *ServerVariable) WithMapOfAnything(val map[string]interface{}) *ServerVariable

WithMapOfAnything sets MapOfAnything value.

func (*ServerVariable) WithMapOfAnythingItem

func (s *ServerVariable) WithMapOfAnythingItem(key string, val interface{}) *ServerVariable

WithMapOfAnythingItem sets MapOfAnything item value.

type Spec

type Spec struct {
	// Value must match pattern: `^3\.0\.\d(-.+)?$`.
	// Required.
	Openapi       string                 `json:"openapi"`
	Info          Info                   `json:"info"` // Required.
	ExternalDocs  *ExternalDocumentation `json:"externalDocs,omitempty"`
	Servers       []Server               `json:"servers,omitempty"`
	Security      []map[string][]string  `json:"security,omitempty"`
	Tags          []Tag                  `json:"tags,omitempty"`
	Paths         Paths                  `json:"paths"` // Required.
	Components    *Components            `json:"components,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Spec structure is generated from "#".

Validation schema for OpenAPI Specification 3.0.X.

func (*Spec) AddOperation

func (s *Spec) AddOperation(method, path string, operation Operation) error

AddOperation validates and sets operation by path and method.

It will fail if operation with method and path already exists.

func (*Spec) ComponentsEns

func (s *Spec) ComponentsEns() *Components

ComponentsEns ensures returned Components is not nil.

func (*Spec) Description

func (s *Spec) Description() string

Description returns service description.

func (*Spec) ExternalDocsEns

func (s *Spec) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Spec) MarshalJSON

func (s Spec) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Spec) MarshalYAML

func (s *Spec) MarshalYAML() ([]byte, error)

MarshalYAML produces YAML bytes.

func (*Spec) SetAPIKeySecurity

func (s *Spec) SetAPIKeySecurity(securityName string, fieldName string, fieldIn openapi.In, description string)

SetAPIKeySecurity sets security definition.

Example
reflector := openapi3.Reflector{}
securityName := "api_key"

// Declare security scheme.
reflector.SpecEns().SetAPIKeySecurity(securityName, "Authorization", openapi.InHeader, "API Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.0.3
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - api_key: []
components:
  securitySchemes:
    api_key:
      description: API Access
      in: header
      name: Authorization
      type: apiKey

func (*Spec) SetDescription

func (s *Spec) SetDescription(d string)

SetDescription describes the service.

func (*Spec) SetHTTPBasicSecurity

func (s *Spec) SetHTTPBasicSecurity(securityName string, description string)

SetHTTPBasicSecurity sets security definition.

Example
reflector := openapi3.Reflector{}
securityName := "admin"

// Declare security scheme.
reflector.SpecEns().SetHTTPBasicSecurity(securityName, "Admin Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.0.3
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - admin: []
components:
  securitySchemes:
    admin:
      description: Admin Access
      scheme: basic
      type: http

func (*Spec) SetHTTPBearerTokenSecurity

func (s *Spec) SetHTTPBearerTokenSecurity(securityName string, format string, description string)

SetHTTPBearerTokenSecurity sets security definition.

Example
reflector := openapi3.Reflector{}
securityName := "bearer_token"

// Declare security scheme.
reflector.SpecEns().SetHTTPBearerTokenSecurity(securityName, "JWT", "Admin Access")

oc, _ := reflector.NewOperationContext(http.MethodGet, "/secure")
oc.AddRespStructure(struct {
	Secret string `json:"secret"`
}{})

// Add security requirement to operation.
oc.AddSecurity(securityName)

// Describe unauthorized response.
oc.AddRespStructure(struct {
	Error string `json:"error"`
}{}, func(cu *openapi.ContentUnit) {
	cu.HTTPStatus = http.StatusUnauthorized
})

// Add operation to schema.
_ = reflector.AddOperation(oc)

schema, err := reflector.Spec.MarshalYAML()
if err != nil {
	log.Fatal(err)
}

fmt.Println(string(schema))
Output:

openapi: 3.0.3
info:
  title: ""
  version: ""
paths:
  /secure:
    get:
      responses:
        "200":
          content:
            application/json:
              schema:
                properties:
                  secret:
                    type: string
                type: object
          description: OK
        "401":
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: Unauthorized
      security:
      - bearer_token: []
components:
  securitySchemes:
    bearer_token:
      bearerFormat: JWT
      description: Admin Access
      scheme: bearer
      type: http

func (*Spec) SetTitle

func (s *Spec) SetTitle(t string)

SetTitle describes the service.

func (*Spec) SetVersion

func (s *Spec) SetVersion(v string)

SetVersion describes the service.

func (*Spec) SetupOperation

func (s *Spec) SetupOperation(method, path string, setup ...func(*Operation) error) error

SetupOperation creates operation if it is not present and applies setup functions.

func (*Spec) Title

func (s *Spec) Title() string

Title returns service title.

func (*Spec) UnmarshalJSON

func (s *Spec) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

Example
package main

import (
	"fmt"
	"log"

	"github.com/STARRISEPH/openapi-go/openapi3"
)

func main() {
	yml := []byte(`{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Swagger Petstore",
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "http://petstore.swagger.io/v1"
    }
  ],
  "paths": {
    "/pets": {
      "get": {
        "summary": "List all pets",
        "operationId": "listPets",
        "tags": [
          "pets"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "How many items to return at one time (max 100)",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A paged array of pets",
            "headers": {
              "x-next": {
                "description": "A link to the next page of responses",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pets"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a pet",
        "operationId": "createPets",
        "tags": [
          "pets"
        ],
        "responses": {
          "201": {
            "description": "Null response"
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/pets/{petId}": {
      "get": {
        "summary": "Info for a specific pet",
        "operationId": "showPetById",
        "tags": [
          "pets"
        ],
        "parameters": [
          {
            "name": "petId",
            "in": "path",
            "required": true,
            "description": "The id of the pet to retrieve",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Expected response to a valid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Pet": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          },
          "tag": {
            "type": "string"
          }
        }
      },
      "Pets": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Pet"
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "x-foo": "bar",
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}`)

	var s openapi3.Spec

	if err := s.UnmarshalYAML(yml); err != nil {
		log.Fatal(err)
	}

	fmt.Println(s.Info.Title)
	fmt.Println(s.Components.Schemas.MapOfSchemaOrRefValues["Error"].Schema.Properties["code"].Schema.MapOfAnything["x-foo"])

}
Output:

Swagger Petstore
bar

func (*Spec) UnmarshalYAML

func (s *Spec) UnmarshalYAML(data []byte) error

UnmarshalYAML reads from YAML bytes.

Example
package main

import (
	"fmt"
	"log"

	"github.com/STARRISEPH/openapi-go/openapi3"
)

func main() {
	yml := []byte(`
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return at one time (max 100)
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: A paged array of pets
          headers:
            x-next:
              description: A link to the next page of responses
              schema:
                type: string
          content:
            application/json:    
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      summary: Create a pet
      operationId: createPets
      tags:
        - pets
      responses:
        '201':
          description: Null response
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /pets/{petId}:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          x-foo: bar
          type: integer
          format: int32
        message:
          type: string
`)

	var s openapi3.Spec

	if err := s.UnmarshalYAML(yml); err != nil {
		log.Fatal(err)
	}

	fmt.Println(s.Info.Title)
	fmt.Println(s.Components.Schemas.MapOfSchemaOrRefValues["Error"].Schema.Properties["code"].Schema.MapOfAnything["x-foo"])

}
Output:

Swagger Petstore
bar

func (*Spec) Version

func (s *Spec) Version() string

Version returns service version.

func (*Spec) WithComponents

func (s *Spec) WithComponents(val Components) *Spec

WithComponents sets Components value.

func (*Spec) WithExternalDocs

func (s *Spec) WithExternalDocs(val ExternalDocumentation) *Spec

WithExternalDocs sets ExternalDocs value.

func (*Spec) WithInfo

func (s *Spec) WithInfo(val Info) *Spec

WithInfo sets Info value.

func (*Spec) WithMapOfAnything

func (s *Spec) WithMapOfAnything(val map[string]interface{}) *Spec

WithMapOfAnything sets MapOfAnything value.

func (*Spec) WithMapOfAnythingItem

func (s *Spec) WithMapOfAnythingItem(key string, val interface{}) *Spec

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Spec) WithOpenapi

func (s *Spec) WithOpenapi(val string) *Spec

WithOpenapi sets Openapi value.

func (*Spec) WithPaths

func (s *Spec) WithPaths(val Paths) *Spec

WithPaths sets Paths value.

func (*Spec) WithSecurity

func (s *Spec) WithSecurity(val ...map[string][]string) *Spec

WithSecurity sets Security value.

func (*Spec) WithServers

func (s *Spec) WithServers(val ...Server) *Spec

WithServers sets Servers value.

func (*Spec) WithTags

func (s *Spec) WithTags(val ...Tag) *Spec

WithTags sets Tags value.

type Tag

type Tag struct {
	Name          string                 `json:"name"` // Required.
	Description   *string                `json:"description,omitempty"`
	ExternalDocs  *ExternalDocumentation `json:"externalDocs,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

Tag structure is generated from "#/definitions/Tag".

func (*Tag) ExternalDocsEns

func (t *Tag) ExternalDocsEns() *ExternalDocumentation

ExternalDocsEns ensures returned ExternalDocs is not nil.

func (Tag) MarshalJSON

func (t Tag) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*Tag) UnmarshalJSON

func (t *Tag) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*Tag) WithDescription

func (t *Tag) WithDescription(val string) *Tag

WithDescription sets Description value.

func (*Tag) WithExternalDocs

func (t *Tag) WithExternalDocs(val ExternalDocumentation) *Tag

WithExternalDocs sets ExternalDocs value.

func (*Tag) WithMapOfAnything

func (t *Tag) WithMapOfAnything(val map[string]interface{}) *Tag

WithMapOfAnything sets MapOfAnything value.

func (*Tag) WithMapOfAnythingItem

func (t *Tag) WithMapOfAnythingItem(key string, val interface{}) *Tag

WithMapOfAnythingItem sets MapOfAnything item value.

func (*Tag) WithName

func (t *Tag) WithName(val string) *Tag

WithName sets Name value.

type XML

type XML struct {
	Name          *string                `json:"name,omitempty"`
	Namespace     *string                `json:"namespace,omitempty"` // Format: uri.
	Prefix        *string                `json:"prefix,omitempty"`
	Attribute     *bool                  `json:"attribute,omitempty"`
	Wrapped       *bool                  `json:"wrapped,omitempty"`
	MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}

XML structure is generated from "#/definitions/XML".

func (XML) MarshalJSON

func (x XML) MarshalJSON() ([]byte, error)

MarshalJSON encodes JSON.

func (*XML) UnmarshalJSON

func (x *XML) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes JSON.

func (*XML) WithAttribute

func (x *XML) WithAttribute(val bool) *XML

WithAttribute sets Attribute value.

func (*XML) WithMapOfAnything

func (x *XML) WithMapOfAnything(val map[string]interface{}) *XML

WithMapOfAnything sets MapOfAnything value.

func (*XML) WithMapOfAnythingItem

func (x *XML) WithMapOfAnythingItem(key string, val interface{}) *XML

WithMapOfAnythingItem sets MapOfAnything item value.

func (*XML) WithName

func (x *XML) WithName(val string) *XML

WithName sets Name value.

func (*XML) WithNamespace

func (x *XML) WithNamespace(val string) *XML

WithNamespace sets Namespace value.

func (*XML) WithPrefix

func (x *XML) WithPrefix(val string) *XML

WithPrefix sets Prefix value.

func (*XML) WithWrapped

func (x *XML) WithWrapped(val bool) *XML

WithWrapped sets Wrapped value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL