openapiv3

package
v1.8.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package openapiv3 contains the algorithms and data structures used to generate OpenAPI 3.1 and 3.2 specifications from Loom designs.

Index

Constants

View Source
const (
	// OpenAPIVersion is the default OpenAPI specification version emitted by Loom.
	OpenAPIVersion = "3.2.0"
	// OpenAPICompatibilityVersion is the optional compatibility target that omits 3.2-only sections.
	OpenAPICompatibilityVersion = "3.1.1"
)
View Source
const (
	// JSONSchemaDialect is the JSON Schema dialect advertised by generated specs.
	// OpenAPI 3.2 intentionally retains the 3.1 dialect URI; section 4.24.1 of
	// the normative specification identifies this URI for the 3.2 feature set:
	// https://spec.openapis.org/oas/v3.2.0.html#json-schema-keywords
	// The specification also declares its prose authoritative over conflicting
	// informational JSON Schema artifacts.
	JSONSchemaDialect = "https://spec.openapis.org/oas/3.1/dialect/base"
)

Variables

This section is empty.

Functions

func Files

func Files(root *expr.RootExpr) ([]*codegen.File, error)

Files returns the configured OpenAPI specification files in JSON and YAML formats.

Types

type CallbackRef

type CallbackRef struct {
	Ref   string
	Value map[string]*PathItem
}

CallbackRef represents an OpenAPI reference to a Callback object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*CallbackRef) MarshalJSON

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

func (*CallbackRef) MarshalYAML

func (r *CallbackRef) MarshalYAML() (any, error)

func (*CallbackRef) UnmarshalJSON

func (r *CallbackRef) UnmarshalJSON(d []byte) error

func (*CallbackRef) UnmarshalYAML

func (r *CallbackRef) UnmarshalYAML(u func(any) error) error

type Components

