openapi31

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Callback is a map of possible out-of-band callbacks related to the parent operation. https://spec.openapis.org/oas/v3.1.0#callback-object

func NewCallback

func NewCallback(paths map[string]*PathItem) *Callback

NewCallback creates a new Callback instance.

func (*Callback) MarshalFields

func (c *Callback) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Callback) MarshalJSON

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

func (*Callback) MarshalYAML

func (c *Callback) MarshalYAML() (interface{}, error)

func (*Callback) Paths

func (c *Callback) Paths() map[string]*PathItem

func (*Callback) SetPaths

func (c *Callback) SetPaths(paths map[string]*PathItem) error

type Components

type Components struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Components holds reusable objects for the specification. https://spec.openapis.org/oas/v3.1.0#components-object

func NewComponents

func NewComponents() *Components

NewComponents creates a new Components instance.

func (*Components) Callbacks

func (c *Components) Callbacks() map[string]*RefCallback

func (*Components) Examples

func (c *Components) Examples() map[string]*RefExample

func (*Components) Headers

func (c *Components) Headers() map[string]*RefHeader
func (c *Components) Links() map[string]*RefLink

func (*Components) MarshalFields

func (c *Components) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Components) MarshalJSON

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

func (*Components) MarshalYAML

func (c *Components) MarshalYAML() (interface{}, error)

func (*Components) MediaTypes

func (c *Components) MediaTypes() map[string]*RefMediaType

func (*Components) Parameters

func (c *Components) Parameters() map[string]*RefParameter

func (*Components) PathItems

func (c *Components) PathItems() map[string]*RefPathItem

func (*Components) RequestBodies

func (c *Components) RequestBodies() map[string]*RefRequestBody

func (*Components) Responses

func (c *Components) Responses() map[string]*RefResponse

func (*Components) Schemas

func (c *Components) Schemas() map[string]*RefSchema

func (*Components) SecuritySchemes

func (c *Components) SecuritySchemes() map[string]*RefSecurityScheme

func (*Components) SetCallbacks

func (c *Components) SetCallbacks(callbacks map[string]*RefCallback) error

func (*Components) SetExamples

func (c *Components) SetExamples(examples map[string]*RefExample) error

func (*Components) SetHeaders

func (c *Components) SetHeaders(headers map[string]*RefHeader) error
func (c *Components) SetLinks(links map[string]*RefLink) error

func (*Components) SetMediaTypes

func (c *Components) SetMediaTypes(mediaTypes map[string]*RefMediaType) error

func (*Components) SetParameters

func (c *Components) SetParameters(parameters map[string]*RefParameter) error

func (*Components) SetPathItems

func (c *Components) SetPathItems(pathItems map[string]*RefPathItem) error

func (*Components) SetProperty

func (c *Components) SetProperty(name string, value interface{})

SetProperty sets a named property on the Components. Used by parsers for post-construction field assignment.

func (*Components) SetRequestBodies

func (c *Components) SetRequestBodies(requestBodies map[string]*RefRequestBody) error

func (*Components) SetResponses

func (c *Components) SetResponses(responses map[string]*RefResponse) error

func (*Components) SetSchemas

func (c *Components) SetSchemas(schemas map[string]*RefSchema) error

func (*Components) SetSecuritySchemes

func (c *Components) SetSecuritySchemes(securitySchemes map[string]*RefSecurityScheme) error

type Contact

type Contact struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Contact provides contact information for the API. https://spec.openapis.org/oas/v3.1.0#contact-object

func NewContact

func NewContact(name, url, email string) *Contact

NewContact creates a new Contact instance.

func (*Contact) Email

func (c *Contact) Email() string

func (*Contact) MarshalFields

func (c *Contact) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Contact) MarshalJSON

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

func (*Contact) MarshalYAML

func (c *Contact) MarshalYAML() (interface{}, error)

func (*Contact) Name

func (c *Contact) Name() string

func (*Contact) SetEmail

func (c *Contact) SetEmail(email string) error

func (*Contact) SetName

func (c *Contact) SetName(name string) error

func (*Contact) SetURL

func (c *Contact) SetURL(url string) error

func (*Contact) URL

func (c *Contact) URL() string

type Discriminator

type Discriminator struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Discriminator is used for polymorphism support. https://spec.openapis.org/oas/v3.1.0#discriminator-object

func NewDiscriminator

func NewDiscriminator(propertyName string, mapping map[string]string) *Discriminator

NewDiscriminator creates a new Discriminator instance.

func (*Discriminator) DefaultMapping

func (d *Discriminator) DefaultMapping() string

func (*Discriminator) Mapping

func (d *Discriminator) Mapping() map[string]string

func (*Discriminator) MarshalFields

func (d *Discriminator) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Discriminator) MarshalJSON

func (d *Discriminator) MarshalJSON() ([]byte, error)

func (*Discriminator) MarshalYAML

func (d *Discriminator) MarshalYAML() (interface{}, error)

func (*Discriminator) PropertyName

func (d *Discriminator) PropertyName() string

func (*Discriminator) SetDefaultMapping

func (d *Discriminator) SetDefaultMapping(defaultMapping string) error

func (*Discriminator) SetMapping

func (d *Discriminator) SetMapping(mapping map[string]string) error

func (*Discriminator) SetPropertyName

func (d *Discriminator) SetPropertyName(propertyName string) error

type ElementBase

type ElementBase struct {
	VendorExtensions map[string]interface{} `json:"-" yaml:"-"`
	Trix             Trix                   `json:"-" yaml:"-"`
}

ElementBase is embedded in all v31 types to provide vendor extensions and library metadata.

type Encoding

type Encoding struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Encoding defines encoding for a single schema property. https://spec.openapis.org/oas/v3.1.0#encoding-object

func NewEncoding

func NewEncoding(contentType, style string, headers map[string]*RefHeader, explode *bool, allowReserved bool) *Encoding

NewEncoding creates a new Encoding instance.

func (*Encoding) AllowReserved

func (e *Encoding) AllowReserved() bool

func (*Encoding) ContentType

func (e *Encoding) ContentType() string

func (*Encoding) Encoding

func (e *Encoding) Encoding() map[string]*Encoding

func (*Encoding) Explode

func (e *Encoding) Explode() *bool

func (*Encoding) Headers

func (e *Encoding) Headers() map[string]*RefHeader

func (*Encoding) ItemEncoding

func (e *Encoding) ItemEncoding() *Encoding

func (*Encoding) MarshalFields

func (e *Encoding) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Encoding) MarshalJSON

func (e *Encoding) MarshalJSON() ([]byte, error)

func (*Encoding) MarshalYAML

func (e *Encoding) MarshalYAML() (interface{}, error)

func (*Encoding) PrefixEncoding

func (e *Encoding) PrefixEncoding() []*Encoding

func (*Encoding) SetAllowReserved

func (e *Encoding) SetAllowReserved(allowReserved bool) error

func (*Encoding) SetContentType

func (e *Encoding) SetContentType(contentType string) error

func (*Encoding) SetEncoding

func (e *Encoding) SetEncoding(encoding map[string]*Encoding) error

func (*Encoding) SetExplode

func (e *Encoding) SetExplode(explode *bool) error

func (*Encoding) SetHeaders

func (e *Encoding) SetHeaders(headers map[string]*RefHeader) error

func (*Encoding) SetItemEncoding

func (e *Encoding) SetItemEncoding(itemEncoding *Encoding) error

func (*Encoding) SetPrefixEncoding

func (e *Encoding) SetPrefixEncoding(prefixEncoding []*Encoding) error

