Documentation ¶
Overview ¶
Package openapi31 provides entities and helpers to manage OpenAPI 3.1.x schema.
PLEASE NOTE: this package is currently experimental and may have backwards incompatible API changes in near future. API would be considered stable, once this disclaimer is removed. Give it a try and file issues if you face any.
Package openapi31 contains JSON mapping structures.
Index ¶
- Constants
- func ToJSONSchema(s map[string]interface{}, spec *Spec) jsonschema.SchemaOrBool
- type Callbacks
- func (c Callbacks) MarshalJSON() ([]byte, error)
- func (c *Callbacks) UnmarshalJSON(data []byte) error
- func (c *Callbacks) WithAdditionalProperties(val map[string]PathItemOrReference) *Callbacks
- func (c *Callbacks) WithAdditionalPropertiesItem(key string, val PathItemOrReference) *Callbacks
- func (c *Callbacks) WithMapOfAnything(val map[string]interface{}) *Callbacks
- func (c *Callbacks) WithMapOfAnythingItem(key string, val interface{}) *Callbacks
- type CallbacksOrReference
- func (c *CallbacksOrReference) CallbacksEns() *Callbacks
- func (c CallbacksOrReference) MarshalJSON() ([]byte, error)
- func (c *CallbacksOrReference) ReferenceEns() *Reference
- func (c *CallbacksOrReference) UnmarshalJSON(data []byte) error
- func (c *CallbacksOrReference) WithCallbacks(val Callbacks) *CallbacksOrReference
- func (c *CallbacksOrReference) WithReference(val Reference) *CallbacksOrReference
- type Components
- func (c *Components) WithCallbacks(val map[string]CallbacksOrReference) *Components
- func (c *Components) WithCallbacksItem(key string, val CallbacksOrReference) *Components
- func (c *Components) WithExamples(val map[string]ExampleOrReference) *Components
- func (c *Components) WithExamplesItem(key string, val ExampleOrReference) *Components
- func (c *Components) WithHeaders(val map[string]HeaderOrReference) *Components
- func (c *Components) WithHeadersItem(key string, val HeaderOrReference) *Components
- func (c *Components) WithLinks(val map[string]LinkOrReference) *Components
- func (c *Components) WithLinksItem(key string, val LinkOrReference) *Components
- func (c *Components) WithParameters(val map[string]ParameterOrReference) *Components
- func (c *Components) WithParametersItem(key string, val ParameterOrReference) *Components
- func (c *Components) WithPathItems(val map[string]PathItemOrReference) *Components
- func (c *Components) WithPathItemsItem(key string, val PathItemOrReference) *Components
- func (c *Components) WithRequestBodies(val map[string]RequestBodyOrReference) *Components
- func (c *Components) WithRequestBodiesItem(key string, val RequestBodyOrReference) *Components
- func (c *Components) WithResponses(val map[string]ResponseOrReference) *Components
- func (c *Components) WithResponsesItem(key string, val ResponseOrReference) *Components
- func (c *Components) WithSchemas(val map[string]map[string]interface{}) *Components
- func (c *Components) WithSchemasItem(key string, val map[string]interface{}) *Components
- func (c *Components) WithSecuritySchemes(val map[string]SecuritySchemeOrReference) *Components
- func (c *Components) WithSecuritySchemesItem(key string, val SecuritySchemeOrReference) *Components
- 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 Encoding
- 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]HeaderOrReference) *Encoding
- func (e *Encoding) WithHeadersItem(key string, val HeaderOrReference) *Encoding
- func (e *Encoding) WithStyle(val EncodingStyle) *Encoding
- type EncodingAllOf0
- 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 ExampleOrReference
- func (e *ExampleOrReference) ExampleEns() *Example
- func (e ExampleOrReference) MarshalJSON() ([]byte, error)
- func (e *ExampleOrReference) ReferenceEns() *Reference
- func (e *ExampleOrReference) UnmarshalJSON(data []byte) error
- func (e *ExampleOrReference) WithExample(val Example) *ExampleOrReference
- func (e *ExampleOrReference) WithReference(val Reference) *ExampleOrReference
- type Examples
- 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 Header
- func (h Header) MarshalJSON() ([]byte, error)
- func (h *Header) UnmarshalJSON(data []byte) error
- 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]ExampleOrReference) *Header
- func (h *Header) WithExamplesItem(key string, val ExampleOrReference) *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 map[string]interface{}) *Header
- func (h *Header) WithSchemaItem(key string, val interface{}) *Header
- type HeaderOrReference
- func (h *HeaderOrReference) HeaderEns() *Header
- func (h HeaderOrReference) MarshalJSON() ([]byte, error)
- func (h *HeaderOrReference) ReferenceEns() *Reference
- func (h *HeaderOrReference) UnmarshalJSON(data []byte) error
- func (h *HeaderOrReference) WithHeader(val Header) *HeaderOrReference
- func (h *HeaderOrReference) WithReference(val Reference) *HeaderOrReference
- 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) WithSummary(val string) *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) WithIdentifier(val string) *License
- 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) BodyEns() *Server
- func (l Link) MarshalJSON() ([]byte, error)
- func (l *Link) UnmarshalJSON(data []byte) error
- func (l *Link) WithBody(val Server) *Link
- 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]string) *Link
- func (l *Link) WithParametersItem(key string, val string) *Link
- func (l *Link) WithRequestBody(val interface{}) *Link
- type LinkOrReference
- func (l *LinkOrReference) LinkEns() *Link
- func (l LinkOrReference) MarshalJSON() ([]byte, error)
- func (l *LinkOrReference) ReferenceEns() *Reference
- func (l *LinkOrReference) UnmarshalJSON(data []byte) error
- func (l *LinkOrReference) WithLink(val Link) *LinkOrReference
- func (l *LinkOrReference) WithReference(val Reference) *LinkOrReference
- type MediaType
- func (m MediaType) MarshalJSON() ([]byte, error)
- 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]ExampleOrReference) *MediaType
- func (m *MediaType) WithExamplesItem(key string, val ExampleOrReference) *MediaType
- func (m *MediaType) WithMapOfAnything(val map[string]interface{}) *MediaType
- func (m *MediaType) WithMapOfAnythingItem(key string, val interface{}) *MediaType
- func (m *MediaType) WithSchema(val map[string]interface{}) *MediaType
- func (m *MediaType) WithSchemaItem(key string, val interface{}) *MediaType
- type MutualTLS
- type OauthFlows
- func (o *OauthFlows) AuthorizationCodeEns() *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlows) ClientCredentialsEns() *OauthFlowsDefsClientCredentials
- func (o *OauthFlows) ImplicitEns() *OauthFlowsDefsImplicit
- func (o OauthFlows) MarshalJSON() ([]byte, error)
- func (o *OauthFlows) PasswordEns() *OauthFlowsDefsPassword
- func (o *OauthFlows) UnmarshalJSON(data []byte) error
- func (o *OauthFlows) WithAuthorizationCode(val OauthFlowsDefsAuthorizationCode) *OauthFlows
- func (o *OauthFlows) WithClientCredentials(val OauthFlowsDefsClientCredentials) *OauthFlows
- func (o *OauthFlows) WithImplicit(val OauthFlowsDefsImplicit) *OauthFlows
- func (o *OauthFlows) WithMapOfAnything(val map[string]interface{}) *OauthFlows
- func (o *OauthFlows) WithMapOfAnythingItem(key string, val interface{}) *OauthFlows
- func (o *OauthFlows) WithPassword(val OauthFlowsDefsPassword) *OauthFlows
- type OauthFlowsDefsAuthorizationCode
- func (o OauthFlowsDefsAuthorizationCode) MarshalJSON() ([]byte, error)
- func (o *OauthFlowsDefsAuthorizationCode) UnmarshalJSON(data []byte) error
- func (o *OauthFlowsDefsAuthorizationCode) WithAuthorizationURL(val string) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithRefreshURL(val string) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithScopes(val map[string]string) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithScopesItem(key string, val string) *OauthFlowsDefsAuthorizationCode
- func (o *OauthFlowsDefsAuthorizationCode) WithTokenURL(val string) *OauthFlowsDefsAuthorizationCode
- type OauthFlowsDefsClientCredentials
- func (o OauthFlowsDefsClientCredentials) MarshalJSON() ([]byte, error)
- func (o *OauthFlowsDefsClientCredentials) UnmarshalJSON(data []byte) error
- func (o *OauthFlowsDefsClientCredentials) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsClientCredentials
- func (o *OauthFlowsDefsClientCredentials) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsClientCredentials
- func (o *OauthFlowsDefsClientCredentials) WithRefreshURL(val string) *OauthFlowsDefsClientCredentials
- func (o *OauthFlowsDefsClientCredentials) WithScopes(val map[string]string) *OauthFlowsDefsClientCredentials
- func (o *OauthFlowsDefsClientCredentials) WithScopesItem(key string, val string) *OauthFlowsDefsClientCredentials
- func (o *OauthFlowsDefsClientCredentials) WithTokenURL(val string) *OauthFlowsDefsClientCredentials
- type OauthFlowsDefsImplicit
- func (o OauthFlowsDefsImplicit) MarshalJSON() ([]byte, error)
- func (o *OauthFlowsDefsImplicit) UnmarshalJSON(data []byte) error
- func (o *OauthFlowsDefsImplicit) WithAuthorizationURL(val string) *OauthFlowsDefsImplicit
- func (o *OauthFlowsDefsImplicit) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsImplicit
- func (o *OauthFlowsDefsImplicit) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsImplicit
- func (o *OauthFlowsDefsImplicit) WithRefreshURL(val string) *OauthFlowsDefsImplicit
- func (o *OauthFlowsDefsImplicit) WithScopes(val map[string]string) *OauthFlowsDefsImplicit
- func (o *OauthFlowsDefsImplicit) WithScopesItem(key string, val string) *OauthFlowsDefsImplicit
- type OauthFlowsDefsPassword
- func (o OauthFlowsDefsPassword) MarshalJSON() ([]byte, error)
- func (o *OauthFlowsDefsPassword) UnmarshalJSON(data []byte) error
- func (o *OauthFlowsDefsPassword) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsPassword
- func (o *OauthFlowsDefsPassword) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsPassword
- func (o *OauthFlowsDefsPassword) WithRefreshURL(val string) *OauthFlowsDefsPassword
- func (o *OauthFlowsDefsPassword) WithScopes(val map[string]string) *OauthFlowsDefsPassword
- func (o *OauthFlowsDefsPassword) WithScopesItem(key string, val string) *OauthFlowsDefsPassword
- func (o *OauthFlowsDefsPassword) WithTokenURL(val string) *OauthFlowsDefsPassword
- type Operation
- func (o *Operation) ExternalDocsEns() *ExternalDocumentation
- func (o Operation) MarshalJSON() ([]byte, error)
- func (o *Operation) RequestBodyEns() *RequestBodyOrReference
- func (o *Operation) ResponsesEns() *Responses
- func (o Operation) UnknownParamIsForbidden(in ParameterIn) bool
- func (o *Operation) UnmarshalJSON(data []byte) error
- func (o *Operation) WithCallbacks(val map[string]CallbacksOrReference) *Operation
- func (o *Operation) WithCallbacksItem(key string, val CallbacksOrReference) *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 ...ParameterOrReference) *Operation
- func (o *Operation) WithRequestBody(val RequestBodyOrReference) *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 OperationExposer
- type Parameter
- func (p Parameter) MarshalJSON() ([]byte, error)
- func (p Parameter) ToParameterOrRef() ParameterOrReference
- func (p *Parameter) UnmarshalJSON(data []byte) error
- 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]ExampleOrReference) *Parameter
- func (p *Parameter) WithExamplesItem(key string, val ExampleOrReference) *Parameter
- func (p *Parameter) WithExplode(val bool) *Parameter
- func (p *Parameter) WithIn(val ParameterIn) *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 map[string]interface{}) *Parameter
- func (p *Parameter) WithSchemaItem(key string, val interface{}) *Parameter
- func (p *Parameter) WithStyle(val ParameterStyle) *Parameter
- type ParameterIn
- type ParameterOrReference
- func (p ParameterOrReference) MarshalJSON() ([]byte, error)
- func (p *ParameterOrReference) ParameterEns() *Parameter
- func (p *ParameterOrReference) ReferenceEns() *Reference
- func (p *ParameterOrReference) UnmarshalJSON(data []byte) error
- func (p *ParameterOrReference) WithParameter(val Parameter) *ParameterOrReference
- func (p *ParameterOrReference) WithReference(val Reference) *ParameterOrReference
- type ParameterStyle
- type PathItem
- func (p *PathItem) DeleteEns() *Operation
- func (p *PathItem) GetEns() *Operation
- func (p *PathItem) HeadEns() *Operation
- func (p PathItem) MarshalJSON() ([]byte, error)
- func (p PathItem) Operation(method string) (*Operation, error)
- func (p *PathItem) OptionsEns() *Operation
- func (p *PathItem) PatchEns() *Operation
- func (p *PathItem) PostEns() *Operation
- func (p *PathItem) PutEns() *Operation
- func (p *PathItem) SetOperation(method string, op *Operation) error
- func (p *PathItem) TraceEns() *Operation
- func (p *PathItem) UnmarshalJSON(data []byte) error
- func (p *PathItem) WithDelete(val Operation) *PathItem
- func (p *PathItem) WithDescription(val string) *PathItem
- func (p *PathItem) WithGet(val Operation) *PathItem
- func (p *PathItem) WithHead(val Operation) *PathItem
- func (p *PathItem) WithMapOfAnything(val map[string]interface{}) *PathItem
- func (p *PathItem) WithMapOfAnythingItem(key string, val interface{}) *PathItem
- func (p *PathItem) WithOptions(val Operation) *PathItem
- func (p *PathItem) WithParameters(val ...ParameterOrReference) *PathItem
- func (p *PathItem) WithPatch(val Operation) *PathItem
- func (p *PathItem) WithPost(val Operation) *PathItem
- func (p *PathItem) WithPut(val Operation) *PathItem
- func (p *PathItem) WithServers(val ...Server) *PathItem
- func (p *PathItem) WithSummary(val string) *PathItem
- func (p *PathItem) WithTrace(val Operation) *PathItem
- type PathItemOrReference
- func (p PathItemOrReference) MarshalJSON() ([]byte, error)
- func (p *PathItemOrReference) PathItemEns() *PathItem
- func (p *PathItemOrReference) ReferenceEns() *Reference
- func (p *PathItemOrReference) UnmarshalJSON(data []byte) error
- func (p *PathItemOrReference) WithPathItem(val PathItem) *PathItemOrReference
- func (p *PathItemOrReference) WithReference(val Reference) *PathItemOrReference
- 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 Reference
- 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) 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 RequestBodyOrReference
- func (r RequestBodyOrReference) MarshalJSON() ([]byte, error)
- func (r *RequestBodyOrReference) ReferenceEns() *Reference
- func (r *RequestBodyOrReference) RequestBodyEns() *RequestBody
- func (r *RequestBodyOrReference) SetReference(ref string)
- func (r *RequestBodyOrReference) UnmarshalJSON(data []byte) error
- func (r *RequestBodyOrReference) WithReference(val Reference) *RequestBodyOrReference
- func (r *RequestBodyOrReference) WithRequestBody(val RequestBody) *RequestBodyOrReference
- 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]HeaderOrReference) *Response
- func (r *Response) WithHeadersItem(key string, val HeaderOrReference) *Response
- func (r *Response) WithLinks(val map[string]LinkOrReference) *Response
- func (r *Response) WithLinksItem(key string, val LinkOrReference) *Response
- func (r *Response) WithMapOfAnything(val map[string]interface{}) *Response
- func (r *Response) WithMapOfAnythingItem(key string, val interface{}) *Response
- type ResponseOrReference
- func (r ResponseOrReference) MarshalJSON() ([]byte, error)
- func (r *ResponseOrReference) ReferenceEns() *Reference
- func (r *ResponseOrReference) ResponseEns() *Response
- func (r *ResponseOrReference) SetReference(ref string)
- func (r *ResponseOrReference) UnmarshalJSON(data []byte) error
- func (r *ResponseOrReference) WithReference(val Reference) *ResponseOrReference
- func (r *ResponseOrReference) WithResponse(val Response) *ResponseOrReference
- type Responses
- func (r *Responses) DefaultEns() *ResponseOrReference
- func (r Responses) MarshalJSON() ([]byte, error)
- func (r *Responses) UnmarshalJSON(data []byte) error
- func (r *Responses) WithDefault(val ResponseOrReference) *Responses
- func (r *Responses) WithMapOfAnything(val map[string]interface{}) *Responses
- func (r *Responses) WithMapOfAnythingItem(key string, val interface{}) *Responses
- func (r *Responses) WithMapOfResponseOrReferenceValues(val map[string]ResponseOrReference) *Responses
- func (r *Responses) WithMapOfResponseOrReferenceValuesItem(key string, val ResponseOrReference) *Responses
- type SecurityScheme
- func (s *SecurityScheme) APIKeyEns() *SecuritySchemeAPIKey
- func (s *SecurityScheme) HTTPBearerEns() *SecuritySchemeHTTPBearer
- func (s *SecurityScheme) HTTPEns() *SecuritySchemeHTTP
- func (s SecurityScheme) MarshalJSON() ([]byte, error)
- func (s *SecurityScheme) MutualTLSEns() *MutualTLS
- func (s *SecurityScheme) Oauth2Ens() *SecuritySchemeOauth2
- func (s *SecurityScheme) OidcEns() *SecuritySchemeOidc
- func (s *SecurityScheme) UnmarshalJSON(data []byte) error
- func (s *SecurityScheme) WithAPIKey(val SecuritySchemeAPIKey) *SecurityScheme
- func (s *SecurityScheme) WithDescription(val string) *SecurityScheme
- func (s *SecurityScheme) WithHTTP(val SecuritySchemeHTTP) *SecurityScheme
- func (s *SecurityScheme) WithHTTPBearer(val SecuritySchemeHTTPBearer) *SecurityScheme
- func (s *SecurityScheme) WithMapOfAnything(val map[string]interface{}) *SecurityScheme
- func (s *SecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *SecurityScheme
- func (s *SecurityScheme) WithMutualTLS(val MutualTLS) *SecurityScheme
- func (s *SecurityScheme) WithOauth2(val SecuritySchemeOauth2) *SecurityScheme
- func (s *SecurityScheme) WithOidc(val SecuritySchemeOidc) *SecurityScheme
- type SecuritySchemeAPIKey
- type SecuritySchemeAPIKeyIn
- type SecuritySchemeHTTP
- type SecuritySchemeHTTPBearer
- func (s SecuritySchemeHTTPBearer) MarshalJSON() ([]byte, error)
- func (s *SecuritySchemeHTTPBearer) UnmarshalJSON(data []byte) error
- func (s *SecuritySchemeHTTPBearer) WithBearerFormat(val string) *SecuritySchemeHTTPBearer
- func (s *SecuritySchemeHTTPBearer) WithScheme(val string) *SecuritySchemeHTTPBearer
- type SecuritySchemeOauth2
- type SecuritySchemeOidc
- type SecuritySchemeOrReference
- func (s SecuritySchemeOrReference) MarshalJSON() ([]byte, error)
- func (s *SecuritySchemeOrReference) ReferenceEns() *Reference
- func (s *SecuritySchemeOrReference) SecuritySchemeEns() *SecurityScheme
- func (s *SecuritySchemeOrReference) UnmarshalJSON(data []byte) error
- func (s *SecuritySchemeOrReference) WithReference(val Reference) *SecuritySchemeOrReference
- func (s *SecuritySchemeOrReference) WithSecurityScheme(val SecurityScheme) *SecuritySchemeOrReference
- 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) PathsEns() *Paths
- 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) WithJSONSchemaDialect(val string) *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
- func (s *Spec) WithWebhooks(val map[string]PathItemOrReference) *Spec
- func (s *Spec) WithWebhooksItem(key string, val PathItemOrReference) *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
Examples ¶
Constants ¶
const ( ParameterInQuery = ParameterIn("query") ParameterInHeader = ParameterIn("header") ParameterInPath = ParameterIn("path") ParameterInCookie = ParameterIn("cookie") )
ParameterIn values enumeration.
const ( EncodingStyleForm = EncodingStyle("form") EncodingStyleSpaceDelimited = EncodingStyle("spaceDelimited") EncodingStylePipeDelimited = EncodingStyle("pipeDelimited") EncodingStyleDeepObject = EncodingStyle("deepObject") )
EncodingStyle values enumeration.
const ( ParameterStyleForm = ParameterStyle("form") ParameterStyleSpaceDelimited = ParameterStyle("spaceDelimited") ParameterStylePipeDelimited = ParameterStyle("pipeDelimited") ParameterStyleDeepObject = ParameterStyle("deepObject") )
ParameterStyle values enumeration.
const ( SecuritySchemeAPIKeyInQuery = SecuritySchemeAPIKeyIn("query") SecuritySchemeAPIKeyInHeader = SecuritySchemeAPIKeyIn("header") SecuritySchemeAPIKeyInCookie = SecuritySchemeAPIKeyIn("cookie") )
SecuritySchemeAPIKeyIn values enumeration.
Variables ¶
This section is empty.
Functions ¶
func ToJSONSchema ¶
ToJSONSchema converts OpenAPI Schema to JSON Schema.
Local references are resolved against `#/components/schemas` in spec.
Types ¶
type Callbacks ¶
type Callbacks struct { MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. AdditionalProperties map[string]PathItemOrReference `json:"-"` // All unmatched properties. }
Callbacks structure is generated from "#/$defs/callbacks".
func (Callbacks) MarshalJSON ¶
MarshalJSON encodes JSON.
func (*Callbacks) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*Callbacks) WithAdditionalProperties ¶
func (c *Callbacks) WithAdditionalProperties(val map[string]PathItemOrReference) *Callbacks
WithAdditionalProperties sets AdditionalProperties value.
func (*Callbacks) WithAdditionalPropertiesItem ¶
func (c *Callbacks) WithAdditionalPropertiesItem(key string, val PathItemOrReference) *Callbacks
WithAdditionalPropertiesItem sets AdditionalProperties item value.
func (*Callbacks) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Callbacks) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
type CallbacksOrReference ¶
type CallbacksOrReference struct { Reference *Reference `json:"-"` Callbacks *Callbacks `json:"-"` }
CallbacksOrReference structure is generated from "#/$defs/callbacks-or-reference".
func (*CallbacksOrReference) CallbacksEns ¶
func (c *CallbacksOrReference) CallbacksEns() *Callbacks
CallbacksEns ensures returned Callbacks is not nil.
func (CallbacksOrReference) MarshalJSON ¶
func (c CallbacksOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*CallbacksOrReference) ReferenceEns ¶
func (c *CallbacksOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*CallbacksOrReference) UnmarshalJSON ¶
func (c *CallbacksOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*CallbacksOrReference) WithCallbacks ¶
func (c *CallbacksOrReference) WithCallbacks(val Callbacks) *CallbacksOrReference
WithCallbacks sets Callbacks value.
func (*CallbacksOrReference) WithReference ¶
func (c *CallbacksOrReference) WithReference(val Reference) *CallbacksOrReference
WithReference sets Reference value.
type Components ¶
type Components struct { Schemas map[string]map[string]interface{} `json:"schemas,omitempty"` Responses map[string]ResponseOrReference `json:"responses,omitempty"` Parameters map[string]ParameterOrReference `json:"parameters,omitempty"` Examples map[string]ExampleOrReference `json:"examples,omitempty"` RequestBodies map[string]RequestBodyOrReference `json:"requestBodies,omitempty"` Headers map[string]HeaderOrReference `json:"headers,omitempty"` SecuritySchemes map[string]SecuritySchemeOrReference `json:"securitySchemes,omitempty"` Links map[string]LinkOrReference `json:"links,omitempty"` Callbacks map[string]CallbacksOrReference `json:"callbacks,omitempty"` PathItems map[string]PathItemOrReference `json:"pathItems,omitempty"` }
Components structure is generated from "#/$defs/components".
func (*Components) WithCallbacks ¶
func (c *Components) WithCallbacks(val map[string]CallbacksOrReference) *Components
WithCallbacks sets Callbacks value.
func (*Components) WithCallbacksItem ¶
func (c *Components) WithCallbacksItem(key string, val CallbacksOrReference) *Components
WithCallbacksItem sets Callbacks item value.
func (*Components) WithExamples ¶
func (c *Components) WithExamples(val map[string]ExampleOrReference) *Components
WithExamples sets Examples value.
func (*Components) WithExamplesItem ¶
func (c *Components) WithExamplesItem(key string, val ExampleOrReference) *Components
WithExamplesItem sets Examples item value.
func (*Components) WithHeaders ¶
func (c *Components) WithHeaders(val map[string]HeaderOrReference) *Components
WithHeaders sets Headers value.
func (*Components) WithHeadersItem ¶
func (c *Components) WithHeadersItem(key string, val HeaderOrReference) *Components
WithHeadersItem sets Headers item value.
func (*Components) WithLinks ¶
func (c *Components) WithLinks(val map[string]LinkOrReference) *Components
WithLinks sets Links value.
func (*Components) WithLinksItem ¶
func (c *Components) WithLinksItem(key string, val LinkOrReference) *Components
WithLinksItem sets Links item value.
func (*Components) WithParameters ¶
func (c *Components) WithParameters(val map[string]ParameterOrReference) *Components
WithParameters sets Parameters value.
func (*Components) WithParametersItem ¶
func (c *Components) WithParametersItem(key string, val ParameterOrReference) *Components
WithParametersItem sets Parameters item value.
func (*Components) WithPathItems ¶
func (c *Components) WithPathItems(val map[string]PathItemOrReference) *Components
WithPathItems sets PathItems value.
func (*Components) WithPathItemsItem ¶
func (c *Components) WithPathItemsItem(key string, val PathItemOrReference) *Components
WithPathItemsItem sets PathItems item value.
func (*Components) WithRequestBodies ¶
func (c *Components) WithRequestBodies(val map[string]RequestBodyOrReference) *Components
WithRequestBodies sets RequestBodies value.
func (*Components) WithRequestBodiesItem ¶
func (c *Components) WithRequestBodiesItem(key string, val RequestBodyOrReference) *Components
WithRequestBodiesItem sets RequestBodies item value.
func (*Components) WithResponses ¶
func (c *Components) WithResponses(val map[string]ResponseOrReference) *Components
WithResponses sets Responses value.
func (*Components) WithResponsesItem ¶
func (c *Components) WithResponsesItem(key string, val ResponseOrReference) *Components
WithResponsesItem sets Responses item value.
func (*Components) WithSchemas ¶
func (c *Components) WithSchemas(val map[string]map[string]interface{}) *Components
WithSchemas sets Schemas value.
func (*Components) WithSchemasItem ¶
func (c *Components) WithSchemasItem(key string, val map[string]interface{}) *Components
WithSchemasItem sets Schemas item value.
func (*Components) WithSecuritySchemes ¶
func (c *Components) WithSecuritySchemes(val map[string]SecuritySchemeOrReference) *Components
WithSecuritySchemes sets SecuritySchemes value.
func (*Components) WithSecuritySchemesItem ¶
func (c *Components) WithSecuritySchemesItem(key string, val SecuritySchemeOrReference) *Components
WithSecuritySchemesItem sets SecuritySchemes item value.
type Contact ¶
type Contact struct { Name *string `json:"name,omitempty"` URL *string `json:"url,omitempty"` // Format: uri. Email *string `json:"email,omitempty"` // Format: email. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Contact structure is generated from "#/$defs/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 Encoding ¶
type Encoding struct { ContentType *string `json:"contentType,omitempty"` // Format: media-range. Headers map[string]HeaderOrReference `json:"headers,omitempty"` Style *EncodingStyle `json:"style,omitempty"` Explode *bool `json:"explode,omitempty"` AllowReserved *bool `json:"allowReserved,omitempty"` }
Encoding structure is generated from "#/$defs/encoding".
func (*Encoding) WithAllowReserved ¶
WithAllowReserved sets AllowReserved value.
func (*Encoding) WithContentType ¶
WithContentType sets ContentType value.
func (*Encoding) WithExplode ¶
WithExplode sets Explode value.
func (*Encoding) WithHeaders ¶
func (e *Encoding) WithHeaders(val map[string]HeaderOrReference) *Encoding
WithHeaders sets Headers value.
func (*Encoding) WithHeadersItem ¶
func (e *Encoding) WithHeadersItem(key string, val HeaderOrReference) *Encoding
WithHeadersItem sets Headers item value.
func (*Encoding) WithStyle ¶
func (e *Encoding) WithStyle(val EncodingStyle) *Encoding
WithStyle sets Style value.
type EncodingAllOf0 ¶
type EncodingAllOf0 struct {
MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`.
}
EncodingAllOf0 structure is generated from "#/$defs/encoding/allOf/0".
func (EncodingAllOf0) MarshalJSON ¶
func (e EncodingAllOf0) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*EncodingAllOf0) UnmarshalJSON ¶
func (e *EncodingAllOf0) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*EncodingAllOf0) WithMapOfAnything ¶
func (e *EncodingAllOf0) WithMapOfAnything(val map[string]interface{}) *EncodingAllOf0
WithMapOfAnything sets MapOfAnything value.
func (*EncodingAllOf0) WithMapOfAnythingItem ¶
func (e *EncodingAllOf0) WithMapOfAnythingItem(key string, val interface{}) *EncodingAllOf0
WithMapOfAnythingItem sets MapOfAnything item 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. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Example structure is generated from "#/$defs/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 ExampleOrReference ¶
ExampleOrReference structure is generated from "#/$defs/example-or-reference".
func (*ExampleOrReference) ExampleEns ¶
func (e *ExampleOrReference) ExampleEns() *Example
ExampleEns ensures returned Example is not nil.
func (ExampleOrReference) MarshalJSON ¶
func (e ExampleOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*ExampleOrReference) ReferenceEns ¶
func (e *ExampleOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*ExampleOrReference) UnmarshalJSON ¶
func (e *ExampleOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*ExampleOrReference) WithExample ¶
func (e *ExampleOrReference) WithExample(val Example) *ExampleOrReference
WithExample sets Example value.
func (*ExampleOrReference) WithReference ¶
func (e *ExampleOrReference) WithReference(val Reference) *ExampleOrReference
WithReference sets Reference value.
type Examples ¶
type Examples struct { Example *interface{} `json:"example,omitempty"` Examples map[string]ExampleOrReference `json:"examples,omitempty"` }
Examples structure is generated from "#/$defs/examples".
func (*Examples) WithExample ¶
WithExample sets Example value.
func (*Examples) WithExamples ¶
func (e *Examples) WithExamples(val map[string]ExampleOrReference) *Examples
WithExamples sets Examples value.
func (*Examples) WithExamplesItem ¶
func (e *Examples) WithExamplesItem(key string, val ExampleOrReference) *Examples
WithExamplesItem sets Examples item value.
type ExternalDocumentation ¶
type ExternalDocumentation struct { Description *string `json:"description,omitempty"` // Format: uri. // Required. URL string `json:"url"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
ExternalDocumentation structure is generated from "#/$defs/external-documentation".
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 Header ¶
type Header struct { Description *string `json:"description,omitempty"` Required *bool `json:"required,omitempty"` Deprecated *bool `json:"deprecated,omitempty"` Schema map[string]interface{} `json:"schema,omitempty"` Content map[string]MediaType `json:"content,omitempty"` Example *interface{} `json:"example,omitempty"` Examples map[string]ExampleOrReference `json:"examples,omitempty"` Explode *bool `json:"explode,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Header structure is generated from "#/$defs/header".
func (*Header) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
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]ExampleOrReference) *Header
WithExamples sets Examples value.
func (*Header) WithExamplesItem ¶
func (h *Header) WithExamplesItem(key string, val ExampleOrReference) *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 ¶
WithSchema sets Schema value.
func (*Header) WithSchemaItem ¶
WithSchemaItem sets Schema item value.
type HeaderOrReference ¶
HeaderOrReference structure is generated from "#/$defs/header-or-reference".
func (*HeaderOrReference) HeaderEns ¶
func (h *HeaderOrReference) HeaderEns() *Header
HeaderEns ensures returned Header is not nil.
func (HeaderOrReference) MarshalJSON ¶
func (h HeaderOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*HeaderOrReference) ReferenceEns ¶
func (h *HeaderOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*HeaderOrReference) UnmarshalJSON ¶
func (h *HeaderOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*HeaderOrReference) WithHeader ¶
func (h *HeaderOrReference) WithHeader(val Header) *HeaderOrReference
WithHeader sets Header value.
func (*HeaderOrReference) WithReference ¶
func (h *HeaderOrReference) WithReference(val Reference) *HeaderOrReference
WithReference sets Reference value.
type Info ¶
type Info struct { Title string `json:"title"` // Required. Summary *string `json:"summary,omitempty"` Description *string `json:"description,omitempty"` TermsOfService *string `json:"termsOfService,omitempty"` // Format: uri. 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 "#/$defs/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) WithSummary ¶
WithSummary sets Summary 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. Identifier *string `json:"identifier,omitempty"` URL *string `json:"url,omitempty"` // Format: uri. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
License structure is generated from "#/$defs/license".
func (License) MarshalJSON ¶
MarshalJSON encodes JSON.
func (*License) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*License) WithIdentifier ¶
WithIdentifier sets Identifier value.
func (*License) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*License) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
type Link ¶
type Link struct { OperationRef *string `json:"operationRef,omitempty"` // Format: uri-reference. OperationID *string `json:"operationId,omitempty"` Parameters map[string]string `json:"parameters,omitempty"` RequestBody *interface{} `json:"requestBody,omitempty"` Description *string `json:"description,omitempty"` Body *Server `json:"body,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Link structure is generated from "#/$defs/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 LinkOrReference ¶
LinkOrReference structure is generated from "#/$defs/link-or-reference".
func (*LinkOrReference) LinkEns ¶
func (l *LinkOrReference) LinkEns() *Link
LinkEns ensures returned Link is not nil.
func (LinkOrReference) MarshalJSON ¶
func (l LinkOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*LinkOrReference) ReferenceEns ¶
func (l *LinkOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*LinkOrReference) UnmarshalJSON ¶
func (l *LinkOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*LinkOrReference) WithLink ¶
func (l *LinkOrReference) WithLink(val Link) *LinkOrReference
WithLink sets Link value.
func (*LinkOrReference) WithReference ¶
func (l *LinkOrReference) WithReference(val Reference) *LinkOrReference
WithReference sets Reference value.
type MediaType ¶
type MediaType struct { Schema map[string]interface{} `json:"schema,omitempty"` Encoding map[string]Encoding `json:"encoding,omitempty"` Example *interface{} `json:"example,omitempty"` Examples map[string]ExampleOrReference `json:"examples,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
MediaType structure is generated from "#/$defs/media-type".
func (MediaType) MarshalJSON ¶
MarshalJSON encodes JSON.
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]ExampleOrReference) *MediaType
WithExamples sets Examples value.
func (*MediaType) WithExamplesItem ¶
func (m *MediaType) WithExamplesItem(key string, val ExampleOrReference) *MediaType
WithExamplesItem sets Examples item value.
func (*MediaType) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*MediaType) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*MediaType) WithSchema ¶
WithSchema sets Schema value.
func (*MediaType) WithSchemaItem ¶
WithSchemaItem sets Schema item value.
type MutualTLS ¶
type MutualTLS struct{}
MutualTLS structure is generated from "#/$defs/security-scheme/oneOf/5".
mutualTLS.
func (MutualTLS) MarshalJSON ¶
MarshalJSON encodes JSON.
func (*MutualTLS) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
type OauthFlows ¶
type OauthFlows struct { Implicit *OauthFlowsDefsImplicit `json:"implicit,omitempty"` Password *OauthFlowsDefsPassword `json:"password,omitempty"` ClientCredentials *OauthFlowsDefsClientCredentials `json:"clientCredentials,omitempty"` AuthorizationCode *OauthFlowsDefsAuthorizationCode `json:"authorizationCode,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
OauthFlows structure is generated from "#/$defs/oauth-flows".
func (*OauthFlows) AuthorizationCodeEns ¶
func (o *OauthFlows) AuthorizationCodeEns() *OauthFlowsDefsAuthorizationCode
AuthorizationCodeEns ensures returned AuthorizationCode is not nil.
func (*OauthFlows) ClientCredentialsEns ¶
func (o *OauthFlows) ClientCredentialsEns() *OauthFlowsDefsClientCredentials
ClientCredentialsEns ensures returned ClientCredentials is not nil.
func (*OauthFlows) ImplicitEns ¶
func (o *OauthFlows) ImplicitEns() *OauthFlowsDefsImplicit
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() *OauthFlowsDefsPassword
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 OauthFlowsDefsAuthorizationCode) *OauthFlows
WithAuthorizationCode sets AuthorizationCode value.
func (*OauthFlows) WithClientCredentials ¶
func (o *OauthFlows) WithClientCredentials(val OauthFlowsDefsClientCredentials) *OauthFlows
WithClientCredentials sets ClientCredentials value.
func (*OauthFlows) WithImplicit ¶
func (o *OauthFlows) WithImplicit(val OauthFlowsDefsImplicit) *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 OauthFlowsDefsPassword) *OauthFlows
WithPassword sets Password value.
type OauthFlowsDefsAuthorizationCode ¶
type OauthFlowsDefsAuthorizationCode struct { // Format: uri. // Required. AuthorizationURL string `json:"authorizationUrl"` // Format: uri. // Required. TokenURL string `json:"tokenUrl"` RefreshURL *string `json:"refreshUrl,omitempty"` // Format: uri. Scopes map[string]string `json:"scopes"` // Required. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
OauthFlowsDefsAuthorizationCode structure is generated from "#/$defs/oauth-flows/$defs/authorization-code".
func (OauthFlowsDefsAuthorizationCode) MarshalJSON ¶
func (o OauthFlowsDefsAuthorizationCode) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*OauthFlowsDefsAuthorizationCode) UnmarshalJSON ¶
func (o *OauthFlowsDefsAuthorizationCode) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*OauthFlowsDefsAuthorizationCode) WithAuthorizationURL ¶
func (o *OauthFlowsDefsAuthorizationCode) WithAuthorizationURL(val string) *OauthFlowsDefsAuthorizationCode
WithAuthorizationURL sets AuthorizationURL value.
func (*OauthFlowsDefsAuthorizationCode) WithMapOfAnything ¶
func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsAuthorizationCode
WithMapOfAnything sets MapOfAnything value.
func (*OauthFlowsDefsAuthorizationCode) WithMapOfAnythingItem ¶
func (o *OauthFlowsDefsAuthorizationCode) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsAuthorizationCode
WithMapOfAnythingItem sets MapOfAnything item value.
func (*OauthFlowsDefsAuthorizationCode) WithRefreshURL ¶
func (o *OauthFlowsDefsAuthorizationCode) WithRefreshURL(val string) *OauthFlowsDefsAuthorizationCode
WithRefreshURL sets RefreshURL value.
func (*OauthFlowsDefsAuthorizationCode) WithScopes ¶
func (o *OauthFlowsDefsAuthorizationCode) WithScopes(val map[string]string) *OauthFlowsDefsAuthorizationCode
WithScopes sets Scopes value.
func (*OauthFlowsDefsAuthorizationCode) WithScopesItem ¶
func (o *OauthFlowsDefsAuthorizationCode) WithScopesItem(key string, val string) *OauthFlowsDefsAuthorizationCode
WithScopesItem sets Scopes item value.
func (*OauthFlowsDefsAuthorizationCode) WithTokenURL ¶
func (o *OauthFlowsDefsAuthorizationCode) WithTokenURL(val string) *OauthFlowsDefsAuthorizationCode
WithTokenURL sets TokenURL value.
type OauthFlowsDefsClientCredentials ¶
type OauthFlowsDefsClientCredentials struct { // Format: uri. // Required. TokenURL string `json:"tokenUrl"` RefreshURL *string `json:"refreshUrl,omitempty"` // Format: uri. Scopes map[string]string `json:"scopes"` // Required. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
OauthFlowsDefsClientCredentials structure is generated from "#/$defs/oauth-flows/$defs/client-credentials".
func (OauthFlowsDefsClientCredentials) MarshalJSON ¶
func (o OauthFlowsDefsClientCredentials) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*OauthFlowsDefsClientCredentials) UnmarshalJSON ¶
func (o *OauthFlowsDefsClientCredentials) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*OauthFlowsDefsClientCredentials) WithMapOfAnything ¶
func (o *OauthFlowsDefsClientCredentials) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsClientCredentials
WithMapOfAnything sets MapOfAnything value.
func (*OauthFlowsDefsClientCredentials) WithMapOfAnythingItem ¶
func (o *OauthFlowsDefsClientCredentials) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsClientCredentials
WithMapOfAnythingItem sets MapOfAnything item value.
func (*OauthFlowsDefsClientCredentials) WithRefreshURL ¶
func (o *OauthFlowsDefsClientCredentials) WithRefreshURL(val string) *OauthFlowsDefsClientCredentials
WithRefreshURL sets RefreshURL value.
func (*OauthFlowsDefsClientCredentials) WithScopes ¶
func (o *OauthFlowsDefsClientCredentials) WithScopes(val map[string]string) *OauthFlowsDefsClientCredentials
WithScopes sets Scopes value.
func (*OauthFlowsDefsClientCredentials) WithScopesItem ¶
func (o *OauthFlowsDefsClientCredentials) WithScopesItem(key string, val string) *OauthFlowsDefsClientCredentials
WithScopesItem sets Scopes item value.
func (*OauthFlowsDefsClientCredentials) WithTokenURL ¶
func (o *OauthFlowsDefsClientCredentials) WithTokenURL(val string) *OauthFlowsDefsClientCredentials
WithTokenURL sets TokenURL value.
type OauthFlowsDefsImplicit ¶
type OauthFlowsDefsImplicit struct { // Format: uri. // Required. AuthorizationURL string `json:"authorizationUrl"` RefreshURL *string `json:"refreshUrl,omitempty"` // Format: uri. Scopes map[string]string `json:"scopes"` // Required. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
OauthFlowsDefsImplicit structure is generated from "#/$defs/oauth-flows/$defs/implicit".
func (OauthFlowsDefsImplicit) MarshalJSON ¶
func (o OauthFlowsDefsImplicit) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*OauthFlowsDefsImplicit) UnmarshalJSON ¶
func (o *OauthFlowsDefsImplicit) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*OauthFlowsDefsImplicit) WithAuthorizationURL ¶
func (o *OauthFlowsDefsImplicit) WithAuthorizationURL(val string) *OauthFlowsDefsImplicit
WithAuthorizationURL sets AuthorizationURL value.
func (*OauthFlowsDefsImplicit) WithMapOfAnything ¶
func (o *OauthFlowsDefsImplicit) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsImplicit
WithMapOfAnything sets MapOfAnything value.
func (*OauthFlowsDefsImplicit) WithMapOfAnythingItem ¶
func (o *OauthFlowsDefsImplicit) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsImplicit
WithMapOfAnythingItem sets MapOfAnything item value.
func (*OauthFlowsDefsImplicit) WithRefreshURL ¶
func (o *OauthFlowsDefsImplicit) WithRefreshURL(val string) *OauthFlowsDefsImplicit
WithRefreshURL sets RefreshURL value.
func (*OauthFlowsDefsImplicit) WithScopes ¶
func (o *OauthFlowsDefsImplicit) WithScopes(val map[string]string) *OauthFlowsDefsImplicit
WithScopes sets Scopes value.
func (*OauthFlowsDefsImplicit) WithScopesItem ¶
func (o *OauthFlowsDefsImplicit) WithScopesItem(key string, val string) *OauthFlowsDefsImplicit
WithScopesItem sets Scopes item value.
type OauthFlowsDefsPassword ¶
type OauthFlowsDefsPassword struct { // Format: uri. // Required. TokenURL string `json:"tokenUrl"` RefreshURL *string `json:"refreshUrl,omitempty"` // Format: uri. Scopes map[string]string `json:"scopes"` // Required. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
OauthFlowsDefsPassword structure is generated from "#/$defs/oauth-flows/$defs/password".
func (OauthFlowsDefsPassword) MarshalJSON ¶
func (o OauthFlowsDefsPassword) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*OauthFlowsDefsPassword) UnmarshalJSON ¶
func (o *OauthFlowsDefsPassword) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*OauthFlowsDefsPassword) WithMapOfAnything ¶
func (o *OauthFlowsDefsPassword) WithMapOfAnything(val map[string]interface{}) *OauthFlowsDefsPassword
WithMapOfAnything sets MapOfAnything value.
func (*OauthFlowsDefsPassword) WithMapOfAnythingItem ¶
func (o *OauthFlowsDefsPassword) WithMapOfAnythingItem(key string, val interface{}) *OauthFlowsDefsPassword
WithMapOfAnythingItem sets MapOfAnything item value.
func (*OauthFlowsDefsPassword) WithRefreshURL ¶
func (o *OauthFlowsDefsPassword) WithRefreshURL(val string) *OauthFlowsDefsPassword
WithRefreshURL sets RefreshURL value.
func (*OauthFlowsDefsPassword) WithScopes ¶
func (o *OauthFlowsDefsPassword) WithScopes(val map[string]string) *OauthFlowsDefsPassword
WithScopes sets Scopes value.
func (*OauthFlowsDefsPassword) WithScopesItem ¶
func (o *OauthFlowsDefsPassword) WithScopesItem(key string, val string) *OauthFlowsDefsPassword
WithScopesItem sets Scopes item value.
func (*OauthFlowsDefsPassword) WithTokenURL ¶
func (o *OauthFlowsDefsPassword) WithTokenURL(val string) *OauthFlowsDefsPassword
WithTokenURL sets TokenURL 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 []ParameterOrReference `json:"parameters,omitempty"` RequestBody *RequestBodyOrReference `json:"requestBody,omitempty"` Responses *Responses `json:"responses,omitempty"` Callbacks map[string]CallbacksOrReference `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 "#/$defs/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() *RequestBodyOrReference
RequestBodyEns ensures returned RequestBody is not nil.
func (*Operation) ResponsesEns ¶
ResponsesEns ensures returned Responses 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]CallbacksOrReference) *Operation
WithCallbacks sets Callbacks value.
func (*Operation) WithCallbacksItem ¶
func (o *Operation) WithCallbacksItem(key string, val CallbacksOrReference) *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 ...ParameterOrReference) *Operation
WithParameters sets Parameters value.
func (*Operation) WithRequestBody ¶
func (o *Operation) WithRequestBody(val RequestBodyOrReference) *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 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"` Schema map[string]interface{} `json:"schema,omitempty"` Content map[string]MediaType `json:"content,omitempty"` Style *ParameterStyle `json:"style,omitempty"` Explode *bool `json:"explode,omitempty"` Example *interface{} `json:"example,omitempty"` Examples map[string]ExampleOrReference `json:"examples,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Parameter structure is generated from "#/$defs/parameter".
func (Parameter) MarshalJSON ¶
MarshalJSON encodes JSON.
func (Parameter) ToParameterOrRef ¶
func (p Parameter) ToParameterOrRef() ParameterOrReference
ToParameterOrRef exposes Parameter in general form.
func (*Parameter) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
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]ExampleOrReference) *Parameter
WithExamples sets Examples value.
func (*Parameter) WithExamplesItem ¶
func (p *Parameter) WithExamplesItem(key string, val ExampleOrReference) *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) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Parameter) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Parameter) WithRequired ¶
WithRequired sets Required value.
func (*Parameter) WithSchema ¶
WithSchema sets Schema value.
func (*Parameter) WithSchemaItem ¶
WithSchemaItem sets Schema item value.
func (*Parameter) WithStyle ¶
func (p *Parameter) WithStyle(val ParameterStyle) *Parameter
WithStyle sets Style value.
type ParameterIn ¶
type ParameterIn string
ParameterIn is an enum type.
func (ParameterIn) MarshalJSON ¶
func (i ParameterIn) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*ParameterIn) UnmarshalJSON ¶
func (i *ParameterIn) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
type ParameterOrReference ¶
type ParameterOrReference struct { Reference *Reference `json:"-"` Parameter *Parameter `json:"-"` }
ParameterOrReference structure is generated from "#/$defs/parameter-or-reference".
func (ParameterOrReference) MarshalJSON ¶
func (p ParameterOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*ParameterOrReference) ParameterEns ¶
func (p *ParameterOrReference) ParameterEns() *Parameter
ParameterEns ensures returned Parameter is not nil.
func (*ParameterOrReference) ReferenceEns ¶
func (p *ParameterOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*ParameterOrReference) UnmarshalJSON ¶
func (p *ParameterOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*ParameterOrReference) WithParameter ¶
func (p *ParameterOrReference) WithParameter(val Parameter) *ParameterOrReference
WithParameter sets Parameter value.
func (*ParameterOrReference) WithReference ¶
func (p *ParameterOrReference) WithReference(val Reference) *ParameterOrReference
WithReference sets Reference value.
type ParameterStyle ¶
type ParameterStyle string
ParameterStyle is an enum type.
func (ParameterStyle) MarshalJSON ¶
func (i ParameterStyle) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*ParameterStyle) UnmarshalJSON ¶
func (i *ParameterStyle) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
type PathItem ¶
type PathItem struct { Summary *string `json:"summary,omitempty"` Description *string `json:"description,omitempty"` Servers []Server `json:"servers,omitempty"` Parameters []ParameterOrReference `json:"parameters,omitempty"` Get *Operation `json:"get,omitempty"` Put *Operation `json:"put,omitempty"` Post *Operation `json:"post,omitempty"` Delete *Operation `json:"delete,omitempty"` Options *Operation `json:"options,omitempty"` Head *Operation `json:"head,omitempty"` Patch *Operation `json:"patch,omitempty"` Trace *Operation `json:"trace,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
PathItem structure is generated from "#/$defs/path-item".
func (PathItem) MarshalJSON ¶
MarshalJSON encodes JSON.
func (*PathItem) OptionsEns ¶
OptionsEns ensures returned Options is not nil.
func (*PathItem) SetOperation ¶
SetOperation sets a method Operation to PathItem.
func (*PathItem) UnmarshalJSON ¶
UnmarshalJSON decodes JSON.
func (*PathItem) WithDelete ¶
WithDelete sets Delete value.
func (*PathItem) WithDescription ¶
WithDescription sets Description value.
func (*PathItem) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*PathItem) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*PathItem) WithOptions ¶
WithOptions sets Options value.
func (*PathItem) WithParameters ¶
func (p *PathItem) WithParameters(val ...ParameterOrReference) *PathItem
WithParameters sets Parameters value.
func (*PathItem) WithServers ¶
WithServers sets Servers value.
func (*PathItem) WithSummary ¶
WithSummary sets Summary value.
type PathItemOrReference ¶
PathItemOrReference structure is generated from "#/$defs/path-item-or-reference".
func (PathItemOrReference) MarshalJSON ¶
func (p PathItemOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*PathItemOrReference) PathItemEns ¶
func (p *PathItemOrReference) PathItemEns() *PathItem
PathItemEns ensures returned PathItem is not nil.
func (*PathItemOrReference) ReferenceEns ¶
func (p *PathItemOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*PathItemOrReference) UnmarshalJSON ¶
func (p *PathItemOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*PathItemOrReference) WithPathItem ¶
func (p *PathItemOrReference) WithPathItem(val PathItem) *PathItemOrReference
WithPathItem sets PathItem value.
func (*PathItemOrReference) WithReference ¶
func (p *PathItemOrReference) WithReference(val Reference) *PathItemOrReference
WithReference sets Reference value.
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 "#/$defs/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 Reference ¶
type Reference struct { // Format: uri-reference. // Required. Ref string `json:"$ref"` Summary *string `json:"summary,omitempty"` Description *string `json:"description,omitempty"` }
Reference structure is generated from "#/$defs/reference".
func (*Reference) UnmarshalJSON ¶ added in v0.2.40
UnmarshalJSON decodes JSON.
func (*Reference) WithDescription ¶
WithDescription sets Description value.
func (*Reference) WithSummary ¶
WithSummary sets Summary value.
type Reflector ¶
type Reflector struct { jsonschema.Reflector Spec *Spec }
Reflector builds OpenAPI Schema with reflected structures.
Example (Options) ¶
r := openapi31.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.1.0","info":{"title":"","version":""}, "paths":{ "/foo":{ "post":{ "requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Openapi31TestReq"}}}}, "responses":{"204":{"description":"No Content"}} } } }, "components":{"schemas":{"Openapi31TestReq":{"properties":{"foo":{"items":{"type":"integer"},"type":"array"}},"type":"object"}}} }
func NewReflector ¶
func NewReflector() *Reflector
NewReflector creates an instance of OpenAPI 3.1 reflector.
func (*Reflector) AddOperation ¶
AddOperation configures operation request and response schema.
Example ¶
reflector := openapi31.NewReflector() 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.1.0 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: examples: - XXX-XXXXX type: string responses: "200": content: application/json: schema: $ref: '#/components/schemas/Openapi31TestResp' 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: examples: - XXX-XXXXX type: string requestBody: content: application/json: schema: $ref: '#/components/schemas/Openapi31TestReq' responses: "200": content: application/json: schema: $ref: '#/components/schemas/Openapi31TestResp' description: OK "409": content: application/json: schema: items: $ref: '#/components/schemas/Openapi31TestResp' type: - "null" - array description: Conflict components: schemas: Openapi31TestReq: 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 Openapi31TestResp: properties: amount: minimum: 0 type: integer id: examples: - 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/swaggest/openapi-go/openapi31" ) func main() { reflector := openapi31.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.1.0 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/Openapi31TestJsonFilter' in: query name: json_filter - explode: true in: query name: deep_object_filter schema: $ref: '#/components/schemas/Openapi31TestDeepObjectFilter' style: deepObject - in: path name: id required: true schema: examples: - XXX-XXXXX type: string responses: "204": description: No Content components: schemas: Openapi31TestDeepObjectFilter: properties: baz: type: boolean deeper: properties: val: type: string type: object quux: type: number type: object Openapi31TestJsonFilter: 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) 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 "#/$defs/request-body".
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 RequestBodyOrReference ¶
type RequestBodyOrReference struct { Reference *Reference `json:"-"` RequestBody *RequestBody `json:"-"` }
RequestBodyOrReference structure is generated from "#/$defs/request-body-or-reference".
func (RequestBodyOrReference) MarshalJSON ¶
func (r RequestBodyOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*RequestBodyOrReference) ReferenceEns ¶
func (r *RequestBodyOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*RequestBodyOrReference) RequestBodyEns ¶
func (r *RequestBodyOrReference) RequestBodyEns() *RequestBody
RequestBodyEns ensures returned RequestBody is not nil.
func (*RequestBodyOrReference) SetReference ¶ added in v0.2.54
func (r *RequestBodyOrReference) SetReference(ref string)
SetReference sets a reference and discards existing content.
func (*RequestBodyOrReference) UnmarshalJSON ¶
func (r *RequestBodyOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*RequestBodyOrReference) WithReference ¶
func (r *RequestBodyOrReference) WithReference(val Reference) *RequestBodyOrReference
WithReference sets Reference value.
func (*RequestBodyOrReference) WithRequestBody ¶
func (r *RequestBodyOrReference) WithRequestBody(val RequestBody) *RequestBodyOrReference
WithRequestBody sets RequestBody value.
type Response ¶
type Response struct { Description string `json:"description"` // Required. Headers map[string]HeaderOrReference `json:"headers,omitempty"` Content map[string]MediaType `json:"content,omitempty"` Links map[string]LinkOrReference `json:"links,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Response structure is generated from "#/$defs/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]HeaderOrReference) *Response
WithHeaders sets Headers value.
func (*Response) WithHeadersItem ¶
func (r *Response) WithHeadersItem(key string, val HeaderOrReference) *Response
WithHeadersItem sets Headers item value.
func (*Response) WithLinks ¶
func (r *Response) WithLinks(val map[string]LinkOrReference) *Response
WithLinks sets Links value.
func (*Response) WithLinksItem ¶
func (r *Response) WithLinksItem(key string, val LinkOrReference) *Response
WithLinksItem sets Links item value.
func (*Response) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Response) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
type ResponseOrReference ¶
ResponseOrReference structure is generated from "#/$defs/response-or-reference".
func (ResponseOrReference) MarshalJSON ¶
func (r ResponseOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*ResponseOrReference) ReferenceEns ¶
func (r *ResponseOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*ResponseOrReference) ResponseEns ¶
func (r *ResponseOrReference) ResponseEns() *Response
ResponseEns ensures returned Response is not nil.
func (*ResponseOrReference) SetReference ¶ added in v0.2.54
func (r *ResponseOrReference) SetReference(ref string)
SetReference sets a reference and discards existing content.
func (*ResponseOrReference) UnmarshalJSON ¶
func (r *ResponseOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*ResponseOrReference) WithReference ¶
func (r *ResponseOrReference) WithReference(val Reference) *ResponseOrReference
WithReference sets Reference value.
func (*ResponseOrReference) WithResponse ¶
func (r *ResponseOrReference) WithResponse(val Response) *ResponseOrReference
WithResponse sets Response value.
type Responses ¶
type Responses struct { Default *ResponseOrReference `json:"default,omitempty"` MapOfResponseOrReferenceValues map[string]ResponseOrReference `json:"-"` // Key must match pattern: `^[1-5](?:[0-9]{2}|XX)$`. MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Responses structure is generated from "#/$defs/responses".
func (*Responses) DefaultEns ¶
func (r *Responses) DefaultEns() *ResponseOrReference
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 ResponseOrReference) *Responses
WithDefault sets Default value.
func (*Responses) WithMapOfAnything ¶
WithMapOfAnything sets MapOfAnything value.
func (*Responses) WithMapOfAnythingItem ¶
WithMapOfAnythingItem sets MapOfAnything item value.
func (*Responses) WithMapOfResponseOrReferenceValues ¶
func (r *Responses) WithMapOfResponseOrReferenceValues(val map[string]ResponseOrReference) *Responses
WithMapOfResponseOrReferenceValues sets MapOfResponseOrReferenceValues value.
func (*Responses) WithMapOfResponseOrReferenceValuesItem ¶
func (r *Responses) WithMapOfResponseOrReferenceValuesItem(key string, val ResponseOrReference) *Responses
WithMapOfResponseOrReferenceValuesItem sets MapOfResponseOrReferenceValues item value.
type SecurityScheme ¶
type SecurityScheme struct { Description *string `json:"description,omitempty"` APIKey *SecuritySchemeAPIKey `json:"-"` HTTP *SecuritySchemeHTTP `json:"-"` HTTPBearer *SecuritySchemeHTTPBearer `json:"-"` Oauth2 *SecuritySchemeOauth2 `json:"-"` Oidc *SecuritySchemeOidc `json:"-"` MutualTLS *MutualTLS `json:"-"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
SecurityScheme structure is generated from "#/$defs/security-scheme".
func (*SecurityScheme) APIKeyEns ¶
func (s *SecurityScheme) APIKeyEns() *SecuritySchemeAPIKey
APIKeyEns ensures returned APIKey is not nil.
func (*SecurityScheme) HTTPBearerEns ¶
func (s *SecurityScheme) HTTPBearerEns() *SecuritySchemeHTTPBearer
HTTPBearerEns ensures returned HTTPBearer is not nil.
func (*SecurityScheme) HTTPEns ¶
func (s *SecurityScheme) HTTPEns() *SecuritySchemeHTTP
HTTPEns ensures returned HTTP is not nil.
func (SecurityScheme) MarshalJSON ¶
func (s SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecurityScheme) MutualTLSEns ¶
func (s *SecurityScheme) MutualTLSEns() *MutualTLS
MutualTLSEns ensures returned MutualTLS is not nil.
func (*SecurityScheme) Oauth2Ens ¶
func (s *SecurityScheme) Oauth2Ens() *SecuritySchemeOauth2
Oauth2Ens ensures returned Oauth2 is not nil.
func (*SecurityScheme) OidcEns ¶
func (s *SecurityScheme) OidcEns() *SecuritySchemeOidc
OidcEns ensures returned Oidc is not nil.
func (*SecurityScheme) UnmarshalJSON ¶
func (s *SecurityScheme) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecurityScheme) WithAPIKey ¶
func (s *SecurityScheme) WithAPIKey(val SecuritySchemeAPIKey) *SecurityScheme
WithAPIKey sets APIKey value.
func (*SecurityScheme) WithDescription ¶
func (s *SecurityScheme) WithDescription(val string) *SecurityScheme
WithDescription sets Description value.
func (*SecurityScheme) WithHTTP ¶
func (s *SecurityScheme) WithHTTP(val SecuritySchemeHTTP) *SecurityScheme
WithHTTP sets HTTP value.
func (*SecurityScheme) WithHTTPBearer ¶
func (s *SecurityScheme) WithHTTPBearer(val SecuritySchemeHTTPBearer) *SecurityScheme
WithHTTPBearer sets HTTPBearer value.
func (*SecurityScheme) WithMapOfAnything ¶
func (s *SecurityScheme) WithMapOfAnything(val map[string]interface{}) *SecurityScheme
WithMapOfAnything sets MapOfAnything value.
func (*SecurityScheme) WithMapOfAnythingItem ¶
func (s *SecurityScheme) WithMapOfAnythingItem(key string, val interface{}) *SecurityScheme
WithMapOfAnythingItem sets MapOfAnything item value.
func (*SecurityScheme) WithMutualTLS ¶
func (s *SecurityScheme) WithMutualTLS(val MutualTLS) *SecurityScheme
WithMutualTLS sets MutualTLS value.
func (*SecurityScheme) WithOauth2 ¶
func (s *SecurityScheme) WithOauth2(val SecuritySchemeOauth2) *SecurityScheme
WithOauth2 sets Oauth2 value.
func (*SecurityScheme) WithOidc ¶
func (s *SecurityScheme) WithOidc(val SecuritySchemeOidc) *SecurityScheme
WithOidc sets Oidc value.
type SecuritySchemeAPIKey ¶
type SecuritySchemeAPIKey struct { Name string `json:"name"` // Required. In SecuritySchemeAPIKeyIn `json:"in"` // Required. }
SecuritySchemeAPIKey structure is generated from "#/$defs/security-scheme/$defs/type-apikey".
func (SecuritySchemeAPIKey) MarshalJSON ¶
func (s SecuritySchemeAPIKey) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeAPIKey) UnmarshalJSON ¶
func (s *SecuritySchemeAPIKey) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeAPIKey) WithIn ¶
func (s *SecuritySchemeAPIKey) WithIn(val SecuritySchemeAPIKeyIn) *SecuritySchemeAPIKey
WithIn sets In value.
func (*SecuritySchemeAPIKey) WithName ¶
func (s *SecuritySchemeAPIKey) WithName(val string) *SecuritySchemeAPIKey
WithName sets Name value.
type SecuritySchemeAPIKeyIn ¶
type SecuritySchemeAPIKeyIn string
SecuritySchemeAPIKeyIn is an enum type.
func (SecuritySchemeAPIKeyIn) MarshalJSON ¶
func (i SecuritySchemeAPIKeyIn) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeAPIKeyIn) UnmarshalJSON ¶
func (i *SecuritySchemeAPIKeyIn) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
type SecuritySchemeHTTP ¶
type SecuritySchemeHTTP struct {
Scheme string `json:"scheme"` // Required.
}
SecuritySchemeHTTP structure is generated from "#/$defs/security-scheme/$defs/type-http".
func (SecuritySchemeHTTP) MarshalJSON ¶
func (s SecuritySchemeHTTP) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeHTTP) UnmarshalJSON ¶
func (s *SecuritySchemeHTTP) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeHTTP) WithScheme ¶
func (s *SecuritySchemeHTTP) WithScheme(val string) *SecuritySchemeHTTP
WithScheme sets Scheme value.
type SecuritySchemeHTTPBearer ¶
type SecuritySchemeHTTPBearer struct { // Value must match pattern: `^[Bb][Ee][Aa][Rr][Ee][Rr]$`. // Required. Scheme string `json:"scheme"` BearerFormat *string `json:"bearerFormat,omitempty"` }
SecuritySchemeHTTPBearer structure is generated from "#/$defs/security-scheme/$defs/type-http-bearer".
func (SecuritySchemeHTTPBearer) MarshalJSON ¶
func (s SecuritySchemeHTTPBearer) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeHTTPBearer) UnmarshalJSON ¶
func (s *SecuritySchemeHTTPBearer) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeHTTPBearer) WithBearerFormat ¶
func (s *SecuritySchemeHTTPBearer) WithBearerFormat(val string) *SecuritySchemeHTTPBearer
WithBearerFormat sets BearerFormat value.
func (*SecuritySchemeHTTPBearer) WithScheme ¶
func (s *SecuritySchemeHTTPBearer) WithScheme(val string) *SecuritySchemeHTTPBearer
WithScheme sets Scheme value.
type SecuritySchemeOauth2 ¶
type SecuritySchemeOauth2 struct {
Flows OauthFlows `json:"flows"` // Required.
}
SecuritySchemeOauth2 structure is generated from "#/$defs/security-scheme/$defs/type-oauth2".
func (SecuritySchemeOauth2) MarshalJSON ¶
func (s SecuritySchemeOauth2) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeOauth2) UnmarshalJSON ¶
func (s *SecuritySchemeOauth2) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeOauth2) WithFlows ¶
func (s *SecuritySchemeOauth2) WithFlows(val OauthFlows) *SecuritySchemeOauth2
WithFlows sets Flows value.
type SecuritySchemeOidc ¶
type SecuritySchemeOidc struct { // Format: uri. // Required. OpenIDConnectURL string `json:"openIdConnectUrl"` }
SecuritySchemeOidc structure is generated from "#/$defs/security-scheme/$defs/type-oidc".
func (SecuritySchemeOidc) MarshalJSON ¶
func (s SecuritySchemeOidc) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeOidc) UnmarshalJSON ¶
func (s *SecuritySchemeOidc) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeOidc) WithOpenIDConnectURL ¶
func (s *SecuritySchemeOidc) WithOpenIDConnectURL(val string) *SecuritySchemeOidc
WithOpenIDConnectURL sets OpenIDConnectURL value.
type SecuritySchemeOrReference ¶
type SecuritySchemeOrReference struct { Reference *Reference `json:"-"` SecurityScheme *SecurityScheme `json:"-"` }
SecuritySchemeOrReference structure is generated from "#/$defs/security-scheme-or-reference".
func (SecuritySchemeOrReference) MarshalJSON ¶
func (s SecuritySchemeOrReference) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSON.
func (*SecuritySchemeOrReference) ReferenceEns ¶
func (s *SecuritySchemeOrReference) ReferenceEns() *Reference
ReferenceEns ensures returned Reference is not nil.
func (*SecuritySchemeOrReference) SecuritySchemeEns ¶
func (s *SecuritySchemeOrReference) SecuritySchemeEns() *SecurityScheme
SecuritySchemeEns ensures returned SecurityScheme is not nil.
func (*SecuritySchemeOrReference) UnmarshalJSON ¶
func (s *SecuritySchemeOrReference) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSON.
func (*SecuritySchemeOrReference) WithReference ¶
func (s *SecuritySchemeOrReference) WithReference(val Reference) *SecuritySchemeOrReference
WithReference sets Reference value.
func (*SecuritySchemeOrReference) WithSecurityScheme ¶
func (s *SecuritySchemeOrReference) WithSecurityScheme(val SecurityScheme) *SecuritySchemeOrReference
WithSecurityScheme sets SecurityScheme value.
type Server ¶
type Server struct { // Format: uri-reference. // Required. URL string `json:"url"` 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 "#/$defs/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 "#/$defs/server-variable".
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\.1\.\d+(-.+)?$`. // Required. Openapi string `json:"openapi"` Info Info `json:"info"` // Required. JSONSchemaDialect *string `json:"jsonSchemaDialect,omitempty"` // Format: uri. Servers []Server `json:"servers,omitempty"` Paths *Paths `json:"paths,omitempty"` Webhooks map[string]PathItemOrReference `json:"webhooks,omitempty"` Components *Components `json:"components,omitempty"` Security []map[string][]string `json:"security,omitempty"` Tags []Tag `json:"tags,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` MapOfAnything map[string]interface{} `json:"-"` // Key must match pattern: `^x-`. }
Spec structure is generated from "#".
The description of OpenAPI v3.1.x documents without schema validation, as defined by https://spec.openapis.org/oas/v3.1.0.
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 := openapi31.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.1.0 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 := openapi31.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.1.0 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 := openapi31.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.1.0 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.
func (*Spec) UnmarshalYAML ¶
UnmarshalYAML reads from YAML bytes.
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) WithJSONSchemaDialect ¶
WithJSONSchemaDialect sets JSONSchemaDialect 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.
func (*Spec) WithWebhooks ¶
func (s *Spec) WithWebhooks(val map[string]PathItemOrReference) *Spec
WithWebhooks sets Webhooks value.
func (*Spec) WithWebhooksItem ¶
func (s *Spec) WithWebhooksItem(key string, val PathItemOrReference) *Spec
WithWebhooksItem sets Webhooks item 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 "#/$defs/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.