Documentation ¶
Overview ¶
Package v3 represents all OpenAPI 3+ high-level models. High-level models are easy to navigate and simple to extract what ever is required from an OpenAPI 3+ specification.
High-level models are backed by low-level ones. There is a 'GoLow()' method available on every high level object. 'Going Low' allows engineers to transition from a high-level or 'porcelain' API, to a low-level 'plumbing' API, which provides fine grain detail to the underlying AST powering the data, lines, columns, raw nodes etc.
Example (CreateHighLevelOpenAPIDocument) ¶
An example of how to create a new high-level OpenAPI 3+ document from an OpenAPI specification.
// Load in an OpenAPI 3+ specification as a byte slice. data, _ := ioutil.ReadFile("../../../test_specs/petstorev3.json") // Create a new *datamodel.SpecInfo from bytes. info, _ := datamodel.ExtractSpecInfo(data) var err []error // Create a new low-level Document, capture any errors thrown during creation. lowDoc, err = lowv3.CreateDocument(info) // Get upset if any errors were thrown. if len(err) > 0 { for i := range err { fmt.Printf("error: %e", err[i]) } panic("something went wrong") } // Create a high-level Document from the low-level one. doc := NewDocument(lowDoc) // Print out some details fmt.Printf("Petstore contains %d paths and %d component schemas", len(doc.Paths.PathItems), len(doc.Components.Schemas))
Output: Petstore contains 13 paths and 8 component schemas
Index ¶
- func ExtractContent(...) map[string]*MediaType
- func ExtractEncoding(...) map[string]*Encoding
- func ExtractHeaders(...) map[string]*Header
- type Callback
- type Components
- type Document
- type Encoding
- type Header
- type Link
- type MediaType
- type OAuthFlow
- type OAuthFlows
- type Operation
- type Parameter
- func (p *Parameter) GoLow() *low.Parameter
- func (p *Parameter) GoLowUntyped() any
- func (p *Parameter) IsDefaultFormEncoding() bool
- func (p *Parameter) IsDefaultHeaderEncoding() bool
- func (p *Parameter) IsDefaultPathEncoding() bool
- func (p *Parameter) IsExploded() bool
- func (p *Parameter) MarshalYAML() (interface{}, error)
- func (p *Parameter) Render() ([]byte, error)
- type PathItem
- type Paths
- type RequestBody
- type Response
- type Responses
- type SecurityScheme
- type Server
- type ServerVariable
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractContent ¶
func ExtractContent(elements map[lowmodel.KeyReference[string]]lowmodel.ValueReference[*low.MediaType]) map[string]*MediaType
ExtractContent takes in a complex and hard to navigate low-level content map, and converts it in to a much simpler and easier to navigate high-level one.
func ExtractEncoding ¶
func ExtractEncoding(elements map[lowmodel.KeyReference[string]]lowmodel.ValueReference[*low.Encoding]) map[string]*Encoding
ExtractEncoding converts hard to navigate low-level plumbing Encoding definitions, into a high-level simple map
func ExtractHeaders ¶
func ExtractHeaders(elements map[lowmodel.KeyReference[string]]lowmodel.ValueReference[*low.Header]) map[string]*Header
ExtractHeaders will extract a hard to navigate low-level Header map, into simple high-level one.
Types ¶
type Callback ¶
type Callback struct { Expression map[string]*PathItem `json:"-" yaml:"-"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Callback represents a high-level Callback object for OpenAPI 3+.
A map of possible out-of band callbacks related to the parent operation. Each value in the map is a PathItem Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
func NewCallback ¶
NewCallback creates a new high-level callback from a low-level one.
func (*Callback) GoLow ¶
GoLow returns the low-level Callback instance used to create the high-level one.
func (*Callback) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Callback instance that was used to create the high-level one, with no type
func (*Callback) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Callback object.
type Components ¶
type Components struct { Schemas map[string]*highbase.SchemaProxy `json:"schemas,omitempty" yaml:"schemas,omitempty"` Responses map[string]*Response `json:"responses,omitempty" yaml:"responses,omitempty"` Parameters map[string]*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"` Examples map[string]*highbase.Example `json:"examples,omitempty" yaml:"examples,omitempty"` RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"` Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"` SecuritySchemes map[string]*SecurityScheme `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"` Links map[string]*Link `json:"links,omitempty" yaml:"links,omitempty"` Callbacks map[string]*Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Components represents a high-level OpenAPI 3+ Components Object, that is backed by a low-level one.
Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
func NewComponents ¶
func NewComponents(comp *low.Components) *Components
NewComponents will create new high-level instance of Components from a low-level one. Components can be considerable in scope, with a lot of different properties across different categories. All components are built asynchronously in order to keep things fast.
func (*Components) GoLow ¶
func (c *Components) GoLow() *low.Components
GoLow returns the low-level Components instance used to create the high-level one.
func (*Components) MarshalYAML ¶ added in v0.7.0
func (c *Components) MarshalYAML() (interface{}, error)
MarshalYAML will create a ready to render YAML representation of the Response object.
func (*Components) Render ¶ added in v0.7.0
func (c *Components) Render() ([]byte, error)
Render will return a YAML representation of the Components object as a byte slice.
type Document ¶
type Document struct { // Version is the version of OpenAPI being used, extracted from the 'openapi: x.x.x' definition. // This is not a standard property of the OpenAPI model, it's a convenience mechanism only. Version string `json:"openapi,omitempty" yaml:"openapi,omitempty"` // Info represents a specification Info definitions // Provides metadata about the API. The metadata MAY be used by tooling as required. // - https://spec.openapis.org/oas/v3.1.0#info-object Info *base.Info `json:"info,omitempty" yaml:"info,omitempty"` // Servers is a slice of Server instances which provide connectivity information to a target server. If the servers // property is not provided, or is an empty array, the default value would be a Server Object with an url value of /. // - https://spec.openapis.org/oas/v3.1.0#server-object Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` // Paths contains all the PathItem definitions for the specification. // The available paths and operations for the API, The most important part of ths spec. // - https://spec.openapis.org/oas/v3.1.0#paths-object Paths *Paths `json:"paths,omitempty" yaml:"paths,omitempty"` // Components is an element to hold various schemas for the document. // - https://spec.openapis.org/oas/v3.1.0#components-object Components *Components `json:"components,omitempty" yaml:"components,omitempty"` // Security contains global security requirements/roles for the specification // A declaration of which security mechanisms can be used across the API. The list of values includes alternative // security requirement objects that can be used. Only one of the security requirement objects need to be satisfied // to authorize a request. Individual operations can override this definition. To make security optional, // an empty security requirement ({}) can be included in the array. // - https://spec.openapis.org/oas/v3.1.0#security-requirement-object Security []*base.SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"` // Tags is a slice of base.Tag instances defined by the specification // A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on // their order by the parsing tools. Not all tags that are used by the Operation Object must be declared. // The tags that are not declared MAY be organized randomly or based on the tools’ logic. // Each tag name in the list MUST be unique. // - https://spec.openapis.org/oas/v3.1.0#tag-object Tags []*base.Tag `json:"tags,omitempty" yaml:"tags,omitempty"` // ExternalDocs is an instance of base.ExternalDoc for.. well, obvious really, innit. // - https://spec.openapis.org/oas/v3.1.0#external-documentation-object ExternalDocs *base.ExternalDoc `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` // Extensions contains all custom extensions defined for the top-level document. Extensions map[string]any `json:"-" yaml:"-"` // JsonSchemaDialect is a 3.1+ property that sets the dialect to use for validating *base.Schema definitions // The default value for the $schema keyword within Schema Objects contained within this OAS document. // This MUST be in the form of a URI. // - https://spec.openapis.org/oas/v3.1.0#schema-object JsonSchemaDialect string `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"` // Webhooks is a 3.1+ property that is similar to callbacks, except, this defines incoming webhooks. // The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. // Closely related to the callbacks feature, this section describes requests initiated other than by an API call, // for example by an out-of-band registration. The key name is a unique string to refer to each webhook, // while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider // and the expected responses. An example is available. Webhooks map[string]*PathItem `json:"webhooks,omitempty" yaml:"webhooks,omitempty"` // Index is a reference to the *index.SpecIndex that was created for the document and used // as a guide when building out the Document. Ideal if further processing is required on the model and // the original details are required to continue the work. // // This property is not a part of the OpenAPI schema, this is custom to libopenapi. Index *index.SpecIndex `json:"-" yaml:"-"` // contains filtered or unexported fields }
Document represents a high-level OpenAPI 3 document (both 3.0 & 3.1). A Document is the root of the specification.
func NewDocument ¶
NewDocument will create a new high-level Document from a low-level one.
func (*Document) GoLow ¶
GoLow returns the low-level Document that was used to create the high level one.
func (*Document) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Document object.
type Encoding ¶
type Encoding struct { ContentType string `json:"contentType,omitempty" yaml:"contentType,omitempty"` Headers map[string]*Header `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"` // contains filtered or unexported fields }
Encoding represents an OpenAPI 3+ Encoding object
func NewEncoding ¶
NewEncoding creates a new instance of Encoding from a low-level one.
func (*Encoding) GoLow ¶
GoLow returns the low-level Encoding instance used to create the high-level one.
func (*Encoding) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Encoding instance that was used to create the high-level one, with no type
func (*Encoding) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Encoding object.
type Header ¶
type Header struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,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"` Schema *highbase.SchemaProxy `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` Examples map[string]*highbase.Example `json:"examples,omitempty" yaml:"examples,omitempty"` Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Header represents a high-level OpenAPI 3+ Header object that is backed by a low-level one.
func (*Header) GoLow ¶
GoLow returns the low-level Header instance used to create the high-level one.
func (*Header) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Header instance that was used to create the high-level one, with no type
func (*Header) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Header object.
type Link ¶
type Link struct { OperationRef string `json:"operationRef,omitempty" yaml:"operationRef,omitempty"` OperationId string `json:"operationId,omitempty" yaml:"operationId,omitempty"` Parameters map[string]string `json:"parameters,omitempty" yaml:"parameters,omitempty"` RequestBody string `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Server *Server `json:"server,omitempty" yaml:"server,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Link represents a high-level OpenAPI 3+ Link object that is backed by a low-level one.
The Link object represents a possible design-time link for a response. The presence of a link does not guarantee the caller’s ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.
Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.
For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
func (*Link) GoLow ¶
GoLow will return the low-level Link instance used to create the high-level one.
func (*Link) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Link instance that was used to create the high-level one, with no type
func (*Link) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Link object.
type MediaType ¶
type MediaType struct { Schema *base.SchemaProxy `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` Examples map[string]*base.Example `json:"examples,omitempty" yaml:"examples,omitempty"` Encoding map[string]*Encoding `json:"encoding,omitempty" yaml:"encoding,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
MediaType represents a high-level OpenAPI MediaType object that is backed by a low-level one.
Each Media Type Object provides schema and examples for the media type identified by its key.
func NewMediaType ¶
NewMediaType will create a new high-level MediaType instance from a low-level one.
func (*MediaType) GoLow ¶
GoLow will return the low-level instance of MediaType used to create the high-level one.
func (*MediaType) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level MediaType instance that was used to create the high-level one, with no type
func (*MediaType) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the MediaType object.
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,omitempty" yaml:"scopes,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
OAuthFlow represents a high-level OpenAPI 3+ OAuthFlow object that is backed by a low-level one.
func NewOAuthFlow ¶
NewOAuthFlow creates a new high-level OAuthFlow instance from a low-level one.
func (*OAuthFlow) GoLow ¶
GoLow returns the low-level OAuthFlow instance used to create the high-level one.
func (*OAuthFlow) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Discriminator instance that was used to create the high-level one, with no type
func (*OAuthFlow) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the OAuthFlow object.
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"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
OAuthFlows represents a high-level OpenAPI 3+ OAuthFlows object that is backed by a low-level one.
func NewOAuthFlows ¶
func NewOAuthFlows(flows *low.OAuthFlows) *OAuthFlows
NewOAuthFlows creates a new high-level OAuthFlows instance from a low-level one.
func (*OAuthFlows) GoLow ¶
func (o *OAuthFlows) GoLow() *low.OAuthFlows
GoLow returns the low-level OAuthFlows instance used to create the high-level one.
func (*OAuthFlows) GoLowUntyped ¶ added in v0.7.0
func (o *OAuthFlows) GoLowUntyped() any
GoLowUntyped will return the low-level OAuthFlows instance that was used to create the high-level one, with no type
func (*OAuthFlows) MarshalYAML ¶ added in v0.7.0
func (o *OAuthFlows) MarshalYAML() (interface{}, error)
MarshalYAML will create a ready to render YAML representation of the OAuthFlows object.
func (*OAuthFlows) Render ¶ added in v0.7.0
func (o *OAuthFlows) Render() ([]byte, error)
Render will return a YAML representation of the OAuthFlows object as a byte slice.
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"` ExternalDocs *base.ExternalDoc `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` OperationId string `json:"operationId,omitempty" yaml:"operationId,omitempty"` Parameters []*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"` RequestBody *RequestBody `json:"requestBody,omitempty" yaml:"requestBody,omitempty"` Responses *Responses `json:"responses,omitempty" yaml:"responses,omitempty"` Callbacks map[string]*Callback `json:"callbacks,omitempty" yaml:"callbacks,omitempty"` Deprecated *bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Security []*base.SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Operation is a high-level representation of an OpenAPI 3+ Operation object, backed by a low-level one.
An Operation is perhaps the most important object of the entire specification. Everything of value happens here. The entire being for existence of this library and the specification, is this Operation.
func NewOperation ¶
NewOperation will create a new Operation instance from a low-level one.
func (*Operation) GoLow ¶
GoLow will return the low-level Operation instance that was used to create the high-level one.
func (*Operation) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Discriminator instance that was used to create the high-level one, with no type
func (*Operation) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Operation object.
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"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,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"` Schema *base.SchemaProxy `json:"schema,omitempty" yaml:"schema,omitempty"` Example any `json:"example,omitempty" yaml:"example,omitempty"` Examples map[string]*base.Example `json:"examples,omitempty" yaml:"examples,omitempty"` Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Parameter represents a high-level OpenAPI 3+ Parameter object, that is backed by a low-level one.
A unique parameter is defined by a combination of a name and location.
func NewParameter ¶
NewParameter will create a new high-level instance of a Parameter, using a low-level one.
func (*Parameter) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Discriminator instance that was used to create the high-level one, with no type
func (*Parameter) IsDefaultFormEncoding ¶ added in v0.8.0
IsDefaultFormEncoding will return true if the parameter has no exploded value, or has exploded set to true, and no style or a style set to form. This combination is the default encoding/serialization style for parameters for OpenAPI 3+
func (*Parameter) IsDefaultHeaderEncoding ¶ added in v0.8.0
IsDefaultHeaderEncoding will return true if the parameter has no exploded value, or has exploded set to false, and no style or a style set to simple. This combination is the default encoding/serialization style for header parameters for OpenAPI 3+
func (*Parameter) IsDefaultPathEncoding ¶ added in v0.8.0
IsDefaultPathEncoding will return true if the parameter has no exploded value, or has exploded set to false, and no style or a style set to simple. This combination is the default encoding/serialization style for path parameters for OpenAPI 3+
func (*Parameter) IsExploded ¶ added in v0.8.0
IsExploded will return true if the parameter is exploded, false otherwise.
func (*Parameter) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Encoding object.
type PathItem ¶
type PathItem struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` Get *Operation `json:"get,omitempty" yaml:"get,omitempty"` Put *Operation `json:"put,omitempty" yaml:"put,omitempty"` Post *Operation `json:"post,omitempty" yaml:"post,omitempty"` Delete *Operation `json:"delete,omitempty" yaml:"delete,omitempty"` Options *Operation `json:"options,omitempty" yaml:"options,omitempty"` Head *Operation `json:"head,omitempty" yaml:"head,omitempty"` Patch *Operation `json:"patch,omitempty" yaml:"patch,omitempty"` Trace *Operation `json:"trace,omitempty" yaml:"trace,omitempty"` Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty"` Parameters []*Parameter `json:"parameters,omitempty" yaml:"parameters,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
PathItem represents a high-level OpenAPI 3+ PathItem object backed by a low-level one.
Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
func NewPathItem ¶
NewPathItem creates a new high-level PathItem instance from a low-level one.
func (*PathItem) GetOperations ¶ added in v0.2.7
func (*PathItem) GoLow ¶
GoLow returns the low level instance of PathItem, used to build the high-level one.
func (*PathItem) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level PathItem instance that was used to create the high-level one, with no type
func (*PathItem) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the PathItem object.
type Paths ¶
type Paths struct { PathItems map[string]*PathItem `json:"-" yaml:"-"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Paths represents a high-level OpenAPI 3+ Paths object, that is backed by a low-level one.
Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the Server Object in order to construct the full URL. The Paths MAY be empty, due to Access Control List (ACL) constraints.
func (*Paths) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Paths instance that was used to create the high-level one, with no type
func (*Paths) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Paths object.
type RequestBody ¶
type RequestBody struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"` Required *bool `json:"required,omitempty" yaml:"required,renderZero,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
RequestBody represents a high-level OpenAPI 3+ RequestBody object, backed by a low-level one.
func NewRequestBody ¶
func NewRequestBody(rb *low.RequestBody) *RequestBody
NewRequestBody will create a new high-level RequestBody instance, from a low-level one.
func (*RequestBody) GoLow ¶
func (r *RequestBody) GoLow() *low.RequestBody
GoLow returns the low-level RequestBody instance used to create the high-level one.
func (*RequestBody) GoLowUntyped ¶ added in v0.7.0
func (r *RequestBody) GoLowUntyped() any
GoLowUntyped will return the low-level RequestBody instance that was used to create the high-level one, with no type
func (*RequestBody) MarshalYAML ¶ added in v0.7.0
func (r *RequestBody) MarshalYAML() (interface{}, error)
MarshalYAML will create a ready to render YAML representation of the RequestBody object.
func (*RequestBody) Render ¶ added in v0.7.0
func (r *RequestBody) Render() ([]byte, error)
Render will return a YAML representation of the RequestBody object as a byte slice.
type Response ¶
type Response struct { Description string `json:"description,omitempty" yaml:"description,omitempty"` Headers map[string]*Header `json:"headers,omitempty" yaml:"headers,omitempty"` Content map[string]*MediaType `json:"content,omitempty" yaml:"content,omitempty"` Links map[string]*Link `json:"links,omitempty" yaml:"links,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Response represents a high-level OpenAPI 3+ Response object that is backed by a low-level one.
Describes a single response from an API Operation, including design-time, static links to operations based on the response.
func NewResponse ¶
NewResponse creates a new high-level Response object that is backed by a low-level one.
func (*Response) GoLow ¶
GoLow returns the low-level Response object that was used to create the high-level one.
func (*Response) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Response instance that was used to create the high-level one, with no type
func (*Response) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Response object.
type Responses ¶
type Responses struct { Codes map[string]*Response `json:"-" yaml:"-"` Default *Response `json:"default,omitempty" yaml:"default,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Responses represents a high-level OpenAPI 3+ Responses object that is backed by a low-level one.
It's a container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
The specification is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors.
The default MAY be used as a default response object for all HTTP codes that are not covered individually by the Responses Object.
The Responses Object MUST contain at least one response code, and if only one response code is provided it SHOULD be the response for a successful operation call.
func NewResponses ¶
NewResponses will create a new high-level Responses instance from a low-level one. It operates asynchronously internally, as each response may be considerable in complexity.
func (*Responses) FindResponseByCode ¶
FindResponseByCode is a shortcut for looking up code by an integer vs. a string
func (*Responses) GoLow ¶
GoLow returns the low-level Response object used to create the high-level one.
func (*Responses) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Responses instance that was used to create the high-level one, with no type
func (*Responses) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Responses object.
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"` OpenIdConnectUrl string `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
SecurityScheme represents a high-level OpenAPI 3+ SecurityScheme object that is backed by a low-level one.
Defines a security scheme that can be used by the operations.
Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2’s common flows (implicit, password, client credentials and authorization code) as defined in RFC6749 (https://www.rfc-editor.org/rfc/rfc6749), and OpenID Connect Discovery. Please note that as of 2020, the implicit flow is about to be deprecated by OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
func NewSecurityScheme ¶
func NewSecurityScheme(ss *low.SecurityScheme) *SecurityScheme
NewSecurityScheme creates a new high-level SecurityScheme from a low-level one.
func (*SecurityScheme) GoLow ¶
func (s *SecurityScheme) GoLow() *low.SecurityScheme
GoLow returns the low-level SecurityScheme that was used to create the high-level one.
func (*SecurityScheme) GoLowUntyped ¶ added in v0.7.0
func (s *SecurityScheme) GoLowUntyped() any
GoLowUntyped will return the low-level SecurityScheme instance that was used to create the high-level one, with no type
func (*SecurityScheme) MarshalYAML ¶ added in v0.7.0
func (s *SecurityScheme) MarshalYAML() (interface{}, error)
MarshalYAML will create a ready to render YAML representation of the Response object.
func (*SecurityScheme) Render ¶ added in v0.7.0
func (s *SecurityScheme) Render() ([]byte, error)
Render will return a YAML representation of the SecurityScheme object as a byte slice.
type Server ¶
type Server struct { URL string `json:"url,omitempty" yaml:"url,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Variables map[string]*ServerVariable `json:"variables,omitempty" yaml:"variables,omitempty"` Extensions map[string]any `json:"-" yaml:"-"` // contains filtered or unexported fields }
Server represents a high-level OpenAPI 3+ Server object, that is backed by a low level one.
func (*Server) GoLow ¶
GoLow returns the low-level Server instance that was used to create the high-level one
func (*Server) GoLowUntyped ¶ added in v0.7.0
GoLowUntyped will return the low-level Server instance that was used to create the high-level one, with no type
func (*Server) MarshalYAML ¶ added in v0.7.0
MarshalYAML will create a ready to render YAML representation of the Server object.
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"` // contains filtered or unexported fields }
ServerVariable represents a high-level OpenAPI 3+ ServerVariable object, that is backed by a low-level one.
ServerVariable is an object representing a Server Variable for server URL template substitution. - https://spec.openapis.org/oas/v3.1.0#server-variable-object
func NewServerVariable ¶
func NewServerVariable(variable *low.ServerVariable) *ServerVariable
NewServerVariable will return a new high-level instance of a ServerVariable from a low-level one.
func (*ServerVariable) GoLow ¶
func (s *ServerVariable) GoLow() *low.ServerVariable
GoLow returns the low-level ServerVariable used to create the high\-level one.
func (*ServerVariable) GoLowUntyped ¶ added in v0.7.0
func (s *ServerVariable) GoLowUntyped() any
GoLowUntyped will return the low-level ServerVariable instance that was used to create the high-level one, with no type
func (*ServerVariable) MarshalYAML ¶ added in v0.7.0
func (s *ServerVariable) MarshalYAML() (interface{}, error)
MarshalYAML will create a ready to render YAML representation of the ServerVariable object.
func (*ServerVariable) Render ¶ added in v0.7.0
func (s *ServerVariable) Render() ([]byte, error)
Render will return a YAML representation of the ServerVariable object as a byte slice.