func (*Encoding) SetStyle

func (e *Encoding) SetStyle(style string) error

func (*Encoding) Style

func (e *Encoding) Style() string

type Example

type Example struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Example represents an example of a media type. https://spec.openapis.org/oas/v3.1.0#example-object

func NewExample

func NewExample(summary, description string, value interface{}, externalValue string) *Example

NewExample creates a new Example instance.

func (*Example) DataValue

func (e *Example) DataValue() interface{}

func (*Example) Description

func (e *Example) Description() string

func (*Example) ExternalValue

func (e *Example) ExternalValue() string

func (*Example) MarshalFields

func (e *Example) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Example) MarshalJSON

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

func (*Example) MarshalYAML

func (e *Example) MarshalYAML() (interface{}, error)

func (*Example) SerializedValue

func (e *Example) SerializedValue() string

func (*Example) SetDataValue

func (e *Example) SetDataValue(dataValue interface{}) error

func (*Example) SetDescription

func (e *Example) SetDescription(description string) error

func (*Example) SetExternalValue

func (e *Example) SetExternalValue(externalValue string) error

func (*Example) SetSerializedValue

func (e *Example) SetSerializedValue(serializedValue string) error

func (*Example) SetSummary

func (e *Example) SetSummary(summary string) error

func (*Example) SetValue

func (e *Example) SetValue(value interface{}) error

func (*Example) Summary

func (e *Example) Summary() string

func (*Example) Value

func (e *Example) Value() interface{}

type ExternalDocumentation

type ExternalDocumentation struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

ExternalDocumentation allows referencing external documentation. https://spec.openapis.org/oas/v3.1.0#external-documentation-object

func NewExternalDocumentation

func NewExternalDocumentation(description, url string) *ExternalDocumentation

NewExternalDocumentation creates a new ExternalDocumentation instance.

func (*ExternalDocumentation) Description

func (e *ExternalDocumentation) Description() string

func (*ExternalDocumentation) MarshalFields

func (e *ExternalDocumentation) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*ExternalDocumentation) MarshalJSON

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

func (*ExternalDocumentation) MarshalYAML

func (e *ExternalDocumentation) MarshalYAML() (interface{}, error)

func (*ExternalDocumentation) SetDescription

func (e *ExternalDocumentation) SetDescription(description string) error

func (*ExternalDocumentation) SetURL

func (e *ExternalDocumentation) SetURL(url string) error

func (*ExternalDocumentation) URL

func (e *ExternalDocumentation) URL() string
type Header struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Header represents a Header Object. https://spec.openapis.org/oas/v3.1.0#header-object

func NewHeader

func NewHeader(f HeaderFields) *Header

NewHeader creates a new Header instance.

func (*Header) AllowEmptyValue

func (h *Header) AllowEmptyValue() bool

func (*Header) AllowReserved

func (h *Header) AllowReserved() bool

func (*Header) Content

func (h *Header) Content() map[string]*MediaType

func (*Header) Deprecated

func (h *Header) Deprecated() bool

func (*Header) Description

func (h *Header) Description() string

func (*Header) Example

func (h *Header) Example() interface{}

func (*Header) Examples

func (h *Header) Examples() map[string]*RefExample

func (*Header) Explode

func (h *Header) Explode() *bool

func (*Header) MarshalFields

func (h *Header) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Header) MarshalJSON

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

func (*Header) MarshalYAML

func (h *Header) MarshalYAML() (interface{}, error)

func (*Header) Required

func (h *Header) Required() bool

func (*Header) Schema

func (h *Header) Schema() *RefSchema

func (*Header) SetAllowEmptyValue

func (h *Header) SetAllowEmptyValue(allowEmptyValue bool) error

func (*Header) SetAllowReserved

func (h *Header) SetAllowReserved(allowReserved bool) error

func (*Header) SetContent

func (h *Header) SetContent(content map[string]*MediaType) error

func (*Header) SetDeprecated

func (h *Header) SetDeprecated(deprecated bool) error

func (*Header) SetDescription

func (h *Header) SetDescription(description string) error

func (*Header) SetExample

func (h *Header) SetExample(example interface{}) error

func (*Header) SetExamples

func (h *Header) SetExamples(examples map[string]*RefExample) error

func (*Header) SetExplode

func (h *Header) SetExplode(explode *bool) error

func (*Header) SetRequired

func (h *Header) SetRequired(required bool) error

func (*Header) SetSchema

func (h *Header) SetSchema(schema *RefSchema) error

func (*Header) SetStyle

func (h *Header) SetStyle(style string) error

func (*Header) Style

func (h *Header) Style() string

type HeaderFields

type HeaderFields struct {
	Description     string
	Required        bool
	Deprecated      bool
	AllowEmptyValue bool
	Style           string
	Explode         *bool
	AllowReserved   bool
	Schema          *RefSchema
	Example         interface{}
	Examples        map[string]*RefExample
	Content         map[string]*MediaType
}

HeaderFields holds all fields for constructing a Header.

type Info

type Info struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Info provides metadata about the API. https://spec.openapis.org/oas/v3.1.0#info-object

func NewInfo

func NewInfo(title, summary, description, termsOfService, version string, contact *Contact, license *License) *Info

NewInfo creates a new Info instance with all spec-defined fields.

func (*Info) Contact

func (i *Info) Contact() *Contact

func (*Info) Description

func (i *Info) Description() string

func (*Info) License

func (i *Info) License() *License

func (*Info) MarshalFields

func (i *Info) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Info) MarshalJSON

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

func (*Info) MarshalYAML

func (i *Info) MarshalYAML() (interface{}, error)

func (*Info) SetContact

func (i *Info) SetContact(contact *Contact) error

func (*Info) SetDescription

func (i *Info) SetDescription(description string) error

func (*Info) SetLicense

func (i *Info) SetLicense(license *License) error

func (*Info) SetSummary

func (i *Info) SetSummary(summary string) error

func (*Info) SetTermsOfService

func (i *Info) SetTermsOfService(termsOfService string) error

func (*Info) SetTitle

func (i *Info) SetTitle(title string) error

func (*Info) SetVersion

func (i *Info) SetVersion(version string) error

func (*Info) Summary

func (i *Info) Summary() string

func (*Info) TermsOfService

func (i *Info) TermsOfService() string

func (*Info) Title

func (i *Info) Title() string

func (*Info) Version

func (i *Info) Version() string

type License

type License struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

License provides license information for the API. https://spec.openapis.org/oas/v3.1.0#license-object

func NewLicense

func NewLicense(name, identifier, url string) *License

NewLicense creates a new License instance.

func (*License) Identifier

func (l *License) Identifier() string

func (*License) MarshalFields

func (l *License) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*License) MarshalJSON

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

func (*License) MarshalYAML

func (l *License) MarshalYAML() (interface{}, error)

func (*License) Name

func (l *License) Name() string

func (*License) SetIdentifier

func (l *License) SetIdentifier(identifier string) error

func (*License) SetName

func (l *License) SetName(name string) error

func (*License) SetURL

func (l *License) SetURL(url string) error

func (*License) URL

func (l *License) URL() string
type Link struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Link represents a possible design-time link for a response. https://spec.openapis.org/oas/v3.1.0#link-object

func NewLink(operationRef, operationID, description string, parameters map[string]interface{}, requestBody interface{}, server *Server) *Link

NewLink creates a new Link instance.

func (*Link) Description

func (l *Link) Description() string

func (*Link) MarshalFields

func (l *Link) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Link) MarshalJSON

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

func (*Link) MarshalYAML