type Components struct {
	Schemas         map[string]*openapi.Schema    `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Parameters      map[string]*ParameterRef      `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Headers         map[string]*HeaderRef         `json:"headers,omitempty" yaml:"headers,omitempty"`
	RequestBodies   map[string]*RequestBodyRef    `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
	Responses       map[string]*ResponseRef       `json:"responses,omitempty" yaml:"responses,omitempty"`
	SecuritySchemes map[string]*SecuritySchemeRef `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
	Examples        map[string]*ExampleRef        `json:"examples,omitempty" yaml:"examples,omitempty"`
	Links           map[string]*LinkRef           `json:"links,omitempty" yaml:"links,omitempty"`
	Callbacks       map[string]*CallbackRef       `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
	// MediaTypes contains reusable Media Type Objects in OpenAPI 3.2 and later.
	MediaTypes map[string]*MediaTypeRef `json:"mediaTypes,omitempty" yaml:"mediaTypes,omitempty"`
	Extensions map[string]any           `json:"-" yaml:"-"`
}

Components represents an OpenAPI Components object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#componentsObject

type Contact

type Contact struct {
	Name       string         `json:"name,omitempty" yaml:"name,omitempty"`
	URL        string         `json:"url,omitempty" yaml:"url,omitempty"`
	Email      string         `json:"email,omitempty" yaml:"email,omitempty"`
	Extensions map[string]any `json:"-" yaml:"-"`
}

Contact represents an OpenAPI Contact object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#contactObject

type Encoding

type Encoding struct {
	// ContentType identifies the media type used to encode the value.
	ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	// Headers describes additional headers associated with the encoded value.
	Headers map[string]*HeaderRef `json:"headers,omitempty" yaml:"headers,omitempty"`
	// Style describes how the encoded value is serialized.
	Style string `json:"style,omitempty" yaml:"style,omitempty"`
	// Explode controls whether arrays and objects produce separate parameters.
	Explode *bool `json:"explode,omitempty" yaml:"explode,omitempty"`
	// AllowReserved permits reserved URI characters in the encoded value.
	AllowReserved bool `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	// Encoding describes nested object-property encodings in OpenAPI 3.2 and later.
	Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"`
	// PrefixEncoding describes nested tuple-prefix encodings in OpenAPI 3.2 and later.
	PrefixEncoding []*Encoding `json:"prefixEncoding,omitempty" yaml:"prefixEncoding,omitempty"`
	// ItemEncoding describes the nested encoding for remaining array items in OpenAPI 3.2 and later.
	ItemEncoding *Encoding `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
	// Extensions contains specification extensions keyed by x-prefixed names.
	Extensions map[string]any `json:"-" yaml:"-"`
}

Encoding represents an OpenAPI Encoding object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#encodingObject

type EndpointBodies

type EndpointBodies struct {
	RequestBody    *openapi.Schema
	ResponseBodies map[int][]*openapi.Schema
}

EndpointBodies describes the request and response HTTP bodies of an endpoint using JSON schema. Each body may be described via a reference to a schema described in the "Components" section of the OpenAPI document or an actual JSON schema data structure. There may also be additional notes attached to each body definition to account for cases that are not directly supported in OpenAPI such as streaming. The possible response bodies are indexed by HTTP status, there may be more than one when the result type defined multiple views.

type Example

type Example struct {
	Summary     string `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	Value       any    `json:"value,omitempty" yaml:"value,omitempty"`
	// DataValue contains the example's parsed data value in OpenAPI 3.2 and later.
	DataValue any `json:"dataValue,omitempty" yaml:"dataValue,omitempty"`
	// SerializedValue contains the example's serialized representation in OpenAPI 3.2 and later.
	SerializedValue string         `json:"serializedValue,omitempty" yaml:"serializedValue,omitempty"`
	ExternalValue   string         `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
	Extensions      map[string]any `json:"-" yaml:"-"`
	// CompatibilityValue preserves the ordinary example value for OpenAPI 3.1 output.
	CompatibilityValue any `json:"-" yaml:"-"`
}

Example represents an OpenAPI Example object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#exampleObject

type ExampleRef

type ExampleRef struct {
	Ref   string
	Value *Example
}

ExampleRef represents an OpenAPI reference to a Example object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*ExampleRef) MarshalJSON

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

func (*ExampleRef) MarshalYAML

func (r *ExampleRef) MarshalYAML() (any, error)

func (*ExampleRef) UnmarshalJSON

func (r *ExampleRef) UnmarshalJSON(d []byte) error

func (*ExampleRef) UnmarshalYAML

func (r *ExampleRef) UnmarshalYAML(u func(any) error) error
type Header struct {
	Description     string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Style           string                 `json:"style,omitempty" yaml:"style,omitempty"`
	Explode         *bool                  `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowEmptyValue bool                   `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	AllowReserved   bool                   `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	Deprecated      bool                   `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Required        bool                   `json:"required,omitempty" yaml:"required,omitempty"`
	Schema          *openapi.Schema        `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example         any                    `json:"example,omitempty" yaml:"example,omitempty"`
	Examples        map[string]*ExampleRef `json:"examples,omitempty" yaml:"examples,omitempty"`
	Content         map[string]*MediaType  `json:"content,omitempty" yaml:"content,omitempty"`
	Extensions      map[string]any         `json:"-" yaml:"-"`
}

Header represents an OpenAPI Header object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#headerObject

type HeaderRef

type HeaderRef struct {
	Ref   string
	Value *Header
}

HeaderRef represents an OpenAPI reference to a Header object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*HeaderRef) MarshalJSON

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

func (*HeaderRef) MarshalYAML

func (r *HeaderRef) MarshalYAML() (any, error)

func (*HeaderRef) UnmarshalJSON

func (r *HeaderRef) UnmarshalJSON(d []byte) error

func (*HeaderRef) UnmarshalYAML

func (r *HeaderRef) UnmarshalYAML(u func(any) error) error

type Info

type Info struct {
	Title          string         `json:"title" yaml:"title"` // Required
	Summary        string         `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description    string         `json:"description,omitempty" yaml:"description,omitempty"`
	TermsOfService string         `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"`
	Contact        *Contact       `json:"contact,omitempty" yaml:"contact,omitempty"`
	License        *License       `json:"license,omitempty" yaml:"license,omitempty"`
	Version        string         `json:"version" yaml:"version"` // Required
	Extensions     map[string]any `json:"-" yaml:"-"`
}

