openapi3

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Package openapi3 defines the OpenAPI 3.0 document model used by Datly's generator. The model is adapted from original Datly; see LICENSE and NOTICE for attribution. Runtime contract projection belongs to the parent package.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0). See LICENSE and NOTICE. Mutable document-loading methods are intentionally omitted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback map[string]*PathItem

type CallbackRef

type CallbackRef struct {
	Ref      string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Callback `yaml:",inline"`
}

type Callbacks

type Callbacks map[string]*CallbackRef

type Components

type Components struct {
	Schemas         Schemas         `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Parameters      ParametersMap   `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Headers         Headers         `json:"headers,omitempty" yaml:"headers,omitempty"`
	RequestBodies   RequestBodies   `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
	Responses       Responses       `json:"responses,omitempty" yaml:"responses,omitempty"`
	SecuritySchemes SecuritySchemes `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
	Examples        Examples        `json:"examples,omitempty" yaml:"examples,omitempty"`
	Links           Links           `json:"links,omitempty" yaml:"links,omitempty"`
	Callbacks       Callbacks       `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
}

Components is specified by OpenAPI/Swagger standard version 3.0.

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"`
}

Info represents document info

type Content

type Content map[string]*MediaType

Content is specified by OpenAPI/Swagger 3.0 standard.

type Discriminator

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

type Encoding

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

Encoding is specified by OpenAPI/Swagger 3.0 standard.

type Example

type Example 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"`
	Value         interface{} `json:"value,omitempty" yaml:"value,omitempty"`
	ExternalValue string      `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
}

type Examples

type Examples map[string]*Example

type ExternalDocumentation

type ExternalDocumentation struct {
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
}

type Headers

type Headers map[string]*Parameter

type Info

type Info struct {
	Title          string   `json:"title" yaml:"title"` // Required
	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
}

Info represents document info

type License

type License struct {
	Name string `json:"name" yaml:"name"` // Required
	URL  string `json:"url,omitempty" yaml:"url,omitempty"`
}

Info represents document info

type Link struct {
	Ref          string                 `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	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]interface{} `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Server       *Server                `json:"server,omitempty" yaml:"server,omitempty"`
	RequestBody  interface{}            `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
}
type Links map[string]*Link

type MediaType

type MediaType struct {
	Schema   *Schema              `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example  interface{}          `json:"example,omitempty" yaml:"example,omitempty"`
	Examples Examples             `json:"examples,omitempty" yaml:"examples,omitempty"`
	Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"`
}

MediaType is specified by OpenAPI/Swagger 3.0 standard.

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"`
	Scopes           map[string]string `json:"scopes" yaml:"scopes"`
}

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"`
}

type OpenAPI