func (l *Link) MarshalYAML() (interface{}, error)

func (*Link) OperationID

func (l *Link) OperationID() string

func (*Link) OperationRef

func (l *Link) OperationRef() string

func (*Link) Parameters

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

func (*Link) RequestBody

func (l *Link) RequestBody() interface{}

func (*Link) Server

func (l *Link) Server() *Server

func (*Link) SetDescription

func (l *Link) SetDescription(description string) error

func (*Link) SetOperationID

func (l *Link) SetOperationID(operationID string) error

func (*Link) SetOperationRef

func (l *Link) SetOperationRef(operationRef string) error

func (*Link) SetParameters

func (l *Link) SetParameters(parameters map[string]interface{}) error

func (*Link) SetRequestBody

func (l *Link) SetRequestBody(requestBody interface{}) error

func (*Link) SetServer

func (l *Link) SetServer(server *Server) error

type Location

type Location = shared.Location

Location represents a position in the source file.

type MediaType

type MediaType struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

MediaType provides schema and examples for a media type. https://spec.openapis.org/oas/v3.1.0#media-type-object

func NewMediaType

func NewMediaType(schema *RefSchema, example interface{}, examples map[string]*RefExample, encoding map[string]*Encoding) *MediaType

NewMediaType creates a new MediaType instance.

func (*MediaType) Description

func (m *MediaType) Description() string

func (*MediaType) Encoding

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

func (*MediaType) Example

func (m *MediaType) Example() interface{}

func (*MediaType) Examples

func (m *MediaType) Examples() map[string]*RefExample

func (*MediaType) ItemEncoding

func (m *MediaType) ItemEncoding() *Encoding

func (*MediaType) ItemSchema

func (m *MediaType) ItemSchema() *RefSchema

func (*MediaType) MarshalFields

func (m *MediaType) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*MediaType) MarshalJSON

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

func (*MediaType) MarshalYAML

func (m *MediaType) MarshalYAML() (interface{}, error)

func (*MediaType) PrefixEncoding

func (m *MediaType) PrefixEncoding() []*Encoding

func (*MediaType) Schema

func (m *MediaType) Schema() *RefSchema

func (*MediaType) SetDescription

func (m *MediaType) SetDescription(description string) error

func (*MediaType) SetEncoding

func (m *MediaType) SetEncoding(encoding map[string]*Encoding) error

func (*MediaType) SetExample

func (m *MediaType) SetExample(example interface{}) error

func (*MediaType) SetExamples

func (m *MediaType) SetExamples(examples map[string]*RefExample) error

func (*MediaType) SetItemEncoding

func (m *MediaType) SetItemEncoding(itemEncoding *Encoding) error

func (*MediaType) SetItemSchema

func (m *MediaType) SetItemSchema(itemSchema *RefSchema) error

func (*MediaType) SetPrefixEncoding

func (m *MediaType) SetPrefixEncoding(prefixEncoding []*Encoding) error

func (*MediaType) SetSchema

func (m *MediaType) SetSchema(schema *RefSchema) error

type NodeSource

type NodeSource = shared.NodeSource

NodeSource contains source location and raw parsed data for a node.

type OAuthFlow

type OAuthFlow struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

OAuthFlow represents configuration for an OAuth flow. https://spec.openapis.org/oas/v3.1.0#oauth-flow-object

func NewOAuthFlow

func NewOAuthFlow(authorizationURL, tokenURL, refreshURL string, scopes map[string]string) *OAuthFlow

NewOAuthFlow creates a new OAuthFlow instance.

func (*OAuthFlow) AuthorizationURL

func (f *OAuthFlow) AuthorizationURL() string

func (*OAuthFlow) DeviceAuthorizationURL

func (f *OAuthFlow) DeviceAuthorizationURL() string

func (*OAuthFlow) MarshalFields

func (f *OAuthFlow) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*OAuthFlow) MarshalJSON

func (f *OAuthFlow) MarshalJSON() ([]byte, error)

func (*OAuthFlow) MarshalYAML

func (f *OAuthFlow) MarshalYAML() (interface{}, error)

func (*OAuthFlow) RefreshURL

func (f *OAuthFlow) RefreshURL() string

func (*OAuthFlow) Scopes

func (f *OAuthFlow) Scopes() map[string]string

func (*OAuthFlow) SetAuthorizationURL

func (f *OAuthFlow) SetAuthorizationURL(authorizationURL string) error

func (*OAuthFlow) SetDeviceAuthorizationURL

func (f *OAuthFlow) SetDeviceAuthorizationURL(deviceAuthorizationURL string) error

func (*OAuthFlow) SetRefreshURL

func (f *OAuthFlow) SetRefreshURL(refreshURL string) error

func (*OAuthFlow) SetScopes

func (f *OAuthFlow) SetScopes(scopes map[string]string) error

func (*OAuthFlow) SetTokenURL

func (f *OAuthFlow) SetTokenURL(tokenURL string) error

func (*OAuthFlow) TokenURL

func (f *OAuthFlow) TokenURL() string

type OAuthFlows

type OAuthFlows struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

OAuthFlows allows configuration of supported OAuth flows. https://spec.openapis.org/oas/v3.1.0#oauth-flows-object

func NewOAuthFlows

func NewOAuthFlows(implicit, password, clientCredentials, authorizationCode *OAuthFlow) *OAuthFlows

NewOAuthFlows creates a new OAuthFlows instance.

func (*OAuthFlows) AuthorizationCode

func (f *OAuthFlows) AuthorizationCode() *OAuthFlow

func (*OAuthFlows) ClientCredentials

func (f *OAuthFlows) ClientCredentials() *OAuthFlow

func (*OAuthFlows) DeviceAuthorization

func (f *OAuthFlows) DeviceAuthorization() *OAuthFlow

func (*OAuthFlows) Implicit

func (f *OAuthFlows) Implicit() *OAuthFlow

func (*OAuthFlows) MarshalFields

func (f *OAuthFlows) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*OAuthFlows) MarshalJSON

func (f *OAuthFlows) MarshalJSON() ([]byte, error)

func (*OAuthFlows) MarshalYAML

func (f *OAuthFlows) MarshalYAML() (interface{}, error)

func (*OAuthFlows) Password

func (f *OAuthFlows) Password() *OAuthFlow

func (*OAuthFlows) SetAuthorizationCode

func (f *OAuthFlows) SetAuthorizationCode(authorizationCode *OAuthFlow) error

func (*OAuthFlows) SetClientCredentials

func (f *OAuthFlows) SetClientCredentials(clientCredentials *OAuthFlow) error

func (*OAuthFlows) SetDeviceAuthorization

func (f *OAuthFlows) SetDeviceAuthorization(deviceAuthorization *OAuthFlow) error

func (*OAuthFlows) SetImplicit

func (f *OAuthFlows) SetImplicit(implicit *OAuthFlow) error

func (*OAuthFlows) SetPassword

func (f *OAuthFlows) SetPassword(password *OAuthFlow) error

type OpenAPI

type OpenAPI struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

OpenAPI is the root document object of the OpenAPI specification. https://spec.openapis.org/oas/v3.1.0#openapi-object

func NewOpenAPI

func NewOpenAPI(version string, info *Info) *OpenAPI

NewOpenAPI creates a new OpenAPI root document instance.

func (*OpenAPI) Components

func (o *OpenAPI) Components() *Components

func (*OpenAPI) ExternalDocs

func (o *OpenAPI) ExternalDocs() *ExternalDocumentation

func (*OpenAPI) Info

func (o *OpenAPI) Info() *Info