Info represents an OpenAPI Info object as defined in https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#info-object

func (Info) MarshalJSON

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

MarshalJSON returns the JSON encoding of i.

func (Info) MarshalYAML

func (i Info) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type License

type License struct {
	Name       string         `json:"name" yaml:"name"` // Required
	Identifier string         `json:"identifier,omitempty" yaml:"identifier,omitempty"`
	URL        string         `json:"url,omitempty" yaml:"url,omitempty"`
	Extensions map[string]any `json:"-" yaml:"-"`
}

License represents an OpenAPI License object as defined in https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.1.md#license-object

type Link struct {
	OperationID  string         `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	OperationRef string         `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
	Description  string         `json:"description,omitempty" yaml:"description,omitempty"`
	Parameters   map[string]any `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Server       *Server        `json:"server,omitempty" yaml:"server,omitempty"`
	RequestBody  any            `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Extensions   map[string]any `json:"-" yaml:"-"`
}

Link represents an OpenAPI Link object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#linkObject

type LinkRef

type LinkRef struct {
	Ref   string
	Value *Link
}

LinkRef represents an OpenAPI reference to a Link object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*LinkRef) MarshalJSON

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

func (*LinkRef) MarshalYAML

func (r *LinkRef) MarshalYAML() (any, error)

func (*LinkRef) UnmarshalJSON

func (r *LinkRef) UnmarshalJSON(d []byte) error

func (*LinkRef) UnmarshalYAML

func (r *LinkRef) UnmarshalYAML(u func(any) error) error

type MediaType

type MediaType struct {
	// Ref references a reusable Media Type Object in OpenAPI 3.2 and later.
	Ref    string          `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Schema *openapi.Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
	// ItemSchema describes each item in a streaming media type in OpenAPI 3.2 and later.
	ItemSchema *openapi.Schema `json:"itemSchema,omitempty" yaml:"itemSchema,omitempty"`
	// PrefixEncoding describes encodings for tuple prefixes in OpenAPI 3.2 and later.
	PrefixEncoding []*Encoding `json:"prefixEncoding,omitempty" yaml:"prefixEncoding,omitempty"`
	// ItemEncoding describes the encoding applied to each remaining item in OpenAPI 3.2 and later.
	ItemEncoding *Encoding              `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
	Example      any                    `json:"example,omitempty" yaml:"example,omitempty"`
	Examples     map[string]*ExampleRef `json:"examples,omitempty" yaml:"examples,omitempty"`
	Encoding     map[string]*Encoding   `json:"encoding,omitempty" yaml:"encoding,omitempty"`
	Extensions   map[string]any         `json:"-" yaml:"-"`
	// ComponentName names a reusable OpenAPI 3.2 media type component.
	ComponentName string `json:"-" yaml:"-"`
	// UseItemSchema marks sequential media whose schema applies to each streamed item.
	UseItemSchema bool `json:"-" yaml:"-"`
}

MediaType represents an OpenAPI Media Type object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#mediaTypeObject

type MediaTypeRef added in v1.8.0

type MediaTypeRef struct {
	Ref   string
	Value *MediaType
}

MediaTypeRef represents an OpenAPI reference to a Media Type object.

func (*MediaTypeRef) MarshalJSON added in v1.8.0

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

func (*MediaTypeRef) MarshalYAML added in v1.8.0

func (r *MediaTypeRef) MarshalYAML() (any, error)

func (*MediaTypeRef) UnmarshalJSON added in v1.8.0

func (r *MediaTypeRef) UnmarshalJSON(d []byte) error

func (*MediaTypeRef) UnmarshalYAML added in v1.8.0

func (r *MediaTypeRef) UnmarshalYAML(u func(any) error) error

type OAuthFlow

