Documentation ¶
Overview ¶
Package openapi represents OpenAPI v3 Specification in Go.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Operations []*Operation Components *Components }
API represents parsed OpenAPI spec.
type Components ¶
type Components struct { Parameters map[string]*Parameter Schemas map[string]*jsonschema.Schema RequestBodies map[string]*RequestBody Responses map[string]*Response }
Components represent parsed components of OpenAPI spec.
type Encoding ¶ added in v0.33.0
type Encoding struct { ContentType string Headers map[string]*Header Style ParameterStyle Explode bool AllowReserved bool }
Encoding is Encoding Type Object.
type Example ¶
type Example struct { Ref string `json:"$ref,omitempty"` // ref object Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` Value json.RawMessage `json:"value,omitempty"` ExternalValue string `json:"externalValue,omitempty"` }
Example is an OpenAPI Example.
type MediaType ¶ added in v0.31.0
type MediaType struct { Schema *jsonschema.Schema Example json.RawMessage Examples map[string]*Example Encoding map[string]*Encoding }
MediaType is Media Type Object.
type OAuthFlow ¶
type OAuthFlow struct { AuthorizationURL string TokenURL string RefreshURL string Scopes map[string]string // name -> description }
OAuthFlow is configuration details for a supported OAuth Flow.
type OAuthFlows ¶
type OAuthFlows struct { Implicit *OAuthFlow Password *OAuthFlow ClientCredentials *OAuthFlow AuthorizationCode *OAuthFlow }
OAuthFlows allows configuration of the supported OAuth Flows.
type Operation ¶
type Operation struct { OperationID string // optional Description string // optional HTTPMethod string Path Path Parameters []*Parameter RequestBody *RequestBody // optional // Security requirements. Security []SecurityRequirements // Operation responses. // Map is always non-nil. // // Key can be: // * HTTP Status code // * default // * 1XX, 2XX, 3XX, 4XX, 5XX Responses map[string]*Response }
Operation is an OpenAPI Operation.
type Parameter ¶
type Parameter struct { Ref string Name string Description string Schema *jsonschema.Schema Content *ParameterContent In ParameterLocation Style ParameterStyle Explode bool Required bool }
Parameter is an OpenAPI Operation Parameter.
type ParameterContent ¶ added in v0.35.0
ParameterContent describes OpenAPI Parameter content field.
Parameter "content" field described as a map, and it MUST only contain one entry.
type ParameterLocation ¶
type ParameterLocation string
ParameterLocation defines where OpenAPI parameter is located.
const ( // LocationQuery is "query" parameter location. LocationQuery ParameterLocation = "query" // LocationHeader is "header" parameter location. LocationHeader ParameterLocation = "header" // LocationPath is "path" parameter location. LocationPath ParameterLocation = "path" // LocationCookie is "cookie" parameter location. LocationCookie ParameterLocation = "cookie" )
func (ParameterLocation) Cookie ¶
func (l ParameterLocation) Cookie() bool
Cookie whether parameter location is cookie.
func (ParameterLocation) Header ¶
func (l ParameterLocation) Header() bool
Header whether parameter location is header.
func (ParameterLocation) Path ¶
func (l ParameterLocation) Path() bool
Path whether parameter location is path.
func (ParameterLocation) Query ¶
func (l ParameterLocation) Query() bool
Query whether parameter location is query.
type ParameterStyle ¶
type ParameterStyle string
ParameterStyle is an OpenAPI Parameter style.
const ( PathStyleSimple ParameterStyle = "simple" PathStyleLabel ParameterStyle = "label" PathStyleMatrix ParameterStyle = "matrix" QueryStyleForm ParameterStyle = "form" QueryStyleSpaceDelimited ParameterStyle = "spaceDelimited" QueryStylePipeDelimited ParameterStyle = "pipeDelimited" QueryStyleDeepObject ParameterStyle = "deepObject" HeaderStyleSimple ParameterStyle = "simple" CookieStyleForm ParameterStyle = "form" )
func (ParameterStyle) String ¶
func (s ParameterStyle) String() string
String implements fmt.Stringer.
type RequestBody ¶
type RequestBody struct { Ref string Description string Required bool Content map[string]*MediaType }
RequestBody of an OpenAPI Operation.
type Response ¶
type Response struct { Ref string Description string Headers map[string]*Header Content map[string]*MediaType }
Response is an OpenAPI Response definition.
type Security ¶
type Security struct { Type string Description string Name string In string Scheme string BearerFormat string Flows OAuthFlows OpenIDConnectURL string }
Security is parsed security scheme.
type SecurityRequirements ¶
SecurityRequirements is parsed security requirements.