func (*OpenAPI) JsonSchemaDialect

func (o *OpenAPI) JsonSchemaDialect() string

func (*OpenAPI) MarshalFields

func (o *OpenAPI) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*OpenAPI) MarshalJSON

func (o *OpenAPI) MarshalJSON() ([]byte, error)

func (*OpenAPI) MarshalYAML

func (o *OpenAPI) MarshalYAML() (interface{}, error)

func (*OpenAPI) OpenAPIVersion

func (o *OpenAPI) OpenAPIVersion() string

func (*OpenAPI) Paths

func (o *OpenAPI) Paths() *Paths

func (*OpenAPI) Security

func (o *OpenAPI) Security() []SecurityRequirement

func (*OpenAPI) Self

func (o *OpenAPI) Self() string

func (*OpenAPI) Servers

func (o *OpenAPI) Servers() []*Server

func (*OpenAPI) SetComponents

func (o *OpenAPI) SetComponents(components *Components) error

func (*OpenAPI) SetExternalDocs

func (o *OpenAPI) SetExternalDocs(externalDocs *ExternalDocumentation) error

func (*OpenAPI) SetInfo

func (o *OpenAPI) SetInfo(info *Info) error

func (*OpenAPI) SetJsonSchemaDialect

func (o *OpenAPI) SetJsonSchemaDialect(jsonSchemaDialect string) error

func (*OpenAPI) SetOpenAPIVersion

func (o *OpenAPI) SetOpenAPIVersion(openAPI string) error

func (*OpenAPI) SetPaths

func (o *OpenAPI) SetPaths(paths *Paths) error

func (*OpenAPI) SetProperty

func (o *OpenAPI) SetProperty(name string, value interface{})

SetProperty sets a named property on the OpenAPI document. Used by parsers for post-construction field assignment.

func (*OpenAPI) SetSecurity

func (o *OpenAPI) SetSecurity(security []SecurityRequirement) error

func (*OpenAPI) SetSelf

func (o *OpenAPI) SetSelf(self string) error

func (*OpenAPI) SetServers

func (o *OpenAPI) SetServers(servers []*Server) error

func (*OpenAPI) SetTags

func (o *OpenAPI) SetTags(tags []*Tag) error

func (*OpenAPI) SetWebhooks

func (o *OpenAPI) SetWebhooks(webhooks map[string]*RefPathItem) error

func (*OpenAPI) Tags

func (o *OpenAPI) Tags() []*Tag

func (*OpenAPI) Webhooks

func (o *OpenAPI) Webhooks() map[string]*RefPathItem

type Operation

type Operation struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Operation describes a single API operation on a path. https://spec.openapis.org/oas/v3.1.0#operation-object

func NewOperation

func NewOperation() *Operation

NewOperation creates a new Operation instance.

func (*Operation) Callbacks

func (o *Operation) Callbacks() map[string]*RefCallback

func (*Operation) Deprecated

func (o *Operation) Deprecated() bool

func (*Operation) Description

func (o *Operation) Description() string

func (*Operation) ExternalDocs

func (o *Operation) ExternalDocs() *ExternalDocumentation

func (*Operation) MarshalFields

func (o *Operation) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Operation) MarshalJSON

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

func (*Operation) MarshalYAML

func (o *Operation) MarshalYAML() (interface{}, error)

func (*Operation) OperationID

func (o *Operation) OperationID() string

func (*Operation) Parameters

func (o *Operation) Parameters() []*RefParameter

func (*Operation) RequestBody

func (o *Operation) RequestBody() *RefRequestBody

func (*Operation) Responses

func (o *Operation) Responses() *Responses

func (*Operation) Security

func (o *Operation) Security() []SecurityRequirement

func (*Operation) Servers

func (o *Operation) Servers() []*Server

func (*Operation) SetCallbacks

func (o *Operation) SetCallbacks(callbacks map[string]*RefCallback) error

func (*Operation) SetDeprecated

func (o *Operation) SetDeprecated(deprecated bool) error

func (*Operation) SetDescription

func (o *Operation) SetDescription(description string) error

func (*Operation) SetExternalDocs

func (o *Operation) SetExternalDocs(externalDocs *ExternalDocumentation) error

func (*Operation) SetOperationID

func (o *Operation) SetOperationID(operationID string) error

func (*Operation) SetParameters

func (o *Operation) SetParameters(parameters []*RefParameter) error

func (*Operation) SetProperty

func (o *Operation) SetProperty(name string, value interface{})

SetProperty sets a named property on the Operation. Used by parsers for post-construction field assignment.

func (*Operation) SetRequestBody

func (o *Operation) SetRequestBody(requestBody *RefRequestBody) error

func (*Operation) SetResponses

func (o *Operation) SetResponses(responses *Responses) error

func (*Operation) SetSecurity

func (o *Operation) SetSecurity(security []SecurityRequirement) error

func (*Operation) SetServers

func (o *Operation) SetServers(servers []*Server) error

func (*Operation) SetSummary

func (o *Operation) SetSummary(summary string) error

func (*Operation) SetTags

func (o *Operation) SetTags(tags []string) error

func (*Operation) Summary

func (o *Operation) Summary() string

func (*Operation) Tags

func (o *Operation) Tags() []string

type Parameter

type Parameter struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Parameter describes a single operation parameter. https://spec.openapis.org/oas/v3.1.0#parameter-object

func NewParameter

func NewParameter(f ParameterFields) *Parameter

NewParameter creates a new Parameter instance.

func (*Parameter) AllowEmptyValue

func (p *Parameter) AllowEmptyValue() bool

func (*Parameter) AllowReserved

func (p *Parameter) AllowReserved() bool

func (*Parameter) Content

func (p *Parameter) Content() map[string]*MediaType

func (*Parameter) Deprecated

func (p *Parameter) Deprecated() bool

func (*Parameter) Description

func (p *Parameter) Description() string

func (*Parameter) Example

func (p *Parameter) Example() interface{}

func (*Parameter) Examples

func (p *Parameter) Examples() map[string]*RefExample

func (*Parameter) Explode

func (p *Parameter) Explode() *bool

func (*Parameter) In

func (p *Parameter) In() string

func (*Parameter) MarshalFields

func (p *Parameter) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Parameter) MarshalJSON

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

func (*Parameter) MarshalYAML

func (p *Parameter) MarshalYAML() (interface{}, error)

func (*Parameter) Name

func (p *Parameter) Name() string

func (*Parameter) Required

func (p *Parameter) Required() bool

func (*Parameter) Schema

func (p *Parameter) Schema() *RefSchema

func (*Parameter) SetAllowEmptyValue

func (p *Parameter) SetAllowEmptyValue(allowEmptyValue bool) error

func (*Parameter) SetAllowReserved

func (p *Parameter) SetAllowReserved(allowReserved bool) error

func (*Parameter) SetContent

func (p *Parameter) SetContent(content map[string]*MediaType) error

func (*Parameter) SetDeprecated

func (p *Parameter) SetDeprecated(deprecated bool) error

func (*Parameter) SetDescription

func (p *Parameter) SetDescription(description string) error

func (*Parameter) SetExample

func (p *Parameter) SetExample(example interface{}) error

func (*Parameter) SetExamples

func (p *Parameter) SetExamples(examples map[string]*RefExample) error

func (*Parameter) SetExplode

func (p *Parameter) SetExplode(explode *bool) error

func (*Parameter) SetIn

func (p *Parameter) SetIn(in string) error

func (*Parameter) SetName

func (p *Parameter) SetName(name string) error