type OAuthFlow struct {
	AuthorizationURL string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
	TokenURL         string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
	RefreshURL       string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
	// DeviceAuthorizationURL locates the OAuth device authorization endpoint in OpenAPI 3.2 and later.
	DeviceAuthorizationURL string            `json:"deviceAuthorizationUrl,omitempty" yaml:"deviceAuthorizationUrl,omitempty"`
	Scopes                 map[string]string `json:"scopes" yaml:"scopes"`
	Extensions             map[string]any    `json:"-" yaml:"-"`
}

OAuthFlow represents an OpenAPI OAuthFlow object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#oauthFlowObject

type OAuthFlows

type OAuthFlows struct {
	Implicit          *OAuthFlow `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	Password          *OAuthFlow `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
	// DeviceAuthorization describes the OAuth device authorization flow in OpenAPI 3.2 and later.
	DeviceAuthorization *OAuthFlow     `json:"deviceAuthorization,omitempty" yaml:"deviceAuthorization,omitempty"`
	Extensions          map[string]any `json:"-" yaml:"-"`
}

OAuthFlows represents an OpenAPI OAuthFlows object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#oauthFlowsObject

type OpenAPI

type OpenAPI struct {
	OpenAPI string `json:"openapi" yaml:"openapi"` // Required
	// Self identifies this OpenAPI document in version 3.2 and later.
	Self              string                `json:"$self,omitempty" yaml:"$self,omitempty"`
	Info              *Info                 `json:"info" yaml:"info"` // Required
	JSONSchemaDialect string                `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"`
	Servers           []*Server             `json:"servers,omitempty" yaml:"servers,omitempty"`
	Paths             map[string]*PathItem  `json:"paths" yaml:"paths"` // Required
	Components        *Components           `json:"components,omitempty" yaml:"components,omitempty"`
	Tags              []*openapi.Tag        `json:"tags,omitempty" yaml:"tags,omitempty"`
	Security          []map[string][]string `json:"security,omitempty" yaml:"security,omitempty"`
	ExternalDocs      *openapi.ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Extensions        map[string]any        `json:"-" yaml:"-"`
}

OpenAPI is a data structure that encodes the information needed to generate an OpenAPI 3.1 or 3.2 specification.

func New

func New(root *expr.RootExpr) *OpenAPI

New returns the OpenAPI v3 specification for the given API. It returns nil if the design does not define HTTP endpoints or configures an unsupported openapi:version value. Callers that need the validation error should evaluate the design before calling New or use Files.

type Operation

type Operation struct {
	Tags         []string                `json:"tags,omitempty" yaml:"tags,omitempty"`
	Summary      string                  `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  string                  `json:"description,omitempty" yaml:"description,omitempty"`
	OperationID  string                  `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	Parameters   []*ParameterRef         `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	RequestBody  *RequestBodyRef         `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Responses    map[string]*ResponseRef `json:"responses" yaml:"responses"` // Required
	Callbacks    map[string]*CallbackRef `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
	Deprecated   bool                    `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Security     []map[string][]string   `json:"security,omitempty" yaml:"security,omitempty"`
	Servers      []*Server               `json:"servers,omitempty" yaml:"servers,omitempty"`
	ExternalDocs *openapi.ExternalDocs   `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Extensions   map[string]any          `json:"-" yaml:"-"`
}

Operation represents an OpenAPI Operation object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#operationObject

func (Operation) MarshalJSON

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

MarshalJSON returns the JSON encoding of o.

func (Operation) MarshalYAML

func (o Operation) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type Parameter

type Parameter struct {
	Name            string                 `json:"name,omitempty" yaml:"name,omitempty"`
	In              string                 `json:"in,omitempty" yaml:"in,omitempty"`
	Description     string                 `json:"description,omitempty" yaml:"description,omitempty"`
	Style           string                 `json:"style,omitempty" yaml:"style,omitempty"`
	Explode         *bool                  `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowEmptyValue bool                   `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	AllowReserved   bool                   `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	Deprecated      bool                   `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Required        bool                   `json:"required,omitempty" yaml:"required,omitempty"`
	Schema          *openapi.Schema        `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example         any                    `json:"example,omitempty" yaml:"example,omitempty"`
	Examples        map[string]*ExampleRef `json:"examples,omitempty" yaml:"examples,omitempty"`
	Content         map[string]*MediaType  `json:"content,omitempty" yaml:"content,omitempty"`
	// WholeQueryString marks parameters promoted to OpenAPI 3.2 querystring parameters.
	WholeQueryString bool           `json:"-" yaml:"-"`
	Extensions       map[string]any `json:"-" yaml:"-"`
}