type OpenAPI struct {
	OpenAPI      string                 `json:"openapi" yaml:"openapi"` // Required
	Components   Components             `json:"components,omitempty" yaml:"components,omitempty"`
	Info         *Info                  `json:"info" yaml:"info"`   // Required
	Paths        Paths                  `json:"paths" yaml:"paths"` // Required
	Security     SecurityRequirements   `json:"security,omitempty" yaml:"security,omitempty"`
	Servers      Servers                `json:"servers,omitempty" yaml:"servers,omitempty"`
	Tags         Tags                   `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

OpenAPI represents OpenAPI 3.0 document

type Operation

type Operation struct {

	// Optional tags for documentation.
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`

	// Optional short summary.
	Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`

	// Optional description. Should use CommonMark syntax.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// Optional operation ID.
	OperationID string `json:"operationId,omitempty" yaml:"operationId,omitempty"`

	// Optional parameters.
	Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`

	// Optional body parameter.
	RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`

	// Responses.
	Responses Responses `json:"responses" yaml:"responses"` // Required

	// Optional callbacks
	Callbacks Callbacks `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`

	Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`

	// Optional security requirements that overrides top-level security.
	Security *SecurityRequirements `json:"security,omitempty" yaml:"security,omitempty"`

	// Optional servers that overrides top-level servers.
	Servers *Servers `json:"servers,omitempty" yaml:"servers,omitempty"`

	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

type Parameter

type Parameter struct {
	Ref             string      `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	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          *Schema     `json:"schema,omitempty" yaml:"schema,omitempty"`
	Example         interface{} `json:"example,omitempty" yaml:"example,omitempty"`
	Examples        Examples    `json:"examples,omitempty" yaml:"examples,omitempty"`
	Content         Content     `json:"content,omitempty" yaml:"content,omitempty"`
}

type Parameters

type Parameters []*Parameter

type ParametersMap

type ParametersMap map[string]*Parameter

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"`

	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"`
	Servers    Servers    `json:"servers,omitempty" yaml:"servers,omitempty"`
	Parameters Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

Paths represents a path defined by OpenAPI/Swagger standard version 3.0.

type Paths

type Paths map[string]*PathItem

Paths represents a path defined by OpenAPI/Swagger standard version 3.0.

type RequestBodies

type RequestBodies map[string]*RequestBody

type RequestBody

type RequestBody struct {
	Ref         string  `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Description string  `json:"description,omitempty" yaml:"description,omitempty"`
	Required    bool    `json:"required,omitempty" yaml:"required,omitempty"`
	Content     Content `json:"content,omitempty" yaml:"content,omitempty"`
}

RequestBody is specified by OpenAPI/Swagger 3.0 standard.

type Response

type Response struct {
	Ref         string  `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Description *string `json:"description,omitempty" yaml:"description,omitempty"`
	Headers     Headers `json:"headers,omitempty" yaml:"headers,omitempty"`
	Content     Content `json:"content,omitempty" yaml:"content,omitempty"`
	Links       Links   `json:"links,omitempty" yaml:"links,omitempty"`
}

Response is specified by OpenAPI/Swagger 3.0 standard.

type Responses

type Responses map[string]*Response

Responses is specified by OpenAPI/Swagger 3.0 standard.

type Schema

type Schema struct {
	Ref   string     `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Type  string     `json:"type,omitempty" yaml:"type,omitempty"`
	AllOf SchemaList `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	OneOf SchemaList `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	AnyOf SchemaList `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`

	Not   *Schema `json:"not,omitempty" yaml:"not,omitempty"`
	Items *Schema `json:"items,omitempty" yaml:"items,omitempty"`

	Properties Schemas `json:"properties,omitempty" yaml:"properties,omitempty"`

	// AdditionalPropertiesAllowed represents the boolean alternative of this OpenAPI keyword.
	AdditionalPropertiesAllowed *bool       `json:"-" yaml:"-"`
	AdditionalProperties        *Schema     `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	Description                 string      `json:"description,omitempty" yaml:"description,omitempty"`
	Format                      string      `json:"format,omitempty" yaml:"format,omitempty"`
	Default                     interface{} `json:"default,omitempty" yaml:"default,omitempty"`

	// Properties
	Nullable      bool           `json:"nullable,omitempty" yaml:"nullable,omitempty"`
	Discriminator *Discriminator `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`

	ReadOnly        bool                   `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	WriteOnly       bool                   `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
	AllowEmptyValue bool                   `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	XML             *XML                   `json:"xml,omitempty" yaml:"xml,omitempty"`
	ExternalDocs    *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Deprecated      bool                   `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Example         interface{}            `json:"example,omitempty" yaml:"example,omitempty"`

	Title      string   `json:"title,omitempty" yaml:"title,omitempty"`
	MultipleOf *float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`

	Max          *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	ExclusiveMax bool     `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	Min          *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	ExclusiveMin bool     `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`

	MaxLength *uint64 `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	MinLength uint64  `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	Pattern   string  `json:"pattern,omitempty" yaml:"pattern,omitempty"`

	MaxItems    *uint64 `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	MinItems    uint64  `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	UniqueItems bool    `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`

	MaxProps *uint64       `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
	MinProps uint64        `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
	Required []string      `json:"required,omitempty" yaml:"required,omitempty"`
	Enum     []interface{} `json:"enum,omitempty" yaml:"enum,omitempty"`
}

func (Schema) MarshalJSON

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

Schema retains the existing object alternative while representing the actual OpenAPI additionalProperties boolean union. Invalid/unsupported schema keywords fail instead of being discarded during authored resource projection.

func (Schema) MarshalYAML

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

func (*Schema) UnmarshalJSON

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

func (*Schema) UnmarshalYAML

func (s *Schema) UnmarshalYAML(node *yaml.Node) error

type SchemaList

type SchemaList []*Schema

type Schemas

type Schemas map[string]*Schema

type SecurityRequirement

type SecurityRequirement map[string][]string

type SecurityRequirements

type SecurityRequirements []SecurityRequirement

type SecurityScheme

type SecurityScheme struct {
	Ref              string      `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	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"`
	OpenIdConnectUrl string      `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
}

type SecuritySchemes

type SecuritySchemes map[string]*SecurityScheme

type Server

type Server struct {
	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 a server node defined is specified by OpenAPI/Swagger standard version 3.0.

type ServerVariable

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

ServerVariable represents server variables defined by OpenAPI/Swagger standard version 3.0.

type Servers

type Servers []Server

Server represents a server node defined is specified by OpenAPI/Swagger standard version 3.0.

type Tag

type Tag struct {
	Name         string                 `json:"name,omitempty" yaml:"name,omitempty"`
	Description  string                 `json:"description,omitempty" yaml:"description,omitempty"`
	ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

type Tags

type Tags []*Tag

type XML

type XML struct {
	Name      string `json:"name,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Prefix    string `json:"prefix,omitempty"`
	Attribute bool   `json:"attribute,omitempty"`
	Wrapped   bool   `json:"wrapped,omitempty"`
}

Jump to

Keyboard shortcuts

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