func (*Parameter) SetRequired

func (p *Parameter) SetRequired(required bool) error

func (*Parameter) SetSchema

func (p *Parameter) SetSchema(schema *RefSchema) error

func (*Parameter) SetStyle

func (p *Parameter) SetStyle(style string) error

func (*Parameter) Style

func (p *Parameter) Style() string

type ParameterFields

type ParameterFields struct {
	Name            string
	In              string
	Description     string
	Required        bool
	Deprecated      bool
	AllowEmptyValue bool
	Style           string
	Explode         *bool
	AllowReserved   bool
	Schema          *RefSchema
	Example         interface{}
	Examples        map[string]*RefExample
	Content         map[string]*MediaType
}

ParameterFields holds all fields for constructing a Parameter.

type ParseError

type ParseError = shared.ParseError

ParseError represents a parsing error associated with a specific node.

type PathItem

type PathItem struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

PathItem describes operations available on a single path. https://spec.openapis.org/oas/v3.1.0#path-item-object

func NewPathItem

func NewPathItem() *PathItem

NewPathItem creates a new PathItem instance.

func (*PathItem) AdditionalOperations

func (p *PathItem) AdditionalOperations() map[string]*Operation

func (*PathItem) Delete

func (p *PathItem) Delete() *Operation

func (*PathItem) Description

func (p *PathItem) Description() string

func (*PathItem) Get

func (p *PathItem) Get() *Operation

func (*PathItem) Head

func (p *PathItem) Head() *Operation

func (*PathItem) MarshalFields

func (p *PathItem) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*PathItem) MarshalJSON

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

func (*PathItem) MarshalYAML

func (p *PathItem) MarshalYAML() (interface{}, error)

func (*PathItem) Options

func (p *PathItem) Options() *Operation

func (*PathItem) Parameters

func (p *PathItem) Parameters() []*RefParameter

func (*PathItem) Patch

func (p *PathItem) Patch() *Operation

func (*PathItem) Post

func (p *PathItem) Post() *Operation

func (*PathItem) Put

func (p *PathItem) Put() *Operation

func (*PathItem) Query

func (p *PathItem) Query() *Operation

func (*PathItem) Ref

func (p *PathItem) Ref() string

func (*PathItem) Servers

func (p *PathItem) Servers() []*Server

func (*PathItem) SetAdditionalOperations

func (p *PathItem) SetAdditionalOperations(additionalOperations map[string]*Operation) error

func (*PathItem) SetDelete

func (p *PathItem) SetDelete(delete *Operation) error

func (*PathItem) SetDescription

func (p *PathItem) SetDescription(description string) error

func (*PathItem) SetGet

func (p *PathItem) SetGet(get *Operation) error

func (*PathItem) SetHead

func (p *PathItem) SetHead(head *Operation) error

func (*PathItem) SetOptions

func (p *PathItem) SetOptions(options *Operation) error

func (*PathItem) SetParameters

func (p *PathItem) SetParameters(parameters []*RefParameter) error

func (*PathItem) SetPatch

func (p *PathItem) SetPatch(patch *Operation) error

func (*PathItem) SetPost

func (p *PathItem) SetPost(post *Operation) error

func (*PathItem) SetProperty

func (p *PathItem) SetProperty(name string, value interface{})

SetProperty sets a named property on the PathItem. Used by parsers for post-construction field assignment.

func (*PathItem) SetPut

func (p *PathItem) SetPut(put *Operation) error

func (*PathItem) SetQuery

func (p *PathItem) SetQuery(query *Operation) error

func (*PathItem) SetRef

func (p *PathItem) SetRef(ref string) error

func (*PathItem) SetServers

func (p *PathItem) SetServers(servers []*Server) error

func (*PathItem) SetSummary

func (p *PathItem) SetSummary(summary string) error

func (*PathItem) SetTrace

func (p *PathItem) SetTrace(trace *Operation) error

func (*PathItem) Summary

func (p *PathItem) Summary() string

func (*PathItem) Trace

func (p *PathItem) Trace() *Operation

type Paths

type Paths struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Paths holds the relative paths to individual endpoints. https://spec.openapis.org/oas/v3.1.0#paths-object

func NewPaths

func NewPaths(items map[string]*PathItem) *Paths

NewPaths creates a new Paths instance with the given items map.

func (*Paths) Items

func (p *Paths) Items() map[string]*PathItem

func (*Paths) MarshalFields

func (p *Paths) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Paths) MarshalJSON

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

func (*Paths) MarshalYAML

func (p *Paths) MarshalYAML() (interface{}, error)

func (*Paths) SetItems

func (p *Paths) SetItems(items map[string]*PathItem) error

type RefCallback

type RefCallback = shared.RefWithMeta[Callback]

func NewRefCallback

func NewRefCallback(ref string) *RefCallback

type RefExample

type RefExample = shared.RefWithMeta[Example]

func NewRefExample

func NewRefExample(ref string) *RefExample

type RefHeader

type RefHeader = shared.RefWithMeta[Header]

func NewRefHeader

func NewRefHeader(ref string) *RefHeader
type RefLink = shared.RefWithMeta[Link]
func NewRefLink(ref string) *RefLink

type RefMediaType

type RefMediaType = shared.RefWithMeta[MediaType]

func NewRefMediaType

func NewRefMediaType(ref string) *RefMediaType

type RefParameter

type RefParameter = shared.RefWithMeta[Parameter]

func NewRefParameter

func NewRefParameter(ref string) *RefParameter

type RefPathItem

type RefPathItem = shared.RefWithMeta[PathItem]

func NewRefPathItem

func NewRefPathItem(ref string) *RefPathItem

type RefRequestBody

type RefRequestBody = shared.RefWithMeta[RequestBody]

func NewRefRequestBody

func NewRefRequestBody(ref string) *RefRequestBody

type RefResponse

type RefResponse = shared.RefWithMeta[Response]

func NewRefResponse

func NewRefResponse(ref string) *RefResponse

type RefSchema

type RefSchema = shared.RefWithMeta[Schema]

RefWithMeta type aliases — use these instead of shared.RefWithMeta[T] throughout the package.

func NewRefSchema

func NewRefSchema(ref string) *RefSchema

type RefSecurityScheme

type RefSecurityScheme = shared.RefWithMeta[SecurityScheme]

func NewRefSecurityScheme

func NewRefSecurityScheme(ref string) *RefSecurityScheme

type RequestBody

type RequestBody struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

RequestBody describes a single request body. https://spec.openapis.org/oas/v3.1.0#request-body-object

func NewRequestBody

func NewRequestBody(description string, content map[string]*MediaType, required bool) *RequestBody

NewRequestBody creates a new RequestBody instance.

func (*RequestBody) Content

func (r *RequestBody) Content() map[string]*MediaType

func (*RequestBody) Description

func (r *RequestBody) Description() string

func (*RequestBody) MarshalFields

func (r *RequestBody) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*RequestBody) MarshalJSON

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

func (*RequestBody) MarshalYAML

func (r *RequestBody) MarshalYAML() (interface{}, error)

func (*RequestBody) Required

func (r *RequestBody) Required() bool

func (*RequestBody) SetContent

func (r *RequestBody) SetContent(content map[string]*MediaType) error

func (*RequestBody) SetDescription

func (r *RequestBody) SetDescription(description string) error

func (*RequestBody) SetRequired

func (r *RequestBody) SetRequired(required bool) error

type Response

type Response struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Response describes a single response from an API operation. https://spec.openapis.org/oas/v3.1.0#response-object

func NewResponse