Parameter represents an OpenAPI Parameter object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#parameterObject

func (*Parameter) MarshalJSON

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

MarshalJSON returns the JSON encoding of p.

func (*Parameter) MarshalYAML

func (p *Parameter) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type ParameterRef

type ParameterRef struct {
	Ref   string
	Value *Parameter
}

ParameterRef represents an OpenAPI reference to a Parameter object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*ParameterRef) MarshalJSON

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

func (*ParameterRef) MarshalYAML

func (r *ParameterRef) MarshalYAML() (any, error)

func (*ParameterRef) UnmarshalJSON

func (r *ParameterRef) UnmarshalJSON(d []byte) error

func (*ParameterRef) UnmarshalYAML

func (r *ParameterRef) UnmarshalYAML(u func(any) error) error

type PathItem

type PathItem struct {
	Ref         string     `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Summary     string     `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description string     `json:"description,omitempty" yaml:"description,omitempty"`
	Connect     *Operation `json:"connect,omitempty" yaml:"connect,omitempty"`
	Delete      *Operation `json:"delete,omitempty" yaml:"delete,omitempty"`
	Get         *Operation `json:"get,omitempty" yaml:"get,omitempty"`
	Head        *Operation `json:"head,omitempty" yaml:"head,omitempty"`
	Options     *Operation `json:"options,omitempty" yaml:"options,omitempty"`
	Patch       *Operation `json:"patch,omitempty" yaml:"patch,omitempty"`
	Post        *Operation `json:"post,omitempty" yaml:"post,omitempty"`
	Put         *Operation `json:"put,omitempty" yaml:"put,omitempty"`
	Trace       *Operation `json:"trace,omitempty" yaml:"trace,omitempty"`
	// Query describes the QUERY operation in OpenAPI 3.2 and later.
	Query *Operation `json:"query,omitempty" yaml:"query,omitempty"`
	// AdditionalOperations describes operations for additional HTTP methods in OpenAPI 3.2 and later.
	AdditionalOperations map[string]*Operation `json:"additionalOperations,omitempty" yaml:"additionalOperations,omitempty"`
	Servers              []*Server             `json:"servers,omitempty" yaml:"servers,omitempty"`
	Parameters           []*ParameterRef       `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Extensions           map[string]any        `json:"-" yaml:"-"`
}

PathItem represents an OpenAPI Path Item object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#pathItemObject

func (PathItem) MarshalJSON

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

MarshalJSON returns the JSON encoding of p.

func (PathItem) MarshalYAML

func (p PathItem) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type RequestBody

type RequestBody struct {
	Description string                `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool                  `json:"required,omitempty" yaml:"required,omitempty"`
	Content     map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"`
	Extensions  map[string]any        `json:"-" yaml:"-"`
}

RequestBody represents an OpenAPI RequestBody object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#requestBodyObject

type RequestBodyRef

type RequestBodyRef struct {
	Ref   string
	Value *RequestBody
}

RequestBodyRef represents an OpenAPI reference to a RequestBody object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*RequestBodyRef) MarshalJSON

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

func (*RequestBodyRef) MarshalYAML

func (r *RequestBodyRef) MarshalYAML() (any, error)

func (*RequestBodyRef) UnmarshalJSON

func (r *RequestBodyRef) UnmarshalJSON(d []byte) error

func (*RequestBodyRef) UnmarshalYAML

func (r *RequestBodyRef) UnmarshalYAML(u func(any) error) error

type Response

