Documentation ¶
Overview ¶
Package openapi3 provides entities and helpers to manage OpenAPI 3.0.x schema.
Package openapi3 contains JSON mapping structures.
Index ¶
- Constants
- type APIKeySecurityScheme
- func (a APIKeySecurityScheme) MarshalJSON() ([]byte, error)
- func (a *APIKeySecurityScheme) UnmarshalJSON(data []byte) error
- func (a *APIKeySecurityScheme) WithDescription(val string) *APIKeySecurityScheme
- func (a *APIKeySecurityScheme) WithIn(val APIKeySecuritySchemeIn) *APIKeySecurityScheme
- func (a *APIKeySecurityScheme) WithMapOfAnything(val map[string]interface{}) *APIKeySecurityScheme
- func (a *APIKeySecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *APIKeySecurityScheme
- func (a *APIKeySecurityScheme) WithName(val string) *APIKeySecurityScheme
- type APIKeySecuritySchemeIn
- type AuthorizationCodeOAuthFlow
- func (a AuthorizationCodeOAuthFlow) MarshalJSON() ([]byte, error)
- func (a *AuthorizationCodeOAuthFlow) UnmarshalJSON(data []byte) error
- func (a *AuthorizationCodeOAuthFlow) WithAuthorizationURL(val string) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithMapOfAnything(val map[string]interface{}) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithRefreshURL(val string) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithScopes(val map[string]string) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithScopesItem(key string, val string) *AuthorizationCodeOAuthFlow
- func (a *AuthorizationCodeOAuthFlow) WithTokenURL(val string) *AuthorizationCodeOAuthFlow
- type Bearer
- type Callback
- func (c Callback) MarshalJSON() ([]byte, error)
- func (c *Callback) UnmarshalJSON(data []byte) error
- func (c *Callback) WithAdditionalProperties(val map[string]PathItem) *Callback
- func (c *Callback) WithAdditionalPropertiesItem(key string, val PathItem) *Callback
- func (c *Callback) WithMapOfAnything(val map[string]interface{}) *Callback
- func (c *Callback) WithMapOfAnythingItem(key string, val interface{}) *Callback
- type CallbackOrRef
- func (c *CallbackOrRef) CallbackEns() *Callback
- func (c *CallbackOrRef) CallbackReferenceEns() *CallbackReference
- func (c CallbackOrRef) MarshalJSON() ([]byte, error)
- func (c *CallbackOrRef) UnmarshalJSON(data []byte) error
- func (c *CallbackOrRef) WithCallback(val Callback) *CallbackOrRef
- func (c *CallbackOrRef) WithCallbackReference(val CallbackReference) *CallbackOrRef
- type CallbackReference
- type ClientCredentialsFlow
- func (c ClientCredentialsFlow) MarshalJSON() ([]byte, error)
- func (c *ClientCredentialsFlow) UnmarshalJSON(data []byte) error
- func (c *ClientCredentialsFlow) WithMapOfAnything(val map[string]interface{}) *ClientCredentialsFlow
- func (c *ClientCredentialsFlow) WithMapOfAnythingItem(key string, val interface{}) *ClientCredentialsFlow
- func (c *ClientCredentialsFlow) WithRefreshURL(val string) *ClientCredentialsFlow
- func (c *ClientCredentialsFlow) WithScopes(val map[string]string) *ClientCredentialsFlow
- func (c *ClientCredentialsFlow) WithScopesItem(key string, val string) *ClientCredentialsFlow
- func (c *ClientCredentialsFlow) WithTokenURL(val string) *ClientCredentialsFlow
- type Components
- func (c *Components) CallbacksEns() *ComponentsCallbacks
- func (c *Components) ExamplesEns() *ComponentsExamples
- func (c *Components) HeadersEns() *ComponentsHeaders
- func (c *Components) LinksEns() *ComponentsLinks
- func (c Components) MarshalJSON() ([]byte, error)
- func (c *Components) ParametersEns() *ComponentsParameters
- func (c *Components) RequestBodiesEns() *ComponentsRequestBodies
- func (c *Components) ResponsesEns() *ComponentsResponses
- func (c *Components) SchemasEns() *ComponentsSchemas
- func (c *Components) SecuritySchemesEns() *ComponentsSecuritySchemes
- func (c *Components) UnmarshalJSON(data []byte) error
- func (c *Components) WithCallbacks(val ComponentsCallbacks) *Components
- func (c *Components) WithExamples(val ComponentsExamples) *Components
- func (c *Components) WithHeaders(val ComponentsHeaders) *Components
- func (c *Components) WithLinks(val ComponentsLinks) *Components
- func (c *Components) WithMapOfAnything(val map[string]interface{}) *Components
- func (c *Components) WithMapOfAnythingItem(key string, val interface{}) *Components
- func (c *Components) WithParameters(val ComponentsParameters) *Components
- func (c *Components) WithRequestBodies(val ComponentsRequestBodies) *Components
- func (c *Components) WithResponses(val ComponentsResponses) *Components
- func (c *Components) WithSchemas(val ComponentsSchemas) *Components
- func (c *Components) WithSecuritySchemes(val ComponentsSecuritySchemes) *Components
- type ComponentsCallbacks
- func (c ComponentsCallbacks) MarshalJSON() ([]byte, error)
- func (c *ComponentsCallbacks) UnmarshalJSON(data []byte) error
- func (c *ComponentsCallbacks) WithMapOfCallbackOrRefValues(val map[string]CallbackOrRef) *ComponentsCallbacks
- func (c *ComponentsCallbacks) WithMapOfCallbackOrRefValuesItem(key string, val CallbackOrRef) *ComponentsCallbacks
- type ComponentsExamples
- func (c ComponentsExamples) MarshalJSON() ([]byte, error)
- func (c *ComponentsExamples) UnmarshalJSON(data []byte) error
- func (c *ComponentsExamples) WithMapOfExampleOrRefValues(val map[string]ExampleOrRef) *ComponentsExamples
- func (c *ComponentsExamples) WithMapOfExampleOrRefValuesItem(key string, val ExampleOrRef) *ComponentsExamples
- type ComponentsHeaders
- func (c ComponentsHeaders) MarshalJSON() ([]byte, error)
- func (c *ComponentsHeaders) UnmarshalJSON(data []byte) error
- func (c *ComponentsHeaders) WithMapOfHeaderOrRefValues(val map[string]HeaderOrRef) *ComponentsHeaders
- func (c *ComponentsHeaders) WithMapOfHeaderOrRefValuesItem(key string, val HeaderOrRef) *ComponentsHeaders
- type ComponentsLinks
- func (c ComponentsLinks) MarshalJSON() ([]byte, error)
- func (c *ComponentsLinks) UnmarshalJSON(data []byte) error
- func (c *ComponentsLinks) WithMapOfLinkOrRefValues(val map[string]LinkOrRef) *ComponentsLinks
- func (c *ComponentsLinks) WithMapOfLinkOrRefValuesItem(key string, val LinkOrRef) *ComponentsLinks
- type ComponentsParameters
- func (c ComponentsParameters) MarshalJSON() ([]byte, error)
- func (c *ComponentsParameters) UnmarshalJSON(data []byte) error
- func (c *ComponentsParameters) WithMapOfParameterOrRefValues(val map[string]ParameterOrRef) *ComponentsParameters
- func (c *ComponentsParameters) WithMapOfParameterOrRefValuesItem(key string, val ParameterOrRef) *ComponentsParameters
- type ComponentsRequestBodies
- func (c ComponentsRequestBodies) MarshalJSON() ([]byte, error)
- func (c *ComponentsRequestBodies) UnmarshalJSON(data []byte) error
- func (c *ComponentsRequestBodies) WithMapOfRequestBodyOrRefValues(val map[string]RequestBodyOrRef) *ComponentsRequestBodies
- func (c *ComponentsRequestBodies) WithMapOfRequestBodyOrRefValuesItem(key string, val RequestBodyOrRef) *ComponentsRequestBodies
- type ComponentsResponses
- func (c ComponentsResponses) MarshalJSON() ([]byte, error)
- func (c *ComponentsResponses) UnmarshalJSON(data []byte) error
- func (c *ComponentsResponses) WithMapOfResponseOrRefValues(val map[string]ResponseOrRef) *ComponentsResponses
- func (c *ComponentsResponses) WithMapOfResponseOrRefValuesItem(key string, val ResponseOrRef) *ComponentsResponses
- type ComponentsSchemas
- func (c ComponentsSchemas) MarshalJSON() ([]byte, error)
- func (c *ComponentsSchemas) UnmarshalJSON(data []byte) error
- func (c *ComponentsSchemas) WithMapOfSchemaOrRefValues(val map[string]SchemaOrRef) *ComponentsSchemas
- func (c *ComponentsSchemas) WithMapOfSchemaOrRefValuesItem(key string, val SchemaOrRef) *ComponentsSchemas
- type ComponentsSecuritySchemes
- func (c ComponentsSecuritySchemes) MarshalJSON() ([]byte, error)
- func (c *ComponentsSecuritySchemes) UnmarshalJSON(data []byte) error
- func (c *ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValues(val map[string]SecuritySchemeOrRef) *ComponentsSecuritySchemes
- func (c *ComponentsSecuritySchemes) WithMapOfSecuritySchemeOrRefValuesItem(key string, val SecuritySchemeOrRef) *ComponentsSecuritySchemes
- type Contact
- func (c Contact) MarshalJSON() ([]byte, error)
- func (c *Contact) UnmarshalJSON(data []byte) error
- func (c *Contact) WithEmail(val string) *Contact
- func (c *Contact) WithMapOfAnything(val map[string]interface{}) *Contact
- func (c *Contact) WithMapOfAnythingItem(key string, val interface{}) *Contact
- func (c *Contact) WithName(val string) *Contact
- func (c *Contact) WithURL(val string) *Contact
- type CookieParameter
- type Discriminator
- type Encoding
- func (e *Encoding) UnmarshalJSON(data []byte) error
- func (e *Encoding) WithAllowReserved(val bool) *Encoding
- func (e *Encoding) WithContentType(val string) *Encoding
- func (e *Encoding) WithExplode(val bool) *Encoding
- func (e *Encoding) WithHeaders(val map[string]Header) *Encoding
- func (e *Encoding) WithHeadersItem(key string, val Header) *Encoding
- func (e *Encoding) WithStyle(val EncodingStyle) *Encoding
- type EncodingStyle
- type Example
- func (e Example) MarshalJSON() ([]byte, error)
- func (e *Example) UnmarshalJSON(data []byte) error
- func (e *Example) WithDescription(val string) *Example
- func (e *Example) WithExternalValue(val string) *Example
- func (e *Example) WithMapOfAnything(val map[string]interface{}) *Example
- func (e *Example) WithMapOfAnythingItem(key string, val interface{}) *Example
- func (e *Example) WithSummary(val string) *Example
- func (e *Example) WithValue(val interface{}) *Example
- type ExampleOrRef
- func (e *ExampleOrRef) ExampleEns() *Example
- func (e *ExampleOrRef) ExampleReferenceEns() *ExampleReference
- func (e ExampleOrRef) MarshalJSON() ([]byte, error)
- func (e *ExampleOrRef) UnmarshalJSON(data []byte) error
- func (e *ExampleOrRef) WithExample(val Example) *ExampleOrRef
- func (e *ExampleOrRef) WithExampleReference(val ExampleReference) *ExampleOrRef
- type ExampleReference
- type ExternalDocumentation
- func (e ExternalDocumentation) MarshalJSON() ([]byte, error)
- func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error
- func (e *ExternalDocumentation) WithDescription(val string) *ExternalDocumentation
- func (e *ExternalDocumentation) WithMapOfAnything(val map[string]interface{}) *ExternalDocumentation
- func (e *ExternalDocumentation) WithMapOfAnythingItem(key string, val interface{}) *ExternalDocumentation
- func (e *ExternalDocumentation) WithURL(val string) *ExternalDocumentation
- type HTTPSecurityScheme
- func (h *HTTPSecurityScheme) BearerEns() *Bearer
- func (h HTTPSecurityScheme) MarshalJSON() ([]byte, error)
- func (h *HTTPSecurityScheme) NonBearerEns() *NonBearer
- func (h *HTTPSecurityScheme) UnmarshalJSON(data []byte) error
- func (h *HTTPSecurityScheme) WithBearer(val Bearer) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithBearerFormat(val string) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithDescription(val string) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithMapOfAnything(val map[string]interface{}) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithNonBearer(val NonBearer) *HTTPSecurityScheme
- func (h *HTTPSecurityScheme) WithScheme(val string) *HTTPSecurityScheme
- type HasContent
- type HasSchema
- type Header
- func (h Header) MarshalJSON() ([]byte, error)
- func (h *Header) SchemaEns() *SchemaOrRef
- func (h *Header) UnmarshalJSON(data []byte) error
- func (h *Header) WithAllowEmptyValue(val bool) *Header
- func (h *Header) WithAllowReserved(val bool) *Header
- func (h *Header) WithContent(val map[string]MediaType) *Header
- func (h *Header) WithContentItem(key string, val MediaType) *Header
- func (h *Header) WithDeprecated(val bool) *Header
- func (h *Header) WithDescription(val string) *Header
- func (h *Header) WithExample(val interface{}) *Header
- func (h *Header) WithExamples(val map[string]ExampleOrRef) *Header
- func (h *Header) WithExamplesItem(key string, val ExampleOrRef) *Header
- func (h *Header) WithExplode(val bool) *Header
- func (h *Header) WithMapOfAnything(val map[string]interface{}) *Header
- func (h *Header) WithMapOfAnythingItem(key string, val interface{}) *Header
- func (h *Header) WithRequired(val bool) *Header
- func (h *Header) WithSchema(val SchemaOrRef) *Header
- type HeaderOrRef
- func (h *HeaderOrRef) HeaderEns() *Header
- func (h *HeaderOrRef) HeaderReferenceEns() *HeaderReference
- func (h HeaderOrRef) MarshalJSON() ([]byte, error)
- func (h *HeaderOrRef) UnmarshalJSON(data []byte) error
- func (h *HeaderOrRef) WithHeader(val Header) *HeaderOrRef
- func (h *HeaderOrRef) WithHeaderReference(val HeaderReference) *HeaderOrRef
- type HeaderParameter
- type HeaderReference
- type ImplicitOAuthFlow
- func (i ImplicitOAuthFlow) MarshalJSON() ([]byte, error)
- func (i *ImplicitOAuthFlow) UnmarshalJSON(data []byte) error
- func (i *ImplicitOAuthFlow) WithAuthorizationURL(val string) *ImplicitOAuthFlow
- func (i *ImplicitOAuthFlow) WithMapOfAnything(val map[string]interface{}) *ImplicitOAuthFlow
- func (i *ImplicitOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *ImplicitOAuthFlow
- func (i *ImplicitOAuthFlow) WithRefreshURL(val string) *ImplicitOAuthFlow
- func (i *ImplicitOAuthFlow) WithScopes(val map[string]string) *ImplicitOAuthFlow
- func (i *ImplicitOAuthFlow) WithScopesItem(key string, val string) *ImplicitOAuthFlow
- type Info
- func (i *Info) ContactEns() *Contact
- func (i *Info) LicenseEns() *License
- func (i Info) MarshalJSON() ([]byte, error)
- func (i *Info) UnmarshalJSON(data []byte) error
- func (i *Info) WithContact(val Contact) *Info
- func (i *Info) WithDescription(val string) *Info
- func (i *Info) WithLicense(val License) *Info
- func (i *Info) WithMapOfAnything(val map[string]interface{}) *Info
- func (i *Info) WithMapOfAnythingItem(key string, val interface{}) *Info
- func (i *Info) WithTermsOfService(val string) *Info
- func (i *Info) WithTitle(val string) *Info
- func (i *Info) WithVersion(val string) *Info
- type License
- func (l License) MarshalJSON() ([]byte, error)
- func (l *License) UnmarshalJSON(data []byte) error
- func (l *License) WithMapOfAnything(val map[string]interface{}) *License
- func (l *License) WithMapOfAnythingItem(key string, val interface{}) *License
- func (l *License) WithName(val string) *License
- func (l *License) WithURL(val string) *License
- type Link
- func (l Link) MarshalJSON() ([]byte, error)
- func (l *Link) ServerEns() *Server
- func (l *Link) UnmarshalJSON(data []byte) error
- func (l *Link) WithDescription(val string) *Link
- func (l *Link) WithMapOfAnything(val map[string]interface{}) *Link
- func (l *Link) WithMapOfAnythingItem(key string, val interface{}) *Link
- func (l *Link) WithOperationID(val string) *Link
- func (l *Link) WithOperationRef(val string) *Link
- func (l *Link) WithParameters(val map[string]interface{}) *Link
- func (l *Link) WithParametersItem(key string, val interface{}) *Link
- func (l *Link) WithRequestBody(val interface{}) *Link
- func (l *Link) WithServer(val Server) *Link
- type LinkNot
- type LinkOrRef
- func (l *LinkOrRef) LinkEns() *Link
- func (l *LinkOrRef) LinkReferenceEns() *LinkReference
- func (l LinkOrRef) MarshalJSON() ([]byte, error)
- func (l *LinkOrRef) UnmarshalJSON(data []byte) error
- func (l *LinkOrRef) WithLink(val Link) *LinkOrRef
- func (l *LinkOrRef) WithLinkReference(val LinkReference) *LinkOrRef
- type LinkReference
- type MediaType
- func (m MediaType) MarshalJSON() ([]byte, error)
- func (m *MediaType) SchemaEns() *SchemaOrRef
- func (m *MediaType) UnmarshalJSON(data []byte) error
- func (m *MediaType) WithEncoding(val map[string]Encoding) *MediaType
- func (m *MediaType) WithEncodingItem(key string, val Encoding) *MediaType
- func (m *MediaType) WithExample(val interface{}) *MediaType
- func (m *MediaType) WithExamples(val map[string]ExampleOrRef) *MediaType
- func (m *MediaType) WithExamplesItem(key string, val ExampleOrRef) *MediaType
- func (m *MediaType) WithMapOfAnything(val map[string]interface{}) *MediaType
- func (m *MediaType) WithMapOfAnythingItem(key string, val interface{}) *MediaType
- func (m *MediaType) WithSchema(val SchemaOrRef) *MediaType
- type NonBearer
- type OAuth2SecurityScheme
- func (o OAuth2SecurityScheme) MarshalJSON() ([]byte, error)
- func (o *OAuth2SecurityScheme) UnmarshalJSON(data []byte) error
- func (o *OAuth2SecurityScheme) WithDescription(val string) *OAuth2SecurityScheme
- func (o *OAuth2SecurityScheme) WithFlows(val OAuthFlows) *OAuth2SecurityScheme
- func (o *OAuth2SecurityScheme) WithMapOfAnything(val map[string]interface{}) *OAuth2SecurityScheme
- func (o *OAuth2SecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *OAuth2SecurityScheme
- type OAuthFlows
- func (o *OAuthFlows) AuthorizationCodeEns() *AuthorizationCodeOAuthFlow
- func (o *OAuthFlows) ClientCredentialsEns() *ClientCredentialsFlow
- func (o *OAuthFlows) ImplicitEns() *ImplicitOAuthFlow
- func (o OAuthFlows) MarshalJSON() ([]byte, error)
- func (o *OAuthFlows) PasswordEns() *PasswordOAuthFlow
- func (o *OAuthFlows) UnmarshalJSON(data []byte) error
- func (o *OAuthFlows) WithAuthorizationCode(val AuthorizationCodeOAuthFlow) *OAuthFlows
- func (o *OAuthFlows) WithClientCredentials(val ClientCredentialsFlow) *OAuthFlows
- func (o *OAuthFlows) WithImplicit(val ImplicitOAuthFlow) *OAuthFlows
- func (o *OAuthFlows) WithMapOfAnything(val map[string]interface{}) *OAuthFlows
- func (o *OAuthFlows) WithMapOfAnythingItem(key string, val interface{}) *OAuthFlows
- func (o *OAuthFlows) WithPassword(val PasswordOAuthFlow) *OAuthFlows
- type OpenIDConnectSecurityScheme
- func (o OpenIDConnectSecurityScheme) MarshalJSON() ([]byte, error)
- func (o *OpenIDConnectSecurityScheme) UnmarshalJSON(data []byte) error
- func (o *OpenIDConnectSecurityScheme) WithDescription(val string) *OpenIDConnectSecurityScheme
- func (o *OpenIDConnectSecurityScheme) WithMapOfAnything(val map[string]interface{}) *OpenIDConnectSecurityScheme
- func (o *OpenIDConnectSecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *OpenIDConnectSecurityScheme
- func (o *OpenIDConnectSecurityScheme) WithOpenIDConnectURL(val string) *OpenIDConnectSecurityScheme
- type Operation
- func (o *Operation) ExternalDocsEns() *ExternalDocumentation
- func (o Operation) MarshalJSON() ([]byte, error)
- func (o *Operation) RequestBodyEns() *RequestBodyOrRef
- func (o Operation) UnknownParamIsForbidden(in ParameterIn) bool
- func (o *Operation) UnmarshalJSON(data []byte) error
- func (o *Operation) WithCallbacks(val map[string]CallbackOrRef) *Operation
- func (o *Operation) WithCallbacksItem(key string, val CallbackOrRef) *Operation
- func (o *Operation) WithDeprecated(val bool) *Operation
- func (o *Operation) WithDescription(val string) *Operation
- func (o *Operation) WithExternalDocs(val ExternalDocumentation) *Operation
- func (o *Operation) WithID(val string) *Operation
- func (o *Operation) WithMapOfAnything(val map[string]interface{}) *Operation
- func (o *Operation) WithMapOfAnythingItem(key string, val interface{}) *Operation
- func (o *Operation) WithParameters(val ...ParameterOrRef) *Operation
- func (o *Operation) WithRequestBody(val RequestBodyOrRef) *Operation
- func (o *Operation) WithResponses(val Responses) *Operation
- func (o *Operation) WithSecurity(val ...map[string][]string) *Operation
- func (o *Operation) WithServers(val ...Server) *Operation
- func (o *Operation) WithSummary(val string) *Operation
- func (o *Operation) WithTags(val ...string) *Operation
- type OperationContextdeprecated
- type OperationExposer
- type Parameter
- func (p *Parameter) LocationEns() *ParameterLocation
- func (p Parameter) MarshalJSON() ([]byte, error)
- func (p *Parameter) SchemaEns() *SchemaOrRef
- func (p *Parameter) SchemaXORContentEns() *SchemaXORContent
- func (p Parameter) ToParameterOrRef() ParameterOrRef
- func (p *Parameter) UnmarshalJSON(data []byte) error
- func (p *Parameter) WithAllowEmptyValue(val bool) *Parameter
- func (p *Parameter) WithAllowReserved(val bool) *Parameter
- func (p *Parameter) WithContent(val map[string]MediaType) *Parameter
- func (p *Parameter) WithContentItem(key string, val MediaType) *Parameter
- func (p *Parameter) WithDeprecated(val bool) *Parameter
- func (p *Parameter) WithDescription(val string) *Parameter
- func (p *Parameter) WithExample(val interface{}) *Parameter
- func (p *Parameter) WithExamples(val map[string]ExampleOrRef) *Parameter
- func (p *Parameter) WithExamplesItem(key string, val ExampleOrRef) *Parameter
- func (p *Parameter) WithExplode(val bool) *Parameter
- func (p *Parameter) WithIn(val ParameterIn) *Parameter
- func (p *Parameter) WithLocation(val ParameterLocation) *Parameter
- func (p *Parameter) WithMapOfAnything(val map[string]interface{}) *Parameter
- func (p *Parameter) WithMapOfAnythingItem(key string, val interface{}) *Parameter
- func (p *Parameter) WithName(val string) *Parameter
- func (p *Parameter) WithRequired(val bool) *Parameter
- func (p *Parameter) WithSchema(val SchemaOrRef) *Parameter
- func (p *Parameter) WithSchemaXORContent(val SchemaXORContent) *Parameter
- func (p *Parameter) WithStyle(val string) *Parameter
- type ParameterIn
- type ParameterLocation
- func (p *ParameterLocation) CookieParameterEns() *CookieParameter
- func (p *ParameterLocation) HeaderParameterEns() *HeaderParameter
- func (p ParameterLocation) MarshalJSON() ([]byte, error)
- func (p *ParameterLocation) PathParameterEns() *PathParameter
- func (p *ParameterLocation) QueryParameterEns() *QueryParameter
- func (p *ParameterLocation) UnmarshalJSON(data []byte) error
- func (p *ParameterLocation) WithCookieParameter(val CookieParameter) *ParameterLocation
- func (p *ParameterLocation) WithHeaderParameter(val HeaderParameter) *ParameterLocation
- func (p *ParameterLocation) WithPathParameter(val PathParameter) *ParameterLocation
- func (p *ParameterLocation) WithQueryParameter(val QueryParameter) *ParameterLocation
- type ParameterOrRef
- func (p ParameterOrRef) MarshalJSON() ([]byte, error)
- func (p *ParameterOrRef) ParameterEns() *Parameter
- func (p *ParameterOrRef) ParameterReferenceEns() *ParameterReference
- func (p *ParameterOrRef) UnmarshalJSON(data []byte) error
- func (p *ParameterOrRef) WithParameter(val Parameter) *ParameterOrRef
- func (p *ParameterOrRef) WithParameterReference(val ParameterReference) *ParameterOrRef
- type ParameterReference
- type PasswordOAuthFlow
- func (p PasswordOAuthFlow) MarshalJSON() ([]byte, error)
- func (p *PasswordOAuthFlow) UnmarshalJSON(data []byte) error
- func (p *PasswordOAuthFlow) WithMapOfAnything(val map[string]interface{}) *PasswordOAuthFlow
- func (p *PasswordOAuthFlow) WithMapOfAnythingItem(key string, val interface{}) *PasswordOAuthFlow
- func (p *PasswordOAuthFlow) WithRefreshURL(val string) *PasswordOAuthFlow
- func (p *PasswordOAuthFlow) WithScopes(val map[string]string) *PasswordOAuthFlow
- func (p *PasswordOAuthFlow) WithScopesItem(key string, val string) *PasswordOAuthFlow
- func (p *PasswordOAuthFlow) WithTokenURL(val string) *PasswordOAuthFlow
- type PathItem
- func (p PathItem) MarshalJSON() ([]byte, error)
- func (p *PathItem) UnmarshalJSON(data []byte) error
- func (p *PathItem) WithDescription(val string) *PathItem
- func (p *PathItem) WithMapOfAnything(val map[string]interface{}) *PathItem
- func (p *PathItem) WithMapOfAnythingItem(key string, val interface{}) *PathItem
- func (p *PathItem) WithMapOfOperationValues(val map[string]Operation) *PathItem
- func (p *PathItem) WithMapOfOperationValuesItem(key string, val Operation) *PathItem
- func (p *PathItem) WithOperation(method string, operation Operation) *PathItemdeprecated
- func (p *PathItem) WithParameters(val ...ParameterOrRef) *PathItem
- func (p *PathItem) WithRef(val string) *PathItem
- func (p *PathItem) WithServers(val ...Server) *PathItem
- func (p *PathItem) WithSummary(val string) *PathItem
- type PathParameter
- type PathParameterStyle
- type Paths
- func (p Paths) MarshalJSON() ([]byte, error)
- func (p *Paths) UnmarshalJSON(data []byte) error
- func (p *Paths) WithMapOfAnything(val map[string]interface{}) *Paths
- func (p *Paths) WithMapOfAnythingItem(key string, val interface{}) *Paths
- func (p *Paths) WithMapOfPathItemValues(val map[string]PathItem) *Paths
- func (p *Paths) WithMapOfPathItemValuesItem(key string, val PathItem) *Paths
- type QueryParameter
- type QueryParameterStyle
- type Reflector
- func (r *Reflector) AddOperation(oc openapi.OperationContext) error
- func (r *Reflector) JSONSchemaReflector() *jsonschema.Reflector
- func (r *Reflector) NewOperationContext(method, pathPattern string) (openapi.OperationContext, error)
- func (r *Reflector) ResolveJSONSchemaRef(ref string) (s jsonschema.SchemaOrBool, found bool)
- func (r *Reflector) SetJSONResponse(o *Operation, output interface{}, httpStatus int) errordeprecated
- func (r *Reflector) SetRequest(o *Operation, input interface{}, httpMethod string) errordeprecated
- func (r *Reflector) SetStringResponse(o *Operation, httpStatus int, contentType string) errordeprecated
- func (r *Reflector) SetupRequest(c OperationContext) errordeprecated
- func (r *Reflector) SetupResponse(oc OperationContext) errordeprecated
- func (r *Reflector) SpecEns() *Spec
- func (r *Reflector) SpecSchema() openapi.SpecSchema
- func (r *Reflector) WalkRequestJSONSchemas(method string, cu openapi.ContentUnit, cb openapi.JSONSchemaCallback, ...) error
- func (r *Reflector) WalkResponseJSONSchemas(cu openapi.ContentUnit, cb openapi.JSONSchemaCallback, ...) error
- type RequestBody
- func (r RequestBody) MarshalJSON() ([]byte, error)
- func (r *RequestBody) UnmarshalJSON(data []byte) error
- func (r *RequestBody) WithContent(val map[string]MediaType) *RequestBody
- func (r *RequestBody) WithContentItem(key string, val MediaType) *RequestBody
- func (r *RequestBody) WithDescription(val string) *RequestBody
- func (r *RequestBody) WithMapOfAnything(val map[string]interface{}) *RequestBody
- func (r *RequestBody) WithMapOfAnythingItem(key string, val interface{}) *RequestBody
- func (r *RequestBody) WithRequired(val bool) *RequestBody
- type RequestBodyEnforcerdeprecated
- type RequestBodyOrRef
- func (r RequestBodyOrRef) MarshalJSON() ([]byte, error)
- func (r *RequestBodyOrRef) RequestBodyEns() *RequestBody
- func (r *RequestBodyOrRef) RequestBodyReferenceEns() *RequestBodyReference
- func (r *RequestBodyOrRef) UnmarshalJSON(data []byte) error
- func (r *RequestBodyOrRef) WithRequestBody(val RequestBody) *RequestBodyOrRef
- func (r *RequestBodyOrRef) WithRequestBodyReference(val RequestBodyReference) *RequestBodyOrRef
- type RequestBodyReference
- type RequestJSONBodyEnforcerdeprecated
- type Response
- func (r Response) MarshalJSON() ([]byte, error)
- func (r *Response) UnmarshalJSON(data []byte) error
- func (r *Response) WithContent(val map[string]MediaType) *Response
- func (r *Response) WithContentItem(key string, val MediaType) *Response
- func (r *Response) WithDescription(val string) *Response
- func (r *Response) WithHeaders(val map[string]HeaderOrRef) *Response
- func (r *Response) WithHeadersItem(key string, val HeaderOrRef) *Response
- func (r *Response) WithLinks(val map[string]LinkOrRef) *Response
- func (r *Response) WithLinksItem(key string, val LinkOrRef) *Response
- func (r *Response) WithMapOfAnything(val map[string]interface{}) *Response
- func (r *Response) WithMapOfAnythingItem(key string, val interface{}) *Response
- type ResponseOrRef
- func (r ResponseOrRef) MarshalJSON() ([]byte, error)
- func (r *ResponseOrRef) ResponseEns() *Response
- func (r *ResponseOrRef) ResponseReferenceEns() *ResponseReference
- func (r *ResponseOrRef) UnmarshalJSON(data []byte) error
- func (r *ResponseOrRef) WithResponse(val Response) *ResponseOrRef
- func (r *ResponseOrRef) WithResponseReference(val ResponseReference) *ResponseOrRef
- type ResponseReference
- type Responses
- func (r *Responses) DefaultEns() *ResponseOrRef
- func (r Responses) MarshalJSON() ([]byte, error)
- func (r *Responses) UnmarshalJSON(data []byte) error
- func (r *Responses) WithDefault(val ResponseOrRef) *Responses
- func (r *Responses) WithMapOfAnything(val map[string]interface{}) *Responses
- func (r *Responses) WithMapOfAnythingItem(key string, val interface{}) *Responses
- func (r *Responses) WithMapOfResponseOrRefValues(val map[string]ResponseOrRef) *Responses
- func (r *Responses) WithMapOfResponseOrRefValuesItem(key string, val ResponseOrRef) *Responses
- type Schema
- func (s *Schema) AdditionalPropertiesEns() *SchemaAdditionalProperties
- func (s *Schema) DiscriminatorEns() *Discriminator
- func (s *Schema) ExternalDocsEns() *ExternalDocumentation
- func (s *Schema) ItemsEns() *SchemaOrRef
- func (s Schema) MarshalJSON() ([]byte, error)
- func (s *Schema) NotEns() *SchemaOrRef
- func (s *Schema) UnmarshalJSON(data []byte) error
- func (s *Schema) WithAdditionalProperties(val SchemaAdditionalProperties) *Schema
- func (s *Schema) WithAllOf(val ...SchemaOrRef) *Schema
- func (s *Schema) WithAnyOf(val ...SchemaOrRef) *Schema
- func (s *Schema) WithDefault(val interface{}) *Schema
- func (s *Schema) WithDeprecated(val bool) *Schema
- func (s *Schema) WithDescription(val string) *Schema
- func (s *Schema) WithDiscriminator(val Discriminator) *Schema
- func (s *Schema) WithEnum(val ...interface{}) *Schema
- func (s *Schema) WithExample(val interface{}) *Schema
- func (s *Schema) WithExclusiveMaximum(val bool) *Schema
- func (s *Schema) WithExclusiveMinimum(val bool) *Schema
- func (s *Schema) WithExternalDocs(val ExternalDocumentation) *Schema
- func (s *Schema) WithFormat(val string) *Schema
- func (s *Schema) WithItems(val SchemaOrRef) *Schema
- func (s *Schema) WithMapOfAnything(val map[string]interface{}) *Schema
- func (s *Schema) WithMapOfAnythingItem(key string, val interface{}) *Schema
- func (s *Schema) WithMaxItems(val int64) *Schema
- func (s *Schema) WithMaxLength(val int64) *Schema
- func (s *Schema) WithMaxProperties(val int64) *Schema
- func (s *Schema) WithMaximum(val float64) *Schema
- func (s *Schema) WithMinItems(val int64) *Schema
- func (s *Schema) WithMinLength(val int64) *Schema
- func (s *Schema) WithMinProperties(val int64) *Schema
- func (s *Schema) WithMinimum(val float64) *Schema
- func (s *Schema) WithMultipleOf(val float64) *Schema
- func (s *Schema) WithNot(val SchemaOrRef) *Schema
- func (s *Schema) WithNullable(val bool) *Schema
- func (s *Schema) WithOneOf(val ...SchemaOrRef) *Schema
- func (s *Schema) WithPattern(val string) *Schema
- func (s *Schema) WithProperties(val map[string]SchemaOrRef) *Schema
- func (s *Schema) WithPropertiesItem(key string, val SchemaOrRef) *Schema
- func (s *Schema) WithReadOnly(val bool) *Schema
- func (s *Schema) WithRequired(val ...string) *Schema
- func (s *Schema) WithTitle(val string) *Schema
- func (s *Schema) WithType(val SchemaType) *Schema
- func (s *Schema) WithUniqueItems(val bool) *Schema
- func (s *Schema) WithWriteOnly(val bool) *Schema
- func (s *Schema) WithXML(val XML) *Schema
- func (s *Schema) XMLEns() *XML
- type SchemaAdditionalProperties
- func (s SchemaAdditionalProperties) MarshalJSON() ([]byte, error)
- func (s *SchemaAdditionalProperties) SchemaOrRefEns() *SchemaOrRef
- func (s *SchemaAdditionalProperties) UnmarshalJSON(data []byte) error
- func (s *SchemaAdditionalProperties) WithBool(val bool) *SchemaAdditionalProperties
- func (s *SchemaAdditionalProperties) WithSchemaOrRef(val SchemaOrRef) *SchemaAdditionalProperties
- type SchemaOrRef
- func (s *SchemaOrRef) FromJSONSchema(schema jsonschema.SchemaOrBool)
- func (s SchemaOrRef) MarshalJSON() ([]byte, error)
- func (s *SchemaOrRef) SchemaEns() *Schema
- func (s *SchemaOrRef) SchemaReferenceEns() *SchemaReference
- func (s *SchemaOrRef) ToJSONSchema(spec *Spec) jsonschema.SchemaOrBool
- func (s *SchemaOrRef) UnmarshalJSON(data []byte) error
- func (s *SchemaOrRef) WithSchema(val Schema) *SchemaOrRef
- func (s *SchemaOrRef) WithSchemaReference(val SchemaReference) *SchemaOrRef
- type SchemaReference
- type SchemaType
- type SchemaXORContent
- func (s *SchemaXORContent) HasContentEns() *HasContent
- func (s *SchemaXORContent) HasSchemaEns() *HasSchema
- func (s SchemaXORContent) MarshalJSON() ([]byte, error)
- func (s *SchemaXORContent) UnmarshalJSON(data []byte) error
- func (s *SchemaXORContent) WithHasContent(val HasContent) *SchemaXORContent
- func (s *SchemaXORContent) WithHasSchema(val HasSchema) *SchemaXORContent
- type SchemaXORContentNot
- type SecurityScheme
- func (s *SecurityScheme) APIKeySecuritySchemeEns() *APIKeySecurityScheme
- func (s *SecurityScheme) HTTPSecuritySchemeEns() *HTTPSecurityScheme
- func (s SecurityScheme) MarshalJSON() ([]byte, error)
- func (s *SecurityScheme) OAuth2SecuritySchemeEns() *OAuth2SecurityScheme
- func (s *SecurityScheme) OpenIDConnectSecuritySchemeEns() *OpenIDConnectSecurityScheme
- func (s *SecurityScheme) UnmarshalJSON(data []byte) error
- func (s *SecurityScheme) WithAPIKeySecurityScheme(val APIKeySecurityScheme) *SecurityScheme
- func (s *SecurityScheme) WithHTTPSecurityScheme(val HTTPSecurityScheme) *SecurityScheme
- func (s *SecurityScheme) WithOAuth2SecurityScheme(val OAuth2SecurityScheme) *SecurityScheme
- func (s *SecurityScheme) WithOpenIDConnectSecurityScheme(val OpenIDConnectSecurityScheme) *SecurityScheme
- type SecuritySchemeOrRef
- func (s SecuritySchemeOrRef) MarshalJSON() ([]byte, error)
- func (s *SecuritySchemeOrRef) SecuritySchemeEns() *SecurityScheme
- func (s *SecuritySchemeOrRef) SecuritySchemeReferenceEns() *SecuritySchemeReference
- func (s *SecuritySchemeOrRef) UnmarshalJSON(data []byte) error
- func (s *SecuritySchemeOrRef) WithSecurityScheme(val SecurityScheme) *SecuritySchemeOrRef
- func (s *SecuritySchemeOrRef) WithSecuritySchemeReference(val SecuritySchemeReference) *SecuritySchemeOrRef
- type SecuritySchemeReference
- type Server
- func (s Server) MarshalJSON() ([]byte, error)
- func (s *Server) UnmarshalJSON(data []byte) error
- func (s *Server) WithDescription(val string) *Server
- func (s *Server) WithMapOfAnything(val map[string]interface{}) *Server
- func (s *Server) WithMapOfAnythingItem(key string, val interface{}) *Server
- func (s *Server) WithURL(val string) *Server
- func (s *Server) WithVariables(val map[string]ServerVariable) *Server
- func (s *Server) WithVariablesItem(key string, val ServerVariable) *Server
- type ServerVariable
- func (s ServerVariable) MarshalJSON() ([]byte, error)
- func (s *ServerVariable) UnmarshalJSON(data []byte) error
- func (s *ServerVariable) WithDefault(val string) *ServerVariable
- func (s *ServerVariable) WithDescription(val string) *ServerVariable
- func (s *ServerVariable) WithEnum(val ...string) *ServerVariable
- func (s *ServerVariable) WithMapOfAnything(val map[string]interface{}) *ServerVariable
- func (s *ServerVariable) WithMapOfAnythingItem(key string, val interface{}) *ServerVariable
- type Spec
- func (s *Spec) AddOperation(method, path string, operation Operation) error
- func (s *Spec) ComponentsEns() *Components
- func (s *Spec) Description() string
- func (s *Spec) ExternalDocsEns() *ExternalDocumentation
- func (s Spec) MarshalJSON() ([]byte, error)
- func (s *Spec) MarshalYAML() ([]byte, error)
- func (s *Spec) SetAPIKeySecurity(securityName string, fieldName string, fieldIn openapi.In, description string)
- func (s *Spec) SetDescription(d string)
- func (s *Spec) SetHTTPBasicSecurity(securityName string, description string)
- func (s *Spec) SetHTTPBearerTokenSecurity(securityName string, format string, description string)
- func (s *Spec) SetTitle(t string)
- func (s *Spec) SetVersion(v string)
- func (s *Spec) SetupOperation(method, path string, setup ...func(*Operation) error) error
- func (s *Spec) Title() string
- func (s *Spec) UnmarshalJSON(data []byte) error
- func (s *Spec) UnmarshalYAML(data []byte) error
- func (s *Spec) Version() string
- func (s *Spec) WithComponents(val Components) *Spec
- func (s *Spec) WithExternalDocs(val ExternalDocumentation) *Spec
- func (s *Spec) WithInfo(val Info) *Spec
- func (s *Spec) WithMapOfAnything(val map[string]interface{}) *Spec
- func (s *Spec) WithMapOfAnythingItem(key string, val interface{}) *Spec
- func (s *Spec) WithOpenapi(val string) *Spec
- func (s *Spec) WithPaths(val Paths) *Spec
- func (s *Spec) WithSecurity(val ...map[string][]string) *Spec
- func (s *Spec) WithServers(val ...Server) *Spec
- func (s *Spec) WithTags(val ...Tag) *Spec
- type Tag
- func (t *Tag) ExternalDocsEns() *ExternalDocumentation
- func (t Tag) MarshalJSON() ([]byte, error)
- func (t *Tag) UnmarshalJSON(data []byte) error
- func (t *Tag) WithDescription(val string) *Tag
- func (t *Tag) WithExternalDocs(val ExternalDocumentation) *Tag
- func (t *Tag) WithMapOfAnything(val map[string]interface{}) *Tag
- func (t *Tag) WithMapOfAnythingItem(key string, val interface{}) *Tag
- func (t *Tag) WithName(val string) *Tag
- type XML
- func (x XML) MarshalJSON() ([]byte, error)
- func (x *XML) UnmarshalJSON(data []byte) error
- func (x *XML) WithAttribute(val bool) *XML
- func (x *XML) WithMapOfAnything(val map[string]interface{}) *XML
- func (x *XML) WithMapOfAnythingItem(key string, val interface{}) *XML
- func (x *XML) WithName(val string) *XML
- func (x *XML) WithNamespace(val string) *XML
- func (x *XML) WithPrefix(val string) *XML
- func (x *XML) WithWrapped(val bool) *XML
Examples ¶
Constants ¶
const ( ParameterInPath = ParameterIn("path") ParameterInQuery = ParameterIn("query") ParameterInHeader = ParameterIn("header") ParameterInCookie = ParameterIn("cookie") )
ParameterIn values enumeration.
const ( SchemaTypeArray = SchemaType("array") SchemaTypeBoolean = SchemaType("boolean") SchemaTypeInteger = SchemaType("integer") SchemaTypeNumber = SchemaType("number") SchemaTypeObject = SchemaType("object") SchemaTypeString = SchemaType("string") )
SchemaType values enumeration.
const ( EncodingStyleForm = EncodingStyle("form") EncodingStyleSpaceDelimited = EncodingStyle("spaceDelimited") EncodingStylePipeDelimited = EncodingStyle("pipeDelimited") EncodingStyleDeepObject = EncodingStyle("deepObject") )
EncodingStyle values enumeration.
const ( PathParameterStyleMatrix = PathParameterStyle("matrix") PathParameterStyleLabel = PathParameterStyle("label") PathParameterStyleSimple = PathParameterStyle("simple") )
PathParameterStyle values enumeration.
const ( QueryParameterStyleForm = QueryParameterStyle("form") QueryParameterStyleSpaceDelimited = QueryParameterStyle("spaceDelimited") QueryParameterStylePipeDelimited = QueryParameterStyle("pipeDelimited") QueryParameterStyleDeepObject = QueryParameterStyle("deepObject") )
QueryParameterStyle values enumeration.
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 ¶
func (a *APIKeySecurityScheme) WithIn(val APIKeySecuritySchemeIn) *APIKeySecurityScheme
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 ¶
func (a *APIKeySecurityScheme) WithName(val string) *APIKeySecurityScheme
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 ¶
func (a *AuthorizationCodeOAuthFlow) WithRefreshURL(val string) *AuthorizationCodeOAuthFlow
WithRefreshURL sets RefreshURL value.
func (*AuthorizationCodeOAuthFlow) WithScopes ¶
func (a *AuthorizationCodeOAuthFlow) WithScopes(val map[string]string) *AuthorizationCodeOAuthFlow
WithScopes sets Scopes value.
func (*AuthorizationCodeOAuthFlow) WithScopesItem ¶
func (a *AuthorizationCodeOAuthFlow) WithScopesItem(key string, val string) *AuthorizationCodeOAuthFlow
WithScopesItem sets Scopes item value.
func (*AuthorizationCodeOAuthFlow) WithTokenURL ¶
func (a *AuthorizationCodeOAuthFlow) WithTokenURL(val string) *AuthorizationCodeOAuthFlow
WithTokenURL sets TokenURL value.
type Bearer ¶
type Bearer struct{}
Bearer structure is generated from "#/definitions/HTTPSecurityScheme/oneOf/0".
Bearer.
Bearer.
func (*Bearer) UnmarshalJSON ¶
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 ¶
MarshalJSON encodes JSON.
func (*Callback) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Callback) WithAdditionalProperties ¶
WithAdditionalProperties sets AdditionalProperties value.
func (*Callback) WithAdditionalPropertiesItem ¶
WithAdditionalPropertiesItem sets AdditionalProperties item value.
func (*Callback) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Callback) WithMapOfAnythingItem ¶
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 (*Components) WithLinks ¶
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 ¶
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 ¶
MarshalJSON encodes JSON.
func (*Contact) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Contact) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Contact) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item 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 ¶
UnmarshalJSON decodes JSON.
func (*Encoding) WithAllowReserved ¶
WithAllowReserved sets AllowReserved value.
func (*Encoding) WithContentType ¶
WithContentType sets ContentType value.
func (*Encoding) WithExplode ¶
WithExplode sets Explode value.
func (*Encoding) WithHeaders ¶
WithHeaders sets Headers value.
func (*Encoding) WithHeadersItem ¶
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 ¶
MarshalJSON encodes JSON.
func (*Example) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Example) WithDescription ¶
WithDescription sets Description value.
func (*Example) WithExternalValue ¶
WithExternalValue sets ExternalValue value.
func (*Example) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Example) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Example) WithSummary ¶
WithSummary sets Summary 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 ¶
func (e *ExternalDocumentation) WithURL(val string) *ExternalDocumentation
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 ¶
UnmarshalJSON decodes JSON.
func (*HasSchema) WithSchema ¶
WithSchema sets Schema value.
type Header ¶
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) SchemaEns ¶
func (h *Header) SchemaEns() *SchemaOrRef
SchemaEns ensures returned Schema is not nil.
func (*Header) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Header) WithAllowEmptyValue ¶
WithAllowEmptyValue sets AllowEmptyValue value.
func (*Header) WithAllowReserved ¶
WithAllowReserved sets AllowReserved value.
func (*Header) WithContent ¶
WithContent sets Content value.
func (*Header) WithContentItem ¶
WithContentItem sets Content item value.
func (*Header) WithDeprecated ¶
WithDeprecated sets Deprecated value.
func (*Header) WithDescription ¶
WithDescription sets Description value.
func (*Header) WithExample ¶
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 ¶
WithExplode sets Explode value.
func (*Header) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Header) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Header) WithRequired ¶
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 ¶
ContactEns ensures returned Contact is not nil.
func (*Info) LicenseEns ¶
LicenseEns ensures returned License is not nil.
func (*Info) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Info) WithContact ¶
WithContact sets Contact value.
func (*Info) WithDescription ¶
WithDescription sets Description value.
func (*Info) WithLicense ¶
WithLicense sets License value.
func (*Info) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Info) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Info) WithTermsOfService ¶
WithTermsOfService sets TermsOfService value.
func (*Info) WithVersion ¶
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 ¶
MarshalJSON encodes JSON.
func (*License) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*License) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*License) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
type Link ¶
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) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Link) WithDescription ¶
WithDescription sets Description value.
func (*Link) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Link) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Link) WithOperationID ¶
WithOperationID sets OperationID value.
func (*Link) WithOperationRef ¶
WithOperationRef sets OperationRef value.
func (*Link) WithParameters ¶
WithParameters sets Parameters value.
func (*Link) WithParametersItem ¶
WithParametersItem sets Parameters item value.
func (*Link) WithRequestBody ¶
WithRequestBody sets RequestBody 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 ¶
UnmarshalJSON decodes JSON.
func (*LinkNot) WithOperationID ¶
WithOperationID sets OperationID value.
func (*LinkNot) WithOperationRef ¶
WithOperationRef sets OperationRef value.
type LinkOrRef ¶
type LinkOrRef struct { LinkReference *LinkReference `json:"-"` Link *Link `json:"-"` }
LinkOrRef structure is generated from "#/definitions/LinkOrRef".
func (*LinkOrRef) LinkReferenceEns ¶
func (l *LinkOrRef) LinkReferenceEns() *LinkReference
LinkReferenceEns ensures returned LinkReference is not nil.
func (LinkOrRef) MarshalJSON ¶
MarshalJSON encodes JSON.
func (*LinkOrRef) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
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 ¶
MarshalJSON encodes JSON.
func (*MediaType) SchemaEns ¶
func (m *MediaType) SchemaEns() *SchemaOrRef
SchemaEns ensures returned Schema is not nil.
func (*MediaType) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*MediaType) WithEncoding ¶
WithEncoding sets Encoding value.
func (*MediaType) WithEncodingItem ¶
WithEncodingItem sets Encoding item value.
func (*MediaType) WithExample ¶
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 ¶
WithMapOfAnything sets MapOfAnything value.
func (*MediaType) WithMapOfAnythingItem ¶
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 ¶
UnmarshalJSON decodes JSON.
func (*NonBearer) WithScheme ¶
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 ¶
func (o *OAuth2SecurityScheme) WithFlows(val OAuthFlows) *OAuth2SecurityScheme
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 ¶
func (o *OpenIDConnectSecurityScheme) WithDescription(val string) *OpenIDConnectSecurityScheme
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 ¶
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 ¶
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 ¶
WithDeprecated sets Deprecated value.
func (*Operation) WithDescription ¶
WithDescription sets Description value.
func (*Operation) WithExternalDocs ¶
func (o *Operation) WithExternalDocs(val ExternalDocumentation) *Operation
WithExternalDocs sets ExternalDocs value.
func (*Operation) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Operation) WithMapOfAnythingItem ¶
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 ¶
WithResponses sets Responses value.
func (*Operation) WithSecurity ¶
WithSecurity sets Security value.
func (*Operation) WithServers ¶
WithServers sets Servers value.
func (*Operation) WithSummary ¶
WithSummary sets Summary 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 ¶
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 ¶
UnmarshalJSON decodes JSON.
func (*Parameter) WithAllowEmptyValue ¶
WithAllowEmptyValue sets AllowEmptyValue value.
func (*Parameter) WithAllowReserved ¶
WithAllowReserved sets AllowReserved value.
func (*Parameter) WithContent ¶
WithContent sets Content value.
func (*Parameter) WithContentItem ¶
WithContentItem sets Content item value.
func (*Parameter) WithDeprecated ¶
WithDeprecated sets Deprecated value.
func (*Parameter) WithDescription ¶
WithDescription sets Description value.
func (*Parameter) WithExample ¶
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 ¶
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 ¶
WithMapOfAnything sets MapOfAnything value.
func (*Parameter) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Parameter) WithRequired ¶
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.
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 ¶
MarshalJSON encodes JSON.
func (*PathItem) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*PathItem) WithDescription ¶
WithDescription sets Description value.
func (*PathItem) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*PathItem) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*PathItem) WithMapOfOperationValues ¶
WithMapOfOperationValues sets MapOfOperationValues value.
func (*PathItem) WithMapOfOperationValuesItem ¶
WithMapOfOperationValuesItem sets MapOfOperationValues item value.
func (*PathItem) WithOperation
deprecated
func (*PathItem) WithParameters ¶
func (p *PathItem) WithParameters(val ...ParameterOrRef) *PathItem
WithParameters sets Parameters value.
func (*PathItem) WithServers ¶
WithServers sets Servers value.
func (*PathItem) WithSummary ¶
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) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Paths) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Paths) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Paths) WithMapOfPathItemValues ¶
WithMapOfPathItemValues sets MapOfPathItemValues 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 ¶
func (q *QueryParameter) WithStyle(val QueryParameterStyle) *QueryParameter
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 ¶
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 ¶
ResolveJSONSchemaRef builds JSON Schema from OpenAPI Component Schema reference.
Can be used in jsonschema.Schema IsTrivial().
func (*Reflector) SetJSONResponse
deprecated
func (*Reflector) SetRequest
deprecated
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) 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 ¶
func (r *RequestBodyReference) WithRef(val string) *RequestBodyReference
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 ¶
MarshalJSON encodes JSON.
func (*Response) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Response) WithContent ¶
WithContent sets Content value.
func (*Response) WithContentItem ¶
WithContentItem sets Content item value.
func (*Response) WithDescription ¶
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 (*Response) WithLinksItem ¶
WithLinksItem sets Links item value.
func (*Response) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Response) WithMapOfAnythingItem ¶
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 ¶
MarshalJSON encodes JSON.
func (*Responses) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Responses) WithDefault ¶
func (r *Responses) WithDefault(val ResponseOrRef) *Responses
WithDefault sets Default value.
func (*Responses) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Responses) WithMapOfAnythingItem ¶
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) NotEns ¶
func (s *Schema) NotEns() *SchemaOrRef
NotEns ensures returned Not is not nil.
func (*Schema) UnmarshalJSON ¶
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 ¶
WithDefault sets Default value.
func (*Schema) WithDeprecated ¶
WithDeprecated sets Deprecated value.
func (*Schema) WithDescription ¶
WithDescription sets Description value.
func (*Schema) WithDiscriminator ¶
func (s *Schema) WithDiscriminator(val Discriminator) *Schema
WithDiscriminator sets Discriminator value.
func (*Schema) WithExample ¶
WithExample sets Example value.
func (*Schema) WithExclusiveMaximum ¶
WithExclusiveMaximum sets ExclusiveMaximum value.
func (*Schema) WithExclusiveMinimum ¶
WithExclusiveMinimum sets ExclusiveMinimum value.
func (*Schema) WithExternalDocs ¶
func (s *Schema) WithExternalDocs(val ExternalDocumentation) *Schema
WithExternalDocs sets ExternalDocs value.
func (*Schema) WithFormat ¶
WithFormat sets Format value.
func (*Schema) WithItems ¶
func (s *Schema) WithItems(val SchemaOrRef) *Schema
WithItems sets Items value.
func (*Schema) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Schema) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Schema) WithMaxItems ¶
WithMaxItems sets MaxItems value.
func (*Schema) WithMaxLength ¶
WithMaxLength sets MaxLength value.
func (*Schema) WithMaxProperties ¶
WithMaxProperties sets MaxProperties value.
func (*Schema) WithMaximum ¶
WithMaximum sets Maximum value.
func (*Schema) WithMinItems ¶
WithMinItems sets MinItems value.
func (*Schema) WithMinLength ¶
WithMinLength sets MinLength value.
func (*Schema) WithMinProperties ¶
WithMinProperties sets MinProperties value.
func (*Schema) WithMinimum ¶
WithMinimum sets Minimum value.
func (*Schema) WithMultipleOf ¶
WithMultipleOf sets MultipleOf value.
func (*Schema) WithNullable ¶
WithNullable sets Nullable value.
func (*Schema) WithOneOf ¶
func (s *Schema) WithOneOf(val ...SchemaOrRef) *Schema
WithOneOf sets OneOf value.
func (*Schema) WithPattern ¶
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 ¶
WithReadOnly sets ReadOnly value.
func (*Schema) WithRequired ¶
WithRequired sets Required value.
func (*Schema) WithType ¶
func (s *Schema) WithType(val SchemaType) *Schema
WithType sets Type value.
func (*Schema) WithUniqueItems ¶
WithUniqueItems sets UniqueItems value.
func (*Schema) WithWriteOnly ¶
WithWriteOnly sets WriteOnly value.
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 ¶
func (s *SchemaAdditionalProperties) WithBool(val bool) *SchemaAdditionalProperties
WithBool sets Bool value.
func (*SchemaAdditionalProperties) WithSchemaOrRef ¶
func (s *SchemaAdditionalProperties) WithSchemaOrRef(val SchemaOrRef) *SchemaAdditionalProperties
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 ¶
func (s *SecuritySchemeReference) WithRef(val string) *SecuritySchemeReference
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) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Server) WithDescription ¶
WithDescription sets Description value.
func (*Server) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Server) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item 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 ¶
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 ¶
Description returns service description.
func (*Spec) ExternalDocsEns ¶
func (s *Spec) ExternalDocsEns() *ExternalDocumentation
ExternalDocsEns ensures returned ExternalDocs is not nil.
func (*Spec) MarshalYAML ¶
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 ¶
SetDescription describes the service.
func (*Spec) SetHTTPBasicSecurity ¶
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 ¶
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) SetupOperation ¶
SetupOperation creates operation if it is not present and applies setup functions.
func (*Spec) UnmarshalJSON ¶
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 ¶
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) 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) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Spec) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Spec) WithOpenapi ¶
WithOpenapi sets Openapi value.
func (*Spec) WithSecurity ¶
WithSecurity sets Security value.
func (*Spec) WithServers ¶
WithServers sets Servers 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) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Tag) WithDescription ¶
WithDescription sets Description value.
func (*Tag) WithExternalDocs ¶
func (t *Tag) WithExternalDocs(val ExternalDocumentation) *Tag
WithExternalDocs sets ExternalDocs value.
func (*Tag) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Tag) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item 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) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*XML) WithAttribute ¶
WithAttribute sets Attribute value.
func (*XML) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*XML) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*XML) WithNamespace ¶
WithNamespace sets Namespace value.