func NewResponse(description string, headers map[string]*RefHeader, content map[string]*MediaType, links map[string]*RefLink) *Response

NewResponse creates a new Response instance.

func (*Response) Content

func (r *Response) Content() map[string]*MediaType

func (*Response) Description

func (r *Response) Description() string

func (*Response) Headers

func (r *Response) Headers() map[string]*RefHeader
func (r *Response) Links() map[string]*RefLink

func (*Response) MarshalFields

func (r *Response) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Response) MarshalJSON

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

func (*Response) MarshalYAML

func (r *Response) MarshalYAML() (interface{}, error)

func (*Response) SetContent

func (r *Response) SetContent(content map[string]*MediaType) error

func (*Response) SetDescription

func (r *Response) SetDescription(description string) error

func (*Response) SetHeaders

func (r *Response) SetHeaders(headers map[string]*RefHeader) error
func (r *Response) SetLinks(links map[string]*RefLink) error

func (*Response) SetSummary

func (r *Response) SetSummary(summary string) error

func (*Response) Summary

func (r *Response) Summary() string

type Responses

type Responses struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Responses is a container for expected responses of an operation. https://spec.openapis.org/oas/v3.1.0#responses-object

func NewResponses

func NewResponses(defaultResp *RefResponse, codes map[string]*RefResponse) *Responses

NewResponses creates a new Responses instance.

func (*Responses) Codes

func (r *Responses) Codes() map[string]*RefResponse

func (*Responses) Default

func (r *Responses) Default() *RefResponse

func (*Responses) MarshalFields

func (r *Responses) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Responses) MarshalJSON

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

func (*Responses) MarshalYAML

func (r *Responses) MarshalYAML() (interface{}, error)

func (*Responses) SetCodes

func (r *Responses) SetCodes(codes map[string]*RefResponse) error

func (*Responses) SetDefault

func (r *Responses) SetDefault(defaultResp *RefResponse) error

type Schema

type Schema struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Schema represents the OpenAPI 3.1 Schema Object. Based on JSON Schema Draft 2020-12. https://spec.openapis.org/oas/v3.1.0#schema-object

func NewSchema

func NewSchema(f SchemaFields) *Schema

NewSchema creates a new Schema instance. Due to the large number of fields, callers should use SchemaFields.

func (*Schema) AdditionalProperties

func (s *Schema) AdditionalProperties() *RefSchema

func (*Schema) AdditionalPropertiesAllowed

func (s *Schema) AdditionalPropertiesAllowed() *bool

func (*Schema) AllOf

func (s *Schema) AllOf() []*RefSchema

func (*Schema) Anchor

func (s *Schema) Anchor() string

func (*Schema) AnyOf

func (s *Schema) AnyOf() []*RefSchema

func (*Schema) Const

func (s *Schema) Const() interface{}

func (*Schema) ContentEncoding

func (s *Schema) ContentEncoding() string

func (*Schema) ContentMediaType

func (s *Schema) ContentMediaType() string

func (*Schema) ContentSchema

func (s *Schema) ContentSchema() *RefSchema

func (*Schema) Default

func (s *Schema) Default() interface{}

func (*Schema) DependentSchemas

func (s *Schema) DependentSchemas() map[string]*RefSchema

func (*Schema) Deprecated

func (s *Schema) Deprecated() bool

func (*Schema) Description

func (s *Schema) Description() string

func (*Schema) Discriminator

func (s *Schema) Discriminator() *Discriminator

func (*Schema) DynamicAnchor

func (s *Schema) DynamicAnchor() string

func (*Schema) DynamicRef

func (s *Schema) DynamicRef() string

func (*Schema) Else

func (s *Schema) Else() *RefSchema

func (*Schema) Enum

func (s *Schema) Enum() []interface{}

func (*Schema) Example

func (s *Schema) Example() interface{}

func (*Schema) Examples

func (s *Schema) Examples() []interface{}

func (*Schema) ExclusiveMaximum

func (s *Schema) ExclusiveMaximum() *float64

func (*Schema) ExclusiveMinimum

func (s *Schema) ExclusiveMinimum() *float64

func (*Schema) ExternalDocs

func (s *Schema) ExternalDocs() *ExternalDocumentation

func (*Schema) Format

func (s *Schema) Format() string

func (*Schema) If

func (s *Schema) If() *RefSchema

func (*Schema) Items

func (s *Schema) Items() *RefSchema

func (*Schema) MarshalFields

func (s *Schema) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Schema) MarshalJSON

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

func (*Schema) MarshalYAML

func (s *Schema) MarshalYAML() (interface{}, error)

func (*Schema) MaxItems

func (s *Schema) MaxItems() *uint64

func (*Schema) MaxLength

func (s *Schema) MaxLength() *uint64

func (*Schema) MaxProperties

func (s *Schema) MaxProperties() *uint64

func (*Schema) Maximum

func (s *Schema) Maximum() *float64

func (*Schema) MinItems

func (s *Schema) MinItems() *uint64

func (*Schema) MinLength

func (s *Schema) MinLength() *uint64

func (*Schema) MinProperties

func (s *Schema) MinProperties() *uint64

func (*Schema) Minimum

func (s *Schema) Minimum() *float64

func (*Schema) MultipleOf

func (s *Schema) MultipleOf() *float64

func (*Schema) Not

func (s *Schema) Not() *RefSchema

func (*Schema) OneOf

func (s *Schema) OneOf() []*RefSchema

func (*Schema) Pattern

func (s *Schema) Pattern() string

func (*Schema) PrefixItems

func (s *Schema) PrefixItems() []*RefSchema

func (*Schema) Properties

func (s *Schema) Properties() map[string]*RefSchema

func (*Schema) ReadOnly

func (s *Schema) ReadOnly() bool

func (*Schema) Required

func (s *Schema) Required() []string

func (*Schema) SetAdditionalProperties

func (s *Schema) SetAdditionalProperties(additionalProperties *RefSchema) error

func (*Schema) SetAdditionalPropertiesAllowed

func (s *Schema) SetAdditionalPropertiesAllowed(additionalPropertiesAllowed *bool) error

func (*Schema) SetAllOf

func (s *Schema) SetAllOf(allOf []*RefSchema) error

func (*Schema) SetAnchor

func (s *Schema) SetAnchor(anchor string) error

func (*Schema) SetAnyOf

func (s *Schema) SetAnyOf(anyOf []*RefSchema) error

func (*Schema) SetConst

func (s *Schema) SetConst(constVal interface{}) error

func (*Schema) SetContentEncoding

func (s *Schema) SetContentEncoding(contentEncoding string) error

func (*Schema) SetContentMediaType

func (s *Schema) SetContentMediaType(contentMediaType string) error

func (*Schema) SetContentSchema

func (s *Schema) SetContentSchema(contentSchema *RefSchema) error

func (*Schema) SetDefault

func (s *Schema) SetDefault(defaultVal interface{}) error

func (*Schema) SetDependentSchemas

func (s *Schema) SetDependentSchemas(dependentSchemas map[string]*RefSchema) error

func (*Schema) SetDeprecated

func (s *Schema) SetDeprecated(deprecated bool) error

func (*Schema) SetDescription

func (s *Schema) SetDescription(description string) error

func (*Schema) SetDiscriminator

func (s *Schema) SetDiscriminator(discriminator *Discriminator) error

func (*Schema) SetDynamicAnchor

func (s *Schema) SetDynamicAnchor(dynamicAnchor string) error

func (*Schema) SetDynamicRef

func (s *Schema) SetDynamicRef(dynamicRef string) error