type Response struct {
	Summary     string                `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description *string               `json:"description,omitempty" yaml:"description,omitempty"`
	Headers     map[string]*HeaderRef `json:"headers,omitempty" yaml:"headers,omitempty"`
	Content     map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"`
	Links       map[string]*LinkRef   `json:"links,omitempty" yaml:"links,omitempty"`
	Extensions  map[string]any        `json:"-" yaml:"-"`
	// CompatibilityDescription preserves the generated description for a 3.1 target.
	CompatibilityDescription string `json:"-" yaml:"-"`
}

Response represents an OpenAPI Response object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#responseObject

func (Response) MarshalJSON

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

MarshalJSON returns the JSON encoding of r.

func (Response) MarshalYAML

func (r Response) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type ResponseRef

type ResponseRef struct {
	Ref   string
	Value *Response
}

ResponseRef represents an OpenAPI reference to a Response object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*ResponseRef) MarshalJSON

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

func (*ResponseRef) MarshalYAML

func (r *ResponseRef) MarshalYAML() (any, error)

func (*ResponseRef) UnmarshalJSON

func (r *ResponseRef) UnmarshalJSON(d []byte) error

func (*ResponseRef) UnmarshalYAML

func (r *ResponseRef) UnmarshalYAML(u func(any) error) error

type SecurityScheme

type SecurityScheme struct {
	Type         string      `json:"type,omitempty" yaml:"type,omitempty"`
	Description  string      `json:"description,omitempty" yaml:"description,omitempty"`
	Name         string      `json:"name,omitempty" yaml:"name,omitempty"`
	In           string      `json:"in,omitempty" yaml:"in,omitempty"`
	Scheme       string      `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	BearerFormat string      `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
	Flows        *OAuthFlows `json:"flows,omitempty" yaml:"flows,omitempty"`
	// OAuth2MetadataURL locates OAuth 2.0 authorization server metadata in OpenAPI 3.2 and later.
	OAuth2MetadataURL string `json:"oauth2MetadataUrl,omitempty" yaml:"oauth2MetadataUrl,omitempty"`
	// Deprecated reports whether use of the security scheme is discouraged.
	Deprecated bool           `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Extensions map[string]any `json:"-" yaml:"-"`
}

SecurityScheme represents an OpenAPI SecurityScheme object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#securitySchemeObject

func (SecurityScheme) MarshalJSON

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

MarshalJSON returns the JSON encoding of s.

func (SecurityScheme) MarshalYAML

func (s SecurityScheme) MarshalYAML() (any, error)

MarshalYAML returns value which marshaled in place of the original value

type SecuritySchemeRef

type SecuritySchemeRef struct {
	Ref   string
	Value *SecurityScheme
}

SecuritySchemeRef represents an OpenAPI reference to a SecurityScheme object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#referenceObject

func (*SecuritySchemeRef) MarshalJSON

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

func (*SecuritySchemeRef) MarshalYAML

func (r *SecuritySchemeRef) MarshalYAML() (any, error)

func (*SecuritySchemeRef) UnmarshalJSON

func (r *SecuritySchemeRef) UnmarshalJSON(d []byte) error

func (*SecuritySchemeRef) UnmarshalYAML

func (r *SecuritySchemeRef) UnmarshalYAML(u func(any) error) error

type Server

type Server struct {
	// Name identifies the server in OpenAPI 3.2 and later.
	Name        string                     `json:"name,omitempty" yaml:"name,omitempty"`
	URL         string                     `json:"url" yaml:"url"`
	Description string                     `json:"description,omitempty" yaml:"description,omitempty"`
	Variables   map[string]*ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"`
}

Server represents an OpenAPI Server object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#serverObject

type ServerVariable

type ServerVariable struct {
	Enum        []any  `json:"enum,omitempty" yaml:"enum,omitempty"`
	Default     any    `json:"default,omitempty" yaml:"default,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
}

ServerVariable represents an OpenAPI Server Variable object as defined in https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#serverVariableObject

Jump to

Keyboard shortcuts

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