Documentation ¶
Index ¶
- type Components
- type Contact
- type Content
- type Edge
- type Edges
- type ExternalDocs
- type Field
- type Fields
- type Info
- type License
- type Location
- type MediaType
- type MediaTypeObject
- type OAuthFlow
- type OAuthFlows
- type Operation
- type OperationResponse
- type Parameter
- type Path
- type RequestBody
- type Response
- type Schema
- type Security
- type SecurityScheme
- type Spec
- type Tag
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct { Schemas map[string]*Schema `json:"schemas"` Responses map[string]*Response `json:"responses"` Parameters map[string]*Parameter `json:"parameters"` SecuritySchemes map[string]SecurityScheme `json:"securitySchemes,omitempty"` }
Components holds a set of reusable objects for different aspects of the OAS.
type Contact ¶
type Contact struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Email string `json:"email,omitempty"` }
Contact information for the exposed API.
type Edge ¶
An Edge defines an Edge on a Schema. Must contain either Ref or Schema.
func (Edge) MarshalJSON ¶
type ExternalDocs ¶
ExternalDocs allows referencing an external resource for extended documentation.
type Field ¶
type Field struct { *Type Unique bool `json:"-"` Required bool `json:"-"` Example interface{} `json:"example,omitempty"` }
A Field defines a Field on a Schema.
func (Field) MarshalJSON ¶
type Info ¶
type Info struct { Title string `json:"title"` Description string `json:"description"` TermsOfService string `json:"termsOfService"` Contact Contact `json:"contact"` License License `json:"license"` Version string `json:"version"` }
The Info struct provides metadata about the API.
type Location ¶
type Location uint
A Location describes the location of a Parameter in a request object.
Possible values are: InQuery, InHeader, InPath, InCookie.
func (Location) MarshalJSON ¶
func (*Location) UnmarshalJSON ¶
type MediaType ¶
type MediaType string
The MediaType of a MediaTypeObject.
const JSON MediaType = "application/json"
type MediaTypeObject ¶
type MediaTypeObject struct { Unique bool `json:"-"` Ref *Schema `json:"-"` Schema Schema `json:"schema"` }
A MediaTypeObject provides schema and examples for the media type identified by its key.
Currently, only JSON is supported.
func (MediaTypeObject) MarshalJSON ¶
func (o MediaTypeObject) MarshalJSON() ([]byte, error)
type OAuthFlow ¶
type OAuthFlow struct { AuthorizationURL string `json:"authorizationURL,omitempty"` TokenURL string `json:"tokenURL,omitempty"` RefreshURL string `json:"refreshURL,omitempty"` Scopes map[string]string `json:"scopes,omitempty"` }
OAuthFlow configuration details for a supported OAuth Flow.
type OAuthFlows ¶
type OAuthFlows struct { Implicit *OAuthFlow `json:"implicit,omitempty"` Password *OAuthFlow `json:"password,omitempty"` ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty"` AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty"` }
OAuthFlows allows configuration of the supported OAuth Flows.
type Operation ¶
type Operation struct { Summary string `json:"summary,omitempty"` Description string `json:"description,omitempty"` Tags []string `json:"tags,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` OperationID string `json:"operationId"` Parameters []*Parameter `json:"parameters,omitempty"` RequestBody *RequestBody `json:"requestBody,omitempty"` Responses map[string]*OperationResponse `json:"responses"` Deprecated bool `json:"deprecated,omitempty"` Security Security `json:"security,omitempty"` }
Operation describes a single API operation on a Path.
type OperationResponse ¶
OperationResponse Describes a single response from an API Operation. Either Ref or Response must be given.
func (OperationResponse) MarshalJSON ¶
func (r OperationResponse) MarshalJSON() ([]byte, error)
type Parameter ¶
type Parameter struct { Name string `json:"name"` In Location `json:"in"` Description string `json:"description,omitempty"` Required bool `json:"required,omitempty"` Deprecated bool `json:"deprecated,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` Schema *Type `json:"schema"` }
Parameter describes a single operation parameter.
A unique parameter is defined by a combination of a Name and Location.
type Path ¶
type Path struct { Get *Operation `json:"get,omitempty"` Post *Operation `json:"post,omitempty"` Delete *Operation `json:"delete,omitempty"` Patch *Operation `json:"patch,omitempty"` Parameters []Parameter `json:"parameters,omitempty"` }
A Path describes the operations available on a single path.
type RequestBody ¶
type RequestBody struct { Description string `json:"description"` Content Content `json:"content"` }
RequestBody describes a single request body.
type Response ¶
type Response struct { Name string `json:"-"` Description string `json:"description"` Headers map[string]Parameter `json:"headers,omitempty"` Content Content `json:"content,omitempty"` }
Response describes a single response from an API Operation.
type Schema ¶
The Schema Object allows the definition of input and output data types
func (Schema) MarshalJSON ¶
type SecurityScheme ¶
type SecurityScheme struct { Type string `json:"type"` Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` In string `json:"in,omitempty"` Scheme string `json:"scheme,omitempty"` BearerFormat string `json:"bearerFormat,omitempty"` Flows *OAuthFlows `json:"flows,omitempty"` OpenIDConnectURL string `json:"openIDConnectURL,omitempty"` }
SecurityScheme defines a security scheme that can be used by the operations.
type Spec ¶
type Spec struct { Info *Info `json:"info"` Tags []Tag `json:"tags,omitempty"` Paths map[string]*Path `json:"paths"` Components *Components `json:"components"` Security Security `json:"security,omitempty"` ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` }
Spec represents an OpenAPI Specification document https://swagger.io/specification/.
Spec is the root struct representing an OAS document.