func (*Schema) SetElse

func (s *Schema) SetElse(elseSchema *RefSchema) error

func (*Schema) SetEnum

func (s *Schema) SetEnum(enum []interface{}) error

func (*Schema) SetExample

func (s *Schema) SetExample(example interface{}) error

func (*Schema) SetExamples

func (s *Schema) SetExamples(examples []interface{}) error

func (*Schema) SetExclusiveMaximum

func (s *Schema) SetExclusiveMaximum(exclusiveMaximum *float64) error

func (*Schema) SetExclusiveMinimum

func (s *Schema) SetExclusiveMinimum(exclusiveMinimum *float64) error

func (*Schema) SetExternalDocs

func (s *Schema) SetExternalDocs(externalDocs *ExternalDocumentation) error

func (*Schema) SetFormat

func (s *Schema) SetFormat(format string) error

func (*Schema) SetIf

func (s *Schema) SetIf(ifSchema *RefSchema) error

func (*Schema) SetItems

func (s *Schema) SetItems(items *RefSchema) error

func (*Schema) SetMaxItems

func (s *Schema) SetMaxItems(maxItems *uint64) error

func (*Schema) SetMaxLength

func (s *Schema) SetMaxLength(maxLength *uint64) error

func (*Schema) SetMaxProperties

func (s *Schema) SetMaxProperties(maxProperties *uint64) error

func (*Schema) SetMaximum

func (s *Schema) SetMaximum(maximum *float64) error

func (*Schema) SetMinItems

func (s *Schema) SetMinItems(minItems *uint64) error

func (*Schema) SetMinLength

func (s *Schema) SetMinLength(minLength *uint64) error

func (*Schema) SetMinProperties

func (s *Schema) SetMinProperties(minProperties *uint64) error

func (*Schema) SetMinimum

func (s *Schema) SetMinimum(minimum *float64) error

func (*Schema) SetMultipleOf

func (s *Schema) SetMultipleOf(multipleOf *float64) error

func (*Schema) SetNot

func (s *Schema) SetNot(not *RefSchema) error

func (*Schema) SetOneOf

func (s *Schema) SetOneOf(oneOf []*RefSchema) error

func (*Schema) SetPattern

func (s *Schema) SetPattern(pattern string) error

func (*Schema) SetPrefixItems

func (s *Schema) SetPrefixItems(prefixItems []*RefSchema) error

func (*Schema) SetProperties

func (s *Schema) SetProperties(properties map[string]*RefSchema) error

func (*Schema) SetReadOnly

func (s *Schema) SetReadOnly(readOnly bool) error

func (*Schema) SetRequired

func (s *Schema) SetRequired(required []string) error

func (*Schema) SetThen

func (s *Schema) SetThen(thenSchema *RefSchema) error

func (*Schema) SetTitle

func (s *Schema) SetTitle(title string) error

func (*Schema) SetType

func (s *Schema) SetType(schemaType SchemaType) error

func (*Schema) SetUnevaluatedItems

func (s *Schema) SetUnevaluatedItems(unevaluatedItems *RefSchema) error

func (*Schema) SetUnevaluatedProperties

func (s *Schema) SetUnevaluatedProperties(unevaluatedProperties *RefSchema) error

func (*Schema) SetUniqueItems

func (s *Schema) SetUniqueItems(uniqueItems bool) error

func (*Schema) SetWriteOnly

func (s *Schema) SetWriteOnly(writeOnly bool) error

func (*Schema) SetXML

func (s *Schema) SetXML(xml *XML) error

func (*Schema) Then

func (s *Schema) Then() *RefSchema

func (*Schema) Title

func (s *Schema) Title() string

func (*Schema) Type

func (s *Schema) Type() SchemaType

func (*Schema) UnevaluatedItems

func (s *Schema) UnevaluatedItems() *RefSchema

func (*Schema) UnevaluatedProperties

func (s *Schema) UnevaluatedProperties() *RefSchema

func (*Schema) UniqueItems

func (s *Schema) UniqueItems() bool

func (*Schema) WriteOnly

func (s *Schema) WriteOnly() bool

func (*Schema) XML

func (s *Schema) XML() *XML

type SchemaFields

type SchemaFields struct {
	Title            string
	MultipleOf       *float64
	Maximum          *float64
	ExclusiveMaximum *float64
	Minimum          *float64
	ExclusiveMinimum *float64
	MaxLength        *uint64
	MinLength        *uint64
	Pattern          string
	MaxItems         *uint64
	MinItems         *uint64
	UniqueItems      bool
	MaxProperties    *uint64
	MinProperties    *uint64
	Required         []string
	Enum             []interface{}
	Type             SchemaType
	AllOf            []*RefSchema
	OneOf            []*RefSchema
	AnyOf            []*RefSchema
	Not              *RefSchema
	Items            *RefSchema
	Properties       map[string]*RefSchema
	Description      string
	Format           string
	Default          interface{}

	AdditionalProperties        *RefSchema
	AdditionalPropertiesAllowed *bool

	// JSON Schema 2020-12
	Const                 interface{}
	If                    *RefSchema
	Then                  *RefSchema
	Else                  *RefSchema
	DependentSchemas      map[string]*RefSchema
	PrefixItems           []*RefSchema
	Anchor                string
	DynamicRef            string
	DynamicAnchor         string
	ContentEncoding       string
	ContentMediaType      string
	ContentSchema         *RefSchema
	UnevaluatedItems      *RefSchema
	UnevaluatedProperties *RefSchema
	Examples              []interface{}

	// OpenAPI extensions
	Discriminator *Discriminator
	ReadOnly      bool
	WriteOnly     bool
	XML           *XML
	ExternalDocs  *ExternalDocumentation
	Example       interface{}
	Deprecated    bool
}

SchemaFields holds all fields for constructing a Schema. Using a struct avoids a 55+ parameter constructor.

type SchemaType

type SchemaType struct {
	// Single is set when the type is a single string value (e.g. "string").
	Single string
	// Array is set when the type is an array of strings (e.g. ["string", "null"]).
	Array []string
}

SchemaType represents a JSON Schema type field that can be either a single string or an array of strings (JSON Schema Draft 2020-12).

func (SchemaType) IsEmpty

func (t SchemaType) IsEmpty() bool

IsEmpty returns true if no type was specified.

func (SchemaType) MarshalJSON

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

func (SchemaType) MarshalYAML

func (t SchemaType) MarshalYAML() (interface{}, error)

func (SchemaType) Values

func (t SchemaType) Values() []string

Values returns all type values as a slice, whether specified as single or array.

type SecurityRequirement

type SecurityRequirement map[string][]string

SecurityRequirement lists required security schemes to execute an operation. https://spec.openapis.org/oas/v3.1.0#security-requirement-object

type SecurityScheme

type SecurityScheme struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

SecurityScheme defines a security scheme for the API. https://spec.openapis.org/oas/v3.1.0#security-scheme-object

func NewSecurityScheme

func NewSecurityScheme(schemeType, description, name, in, scheme, bearerFormat, openIDConnectURL string, flows *OAuthFlows) *SecurityScheme

NewSecurityScheme creates a new SecurityScheme instance.

func (*SecurityScheme) BearerFormat

func (s *SecurityScheme) BearerFormat() string

func (*SecurityScheme) Deprecated

func (s *SecurityScheme) Deprecated() *bool

func (*SecurityScheme) Description

func (s *SecurityScheme) Description() string

func (*SecurityScheme) Flows

func (s *SecurityScheme) Flows() *OAuthFlows

func (*SecurityScheme) In

func (s *SecurityScheme) In() string

func (*SecurityScheme) MarshalFields

func (s *SecurityScheme) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*SecurityScheme) MarshalJSON

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

func (*SecurityScheme) MarshalYAML

func (s *SecurityScheme) MarshalYAML() (interface{}, error)

func (*SecurityScheme) Name

func (s *SecurityScheme) Name() string

func (*SecurityScheme) OAuth2MetadataURL

func (s *SecurityScheme) OAuth2MetadataURL() string

func (*SecurityScheme) OpenIDConnectURL

func (s *SecurityScheme) OpenIDConnectURL() string

func (*SecurityScheme) Scheme

func (s *SecurityScheme) Scheme() string

func (*SecurityScheme) SetBearerFormat

func (s *SecurityScheme) SetBearerFormat(bearerFormat string) error

func (*SecurityScheme) SetDeprecated

func (s *SecurityScheme) SetDeprecated(deprecated *bool) error

func (*SecurityScheme) SetDescription

func (s *SecurityScheme) SetDescription(description string) error

func (*SecurityScheme) SetFlows

func (s *SecurityScheme) SetFlows(flows *OAuthFlows) error

func (*SecurityScheme) SetIn

func (s *SecurityScheme) SetIn(in string) error

func (*SecurityScheme) SetName

func (s *SecurityScheme) SetName(name string) error

func (*SecurityScheme) SetOAuth2MetadataURL

func (s *SecurityScheme) SetOAuth2MetadataURL(oauth2MetadataURL string) error

func (*SecurityScheme) SetOpenIDConnectURL

func (s *SecurityScheme) SetOpenIDConnectURL(openIDConnectURL string) error

func (*SecurityScheme) SetScheme

func (s *SecurityScheme) SetScheme(scheme string) error

func (*SecurityScheme) SetType

func (s *SecurityScheme) SetType(schemeType string) error

func (*SecurityScheme) Type

func (s *SecurityScheme) Type() string

type Server

type Server struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Server represents a server. https://spec.openapis.org/oas/v3.1.0#server-object

func NewServer

func NewServer(url, description string, variables map[string]*ServerVariable) *Server

NewServer creates a new Server instance.

func (*Server) Description

func (s *Server) Description() string

func (*Server) MarshalFields

func (s *Server) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Server) MarshalJSON

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

func (*Server) MarshalYAML

func (s *Server) MarshalYAML() (interface{}, error)

func (*Server) Name

func (s *Server) Name() string

func (*Server) SetDescription

func (s *Server) SetDescription(description string) error

func (*Server) SetName

func (s *Server) SetName(name string) error

func (*Server) SetURL

func (s *Server) SetURL(url string) error

func (*Server) SetVariables

func (s *Server) SetVariables(variables map[string]*ServerVariable) error

func (*Server) URL

func (s *Server) URL() string

func (*Server) Variables

func (s *Server) Variables() map[string]*ServerVariable

type ServerVariable

type ServerVariable struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

ServerVariable represents a server variable for URL template substitution. https://spec.openapis.org/oas/v3.1.0#server-variable-object

func NewServerVariable

func NewServerVariable(enum []string, defaultValue, description string) *ServerVariable

NewServerVariable creates a new ServerVariable instance.

func (*ServerVariable) Default

func (v *ServerVariable) Default() string

func (*ServerVariable) Description

func (v *ServerVariable) Description() string

func (*ServerVariable) Enum

func (v *ServerVariable) Enum() []string

func (*ServerVariable) MarshalFields

func (v *ServerVariable) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*ServerVariable) MarshalJSON

func (v *ServerVariable) MarshalJSON() ([]byte, error)

func (*ServerVariable) MarshalYAML

func (v *ServerVariable) MarshalYAML() (interface{}, error)

func (*ServerVariable) SetDefault

func (v *ServerVariable) SetDefault(defaultVal string) error

func (*ServerVariable) SetDescription

func (v *ServerVariable) SetDescription(description string) error

func (*ServerVariable) SetEnum

func (v *ServerVariable) SetEnum(enum []string) error

type Tag

type Tag struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

Tag adds metadata to a single tag used by the Operation Object. https://spec.openapis.org/oas/v3.1.0#tag-object

func NewTag

func NewTag(name, description string, externalDocs *ExternalDocumentation) *Tag

NewTag creates a new Tag instance.

func (*Tag) Description

func (t *Tag) Description() string

func (*Tag) ExternalDocs

func (t *Tag) ExternalDocs() *ExternalDocumentation

func (*Tag) Kind

func (t *Tag) Kind() string

func (*Tag) MarshalFields

func (t *Tag) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*Tag) MarshalJSON

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

func (*Tag) MarshalYAML

func (t *Tag) MarshalYAML() (interface{}, error)

func (*Tag) Name

func (t *Tag) Name() string

func (*Tag) Parent

func (t *Tag) Parent() string

func (*Tag) SetDescription

func (t *Tag) SetDescription(description string) error

func (*Tag) SetExternalDocs

func (t *Tag) SetExternalDocs(externalDocs *ExternalDocumentation) error

func (*Tag) SetKind

func (t *Tag) SetKind(kind string) error

func (*Tag) SetName

func (t *Tag) SetName(name string) error

func (*Tag) SetParent

func (t *Tag) SetParent(parent string) error

func (*Tag) SetSummary

func (t *Tag) SetSummary(summary string) error

func (*Tag) Summary

func (t *Tag) Summary() string

type Trix

type Trix struct {
	shared.Trix // promotes Source, Errors, OnSet, RunHooks

	// ResolvedDynamicRef holds the schema resolved from $dynamicRef (Schema only).
	ResolvedDynamicRef *RefSchema `json:"-" yaml:"-"`

	// ResolvedMapping holds discriminator mapping values resolved to schema refs (Discriminator only).
	ResolvedMapping map[string]*RefSchema `json:"-" yaml:"-"`

	// ResolvedOperation holds the operation resolved from operationRef (Link only).
	ResolvedOperation *Operation `json:"-" yaml:"-"`
}

Trix contains all library-level metadata and functionality. Everything under Trix is provided by the apitrix library, not part of the OpenAPI specification itself.

type XML

type XML struct {
	ElementBase // embedded - provides VendorExtensions and Trix
	// contains filtered or unexported fields
}

XML provides additional metadata for XML serialization. https://spec.openapis.org/oas/v3.1.0#xml-object

func NewXML

func NewXML(name, namespace, prefix string, attribute, wrapped bool) *XML

NewXML creates a new XML instance.

func (*XML) Attribute

func (x *XML) Attribute() bool

func (*XML) MarshalFields

func (x *XML) MarshalFields() []shared.Field

MarshalFields implements shared.MarshalFieldsProvider for export.

func (*XML) MarshalJSON

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

func (*XML) MarshalYAML

func (x *XML) MarshalYAML() (interface{}, error)

func (*XML) Name

func (x *XML) Name() string

func (*XML) Namespace

func (x *XML) Namespace() string

func (*XML) Prefix

func (x *XML) Prefix() string

func (*XML) SetAttribute

func (x *XML) SetAttribute(attribute bool) error

func (*XML) SetName

func (x *XML) SetName(name string) error

func (*XML) SetNamespace

func (x *XML) SetNamespace(namespace string) error

func (*XML) SetPrefix

func (x *XML) SetPrefix(prefix string) error

func (*XML) SetWrapped

func (x *XML) SetWrapped(wrapped bool) error

func (*XML) Wrapped

func (x *XML) Wrapped() bool

Jump to

Keyboard shortcuts

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