Documentation
¶
Index ¶
- func Convert(i interface{}) interface{}
- func ConvertArray(in []interface{}) []interface{}
- type Callback
- type CallbackFields
- type Components
- type ComponentsFields
- type Contact
- type ContactFields
- type Discriminator
- type Encoding
- type EncodingFields
- type Example
- type ExampleFields
- type ExternalDocumentation
- type ExternalDocumentationFields
- type Header
- type Info
- type InfoFields
- type License
- type LicenseFields
- type Link
- type LinkFields
- type MediaType
- type MediaTypeFields
- type OAuthFlow
- type OAuthFlowFields
- type OAuthFlows
- type OAuthFlowsFields
- type OpenAPI
- type OpenAPIFields
- type Operation
- type OperationFields
- type Parameter
- type ParameterFields
- type PathItem
- type PathItemFields
- type Paths
- type PathsFields
- type RequestBody
- type RequestBodyFields
- type Response
- type ResponseFields
- type Responses
- type ResponsesFields
- type Schema
- type SchemaFields
- type SecurityRequirement
- type SecurityScheme
- type SecuritySchemeFields
- type Server
- type ServerFields
- type ServerVariable
- type ServerVariableFields
- type SpecificationExtensions
- type Tag
- type TagFields
- type XML
- type XMLFields
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Convert ¶
func Convert(i interface{}) interface{}
Convert changes all the `map[interface{}]interface{}` values into `map[string]interface{}` and whole numbers (float64) into integers.
func ConvertArray ¶
func ConvertArray(in []interface{}) []interface{}
Types ¶
type Callback ¶
type Callback struct { CallbackFields SpecificationExtensions }
A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses.
func (Callback) MarshalJSON ¶
func (Callback) MarshalYAML ¶
func (*Callback) UnmarshalJSON ¶
func (*Callback) UnmarshalYAML ¶
type CallbackFields ¶
type Components ¶
type Components struct { ComponentsFields SpecificationExtensions }
Components 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.
Key must match `^[a-zA-Z0-9\.\-_]+$`.
func (Components) MarshalJSON ¶
func (c Components) MarshalJSON() ([]byte, error)
func (Components) MarshalYAML ¶
func (c Components) MarshalYAML() (interface{}, error)
func (*Components) UnmarshalJSON ¶
func (c *Components) UnmarshalJSON(data []byte) error
func (*Components) UnmarshalYAML ¶
func (c *Components) UnmarshalYAML(data []byte) error
type ComponentsFields ¶
type ComponentsFields struct { // An object to hold reusable Schema Objects. Schemas map[string]Schema // An object to hold reusable Response Objects. Responses map[string]Response // An object to hold reusable Parameter Objects. Parameters map[string]Parameter // An object to hold reusable Example Objects. Examples map[string]Example // An object to hold reusable RequestBody Objects. RequestBodies map[string]RequestBody `yaml:"requestBodies"` // An object to hold reusable Header Objects. Headers map[string]Header // An object to hold reusable SecurityScheme Objects. SecuritySchemes map[string]SecurityScheme `yaml:"securitySchemes"` // An object to hold reusable Link Objects. Links map[string]Link // An object to hold reusable Callback Objects. Callbacks map[string]Callback }
type Contact ¶
type Contact struct { ContactFields SpecificationExtensions }
Contact information for the exposed API.
func (Contact) MarshalJSON ¶
func (Contact) MarshalYAML ¶
func (*Contact) UnmarshalJSON ¶
func (*Contact) UnmarshalYAML ¶
type ContactFields ¶
type Discriminator ¶
type Discriminator struct { // The name of the property in the payload that will hold the discriminator value. PropertyName string `yaml:"propertyName" oas3:"REQUIRED"` // An object to hold mappings between payload values and schema names or references. Mapping map[string]string }
Discriminator can be used to aid in serialization, deserialization, and validation when request bodies or response payloads may be one of a number of different schemas.
type Encoding ¶
type Encoding struct { EncodingFields SpecificationExtensions }
Encoding is an encoding definition applied to a single schema property.
func (Encoding) MarshalJSON ¶
func (Encoding) MarshalYAML ¶
func (*Encoding) UnmarshalJSON ¶
func (*Encoding) UnmarshalYAML ¶
type EncodingFields ¶
type EncodingFields struct { // The Content-Type for encoding a specific property. ContentType string `yaml:"contentType"` // A map allowing additional information to be provided as headers. Headers map[string]Header // Describes how a specific property value will be serialized depending on its type. Style string // When this is true, property values of type array or object generate separate // parameters for each value of the array, or key-value-pair of the map. Explode bool // Determines whether the parameter value SHOULD allow reserved characters, as defined // by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. AllowReserved bool `yaml:"allowReserved"` }
type Example ¶
type Example struct { ExampleFields SpecificationExtensions }
func (Example) MarshalJSON ¶
func (Example) MarshalYAML ¶
func (*Example) UnmarshalJSON ¶
func (*Example) UnmarshalYAML ¶
type ExampleFields ¶
type ExternalDocumentation ¶
type ExternalDocumentation struct { ExternalDocumentationFields SpecificationExtensions }
ExternalDocumentation allows referencing an external resource for extended documentation.
func (ExternalDocumentation) MarshalJSON ¶
func (d ExternalDocumentation) MarshalJSON() ([]byte, error)
func (ExternalDocumentation) MarshalYAML ¶
func (d ExternalDocumentation) MarshalYAML() (interface{}, error)
func (*ExternalDocumentation) UnmarshalJSON ¶
func (d *ExternalDocumentation) UnmarshalJSON(data []byte) error
func (*ExternalDocumentation) UnmarshalYAML ¶
func (d *ExternalDocumentation) UnmarshalYAML(data []byte) error
type Header ¶
type Header struct { ParameterFields SpecificationExtensions }
Header follows the structure of the Parameter Object with the following changes:
- Name must not be specified, it is given in the corresponding headers map.
- In must not be specified, it is implicitly in header.
- All traits that are affected by the location MUST be applicable to a location of header (for example, style).
func (Header) MarshalJSON ¶
func (Header) MarshalYAML ¶
func (*Header) UnmarshalJSON ¶
func (*Header) UnmarshalYAML ¶
type Info ¶
type Info struct { InfoFields SpecificationExtensions }
Info provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
func (Info) MarshalJSON ¶
func (Info) MarshalYAML ¶
func (*Info) UnmarshalJSON ¶
func (*Info) UnmarshalYAML ¶
type InfoFields ¶
type InfoFields struct { // The title of the API. Title string `oas3:"REQUIRED"` // A short description of the API. Description string // A URL to the Terms of Service for the API. TermsOfService string `yaml:"termsOfService"` // The contact information for the exposed API. Contact Contact // The license information for the exposed API. License License // The version of the OpenAPI document itself. Version string `oas3:"REQUIRED"` }
type License ¶
type License struct { LicenseFields SpecificationExtensions }
License information for the exposed API.
func (License) MarshalJSON ¶
func (License) MarshalYAML ¶
func (*License) UnmarshalJSON ¶
func (*License) UnmarshalYAML ¶
type LicenseFields ¶
type Link ¶
type Link struct { LinkFields SpecificationExtensions }
Link represents a possible design-time link for a response.
func (Link) MarshalJSON ¶
func (Link) MarshalYAML ¶
func (*Link) UnmarshalJSON ¶
func (*Link) UnmarshalYAML ¶
type LinkFields ¶
type LinkFields struct { // A relative or absolute URI reference to an OAS operation. OperationRef string `yaml:"operationRef"` // The name of an existing, resolvable OAS operation, as defined with a unique // OperationID. OperationID string `yaml:"operationId"` // A map representing parameters to pass to an operation as specified with OperationID // or identified via OperationRef. Parameters map[string]interface{} // A literal value or expression to use as a request body when calling the target // operation. RequestBody interface{} `yaml:"requestBody"` // A description of the link. Description string // A server object to be used by the target operation. Server Server }
type MediaType ¶
type MediaType struct { MediaTypeFields SpecificationExtensions }
MediaType provides a schema and examples for the media type identified by its key.
func (MediaType) MarshalJSON ¶
func (MediaType) MarshalYAML ¶
func (*MediaType) UnmarshalJSON ¶
func (*MediaType) UnmarshalYAML ¶
type MediaTypeFields ¶
type MediaTypeFields struct { // The schema defining the content of the request, response, or parameter. Schema Schema // Example of the media type. Example interface{} // Examples of the media type. Examples map[string]Example // A map between a property name and its encoding information. Encoding map[string]Encoding }
type OAuthFlow ¶
type OAuthFlow struct { OAuthFlowFields SpecificationExtensions }
OAuthFlow allows configuration of the supported OAuth Flows.
func (OAuthFlow) MarshalJSON ¶
func (OAuthFlow) MarshalYAML ¶
func (*OAuthFlow) UnmarshalJSON ¶
func (*OAuthFlow) UnmarshalYAML ¶
type OAuthFlowFields ¶
type OAuthFlowFields struct { // The authorization URL to be used for this flow. AuthorizationURL string `yaml:"authorizationUrl" oas3:"REQUIRED"` // The token URL to be used for this flow. TokenURL string `yaml:"tokenUrl" oas3:"REQUIRED"` // The URL to be used for obtaining refresh tokens. RefreshURL string `yaml:"refreshUrl"` // The available scopes for the OAuth2 security scheme. A map between the scope name // and a short description for it. The map may be empty. Scopes map[string]string `oas3:"REQUIRED"` }
type OAuthFlows ¶
type OAuthFlows struct { OAuthFlowsFields SpecificationExtensions }
OAuthFlows are configuration details for a supported OAuth Flow.
func (OAuthFlows) MarshalJSON ¶
func (f OAuthFlows) MarshalJSON() ([]byte, error)
func (OAuthFlows) MarshalYAML ¶
func (f OAuthFlows) MarshalYAML() (interface{}, error)
func (*OAuthFlows) UnmarshalJSON ¶
func (f *OAuthFlows) UnmarshalJSON(data []byte) error
func (*OAuthFlows) UnmarshalYAML ¶
func (f *OAuthFlows) UnmarshalYAML(data []byte) error
type OAuthFlowsFields ¶
type OAuthFlowsFields struct { // Configuration for the OAuth Implicit flow Implicit OAuthFlow // Configuration for the OAuth Resource Owner Password flow. Password OAuthFlow // Configuration for the OAuth Client Credentials flow. Previously called // `application` in OpenAPI 2.0. ClientCredentials OAuthFlow `yaml:"clientCredentials"` // Configuration for the OAuth Authorization Code flow. Previously called `accessCode` // in OpenAPI 2.0. AuthorizationCode OAuthFlow `yaml:"authorizationCode"` }
type OpenAPI ¶
type OpenAPI struct { OpenAPIFields SpecificationExtensions }
OpenAPI is the root document object of the OpenAPI document.
func (OpenAPI) MarshalJSON ¶
func (OpenAPI) MarshalYAML ¶
func (*OpenAPI) UnmarshalJSON ¶
func (*OpenAPI) UnmarshalYAML ¶
type OpenAPIFields ¶
type OpenAPIFields struct { // This string MUST be the semantic version number of the OpenAPI Specification // version that the OpenAPI document uses. OpenAPI string `yaml:"openapi" oas3:"REQUIRED"` // Provides metadata about the API. Info Info `oas3:"REQUIRED"` // An array of Server Objects, which provide connectivity information to a target // server. The default value would be a Server Object with a url value of `/`. Servers []Server // The available paths and operations for the API. Paths Paths `oas3:"REQUIRED"` // An element to hold various schemas for the specification. Components Components // A declaration of which security mechanisms can be used across the API. Security []SecurityRequirement // A list of tags used by the specification with additional metadata. Tags []Tag // Additional external documentation. ExternalDocs ExternalDocumentation `yaml:"externalDocs"` }
type Operation ¶
type Operation struct { OperationFields SpecificationExtensions }
Operation describes a single API operation on a path.
func (Operation) MarshalJSON ¶
func (Operation) MarshalYAML ¶
func (*Operation) UnmarshalJSON ¶
func (*Operation) UnmarshalYAML ¶
type OperationFields ¶
type OperationFields struct { // A list of tags for API documentation control. Tags []string // A short summary of what the operation does. Summary string // A verbose explanation of the operation behavior. Description string // Additional external documentation for this operation. ExternalDocs ExternalDocumentation `yaml:"externalDocs"` // Unique string used to identify the operation. OperationID string `yaml:"operationId"` // A list of parameters that are applicable for this operation. If a parameter is // already defined at the Path Item, the new definition will override it but can never // remove it. Parameters []Parameter // The request body applicable for this operation. RequestBody RequestBody `yaml:"requestBody"` // The list of possible responses as they are returned from executing this operation. Responses Responses `oas3:"REQUIRED"` // A map of possible out-of band callbacks related to the parent operation. Callbacks map[string]Callback // Declares this operation to be deprecated. Consumers should refrain from usage of // the declared operation. Default value is false. Deprecated bool // A declaration of which security mechanisms can be used for this operation. Security []SecurityRequirement // An alternative server array to service this operation. If an alternative server // object is specified at the PathItem Object or Root level, it will be overridden by // this value. Servers []Server }
type Parameter ¶
type Parameter struct { ParameterFields SpecificationExtensions }
Parameter describes a single operation parameter. A unique parameter is defined by a combination of a name and location.
Parameter Locations There are four possible parameter locations specified by the in field:
- path: Used together with Path Templating, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
- query: Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
- header: Custom headers that are expected as part of the request. Note that RFC7230 states header names are case insensitive.
- cookie: Used to pass a specific cookie value to the API.
func (Parameter) MarshalJSON ¶
func (Parameter) MarshalYAML ¶
func (*Parameter) UnmarshalJSON ¶
func (*Parameter) UnmarshalYAML ¶
type ParameterFields ¶
type ParameterFields struct { // The name of the parameter. Parameter names are case sensitive. Name string `oas3:"REQUIRED"` // The location of the parameter. // Possible values are "query", "header", "path" or "cookie". In string `oas3:"REQUIRED"` // A brief description of the parameter. Description string // Determines whether this parameter is mandatory. Required bool `oas3:"REQUIRED"` // Specifies that a parameter is deprecated and should be transitioned out of usage. // Default value is false. Deprecated bool // Sets the ability to pass empty-valued parameters. AllowEmptyValue bool `yaml:"allowEmptyValue"` // Describes how the parameter value will be serialized depending on the type of the // parameter value. Style string // When this is true, parameter values of type array or object generate separate // parameters for each value of the array or key-value pair of the map. Explode bool // Determines whether the parameter value SHOULD allow reserved characters, as defined // by RFC3986 `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. AllowReserved bool `yaml:"allowReserved"` // The schema defining the type used for the parameter. Schema Schema // Example of the parameter's potential value. Example interface{} // Examples of the parameter's potential value. Examples map[string]Example // A map containing the representations for the parameter. Content map[string]MediaType }
type PathItem ¶
type PathItem struct { PathItemFields SpecificationExtensions }
Describes the operations available on a single path. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
func (PathItem) MarshalJSON ¶
func (PathItem) MarshalYAML ¶
func (*PathItem) UnmarshalJSON ¶
func (*PathItem) UnmarshalYAML ¶
type PathItemFields ¶
type PathItemFields struct { // Allows for an external definition of this path item. Ref string // An optional, string summary, intended to apply to all operations in this path. Summary string // An optional, string description, intended to apply to all operations in this path. Description string // A definition of a GET operation on this path. Get Operation // A definition of a PUT operation on this path. Put Operation // A definition of a POST operation on this path. Post Operation // A definition of a DELETE operation on this path. Delete Operation // A definition of a OPTIONS operation on this path. Options Operation // A definition of a HEAD operation on this path. Head Operation // A definition of a PATCH operation on this path. Patch Operation // A definition of a TRACE operation on this path. Trace Operation // An alternative server array to service all operations in this path. Servers []Server // A list of parameters that are applicable for all the operations described under // this path. Parameters []Parameter }
type Paths ¶
type Paths struct { PathsFields SpecificationExtensions }
Paths 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.
Key is a relative path to an individual endpoint and must begin with a forward slash.
func (Paths) MarshalJSON ¶
func (Paths) MarshalYAML ¶
func (*Paths) UnmarshalJSON ¶
func (*Paths) UnmarshalYAML ¶
type PathsFields ¶
type RequestBody ¶
type RequestBody struct { RequestBodyFields SpecificationExtensions }
RequestBody describes a single request body.
func (RequestBody) MarshalJSON ¶
func (f RequestBody) MarshalJSON() ([]byte, error)
func (RequestBody) MarshalYAML ¶
func (f RequestBody) MarshalYAML() (interface{}, error)
func (*RequestBody) UnmarshalJSON ¶
func (f *RequestBody) UnmarshalJSON(data []byte) error
func (*RequestBody) UnmarshalYAML ¶
func (f *RequestBody) UnmarshalYAML(data []byte) error
type RequestBodyFields ¶
type RequestBodyFields struct { // A brief description of the request body. Description string // The content of the request body. The key is a media type or media type range and // the value describes it. Content map[string]MediaType `oas3:"REQUIRED"` // Determines if the request body is required in the request. Defaults to false. Required bool }
type Response ¶
type Response struct { ResponseFields SpecificationExtensions }
Response describes a single response from an API Operation, including design-time, static links to operations based on the response.
func (Response) MarshalJSON ¶
func (Response) MarshalYAML ¶
func (*Response) UnmarshalJSON ¶
func (*Response) UnmarshalYAML ¶
type ResponseFields ¶
type ResponseFields struct { // A short description of the response. Description string `oas3:"REQUIRED"` // Maps a header name to its definition. Headers map[string]Header // A map containing descriptions of potential response payloads. Content map[string]MediaType // A map of operations links that can be followed from the response. Links map[string]Link }
type Responses ¶
type Responses struct { ResponsesFields SpecificationExtensions }
Responses is a container for the expected responses of an operation.
func (Responses) MarshalJSON ¶
func (Responses) MarshalYAML ¶
func (*Responses) UnmarshalJSON ¶
func (*Responses) UnmarshalYAML ¶
type ResponsesFields ¶
type Schema ¶
type Schema struct { SchemaFields SpecificationExtensions }
Schema allows the definition of input and output data types.
func (Schema) MarshalJSON ¶
func (Schema) MarshalYAML ¶
func (*Schema) UnmarshalJSON ¶
func (*Schema) UnmarshalYAML ¶
type SchemaFields ¶
type SchemaFields map[string]interface{}
type SecurityRequirement ¶
SecurityRequirement lists the required security schemes to execute this operation.
type SecurityScheme ¶
type SecurityScheme struct { SecuritySchemeFields SpecificationExtensions }
SecurityScheme defines a security scheme that can be used by the operations.
func (SecurityScheme) MarshalJSON ¶
func (x SecurityScheme) MarshalJSON() ([]byte, error)
func (SecurityScheme) MarshalYAML ¶
func (x SecurityScheme) MarshalYAML() (interface{}, error)
func (*SecurityScheme) UnmarshalJSON ¶
func (x *SecurityScheme) UnmarshalJSON(data []byte) error
func (*SecurityScheme) UnmarshalYAML ¶
func (x *SecurityScheme) UnmarshalYAML(data []byte) error
type SecuritySchemeFields ¶
type SecuritySchemeFields struct { // The type of the security scheme. Type string `oas3:"REQUIRED"` // A short description for security scheme. Description string // The name of the header, query or cookie parameter to be used. Name string `oas3:"REQUIRED"` // The location of the API key. Valid values are "query", "header" or "cookie". In string `oas3:"REQUIRED"` // The name of the HTTP Authorization scheme to be used in the Authorization header // as defined in RFC7235. Scheme string `oas3:"REQUIRED"` // A hint to the client to identify how the bearer token is formatted. BearerFormat string `yaml:"bearerFormat"` // An object containing configuration information for the flow types supported. Flows OAuthFlows `oas3:"REQUIRED"` // OpenId Connect URL to discover OAuth2 configuration values. OpenIDConnectURL string `yaml:"openIdConnectUrl" oas3:"REQUIRED"` }
type Server ¶
type Server struct { ServerFields SpecificationExtensions }
Server represents a Server.
func (Server) MarshalJSON ¶
func (Server) MarshalYAML ¶
func (*Server) UnmarshalJSON ¶
func (*Server) UnmarshalYAML ¶
type ServerFields ¶
type ServerFields struct { // A URL to the target host. URL string // An optional string describing the host designated by the URL. Description string // A map between a variable name and its value. Variables map[string]ServerVariable }
type ServerVariable ¶
type ServerVariable struct { ServerVariableFields SpecificationExtensions }
ServerVariable represents a Server Variable for server URL template substitution.
func (ServerVariable) MarshalJSON ¶
func (v ServerVariable) MarshalJSON() ([]byte, error)
func (ServerVariable) MarshalYAML ¶
func (v ServerVariable) MarshalYAML() (interface{}, error)
func (*ServerVariable) UnmarshalJSON ¶
func (v *ServerVariable) UnmarshalJSON(data []byte) error
func (*ServerVariable) UnmarshalYAML ¶
func (v *ServerVariable) UnmarshalYAML(data []byte) error
type ServerVariableFields ¶
type ServerVariableFields struct { // An enumeration of string values to be used if the substitution options are from a // limited set. Enum []string // The default value to use for substitution, which shall be sent if an alternate // value is not supplied. Default string `oas3:"REQUIRED"` // An optional description for the server variable Description string }
type SpecificationExtensions ¶
type SpecificationExtensions map[string]interface{}
func (SpecificationExtensions) MarshalJSON ¶
func (e SpecificationExtensions) MarshalJSON() ([]byte, error)
func (SpecificationExtensions) MarshalYAML ¶
func (e SpecificationExtensions) MarshalYAML() (interface{}, error)
func (*SpecificationExtensions) UnmarshalJSON ¶
func (e *SpecificationExtensions) UnmarshalJSON(data []byte) error
func (*SpecificationExtensions) UnmarshalYAML ¶
func (e *SpecificationExtensions) UnmarshalYAML(data []byte) error
type Tag ¶
type Tag struct { TagFields SpecificationExtensions }
Tag adds metadata to a single tag that is used by the Operation Object.
func (Tag) MarshalJSON ¶
func (Tag) MarshalYAML ¶
func (*Tag) UnmarshalJSON ¶
func (*Tag) UnmarshalYAML ¶
type TagFields ¶
type TagFields struct { // The name of the tag. Name string `oas3:"REQUIRED"` // A short description for the tag. Description string // Additional external documentation for this tag. ExternalDocs ExternalDocumentation `yaml:"externalDocs"` }
type XML ¶
type XML struct { XMLFields SpecificationExtensions }
XML allows for more fine-tuned XML model definitions.
func (XML) MarshalJSON ¶
func (XML) MarshalYAML ¶
func (*XML) UnmarshalJSON ¶
func (*XML) UnmarshalYAML ¶
type XMLFields ¶
type XMLFields struct { // Replaces the name of the element/attribute used for the described schema property. Name string // The URI of the namespace definition. Value MUST be in the form of an absolute URI. Namespace string // The prefix to be used for the Name. Prefix string // Declares whether the property definition translates to an attribute instead of an // element. Default value is false. Attribute bool // Signifies whether the array is wrapped, may be used only for an array definition. Wrapped bool }
Source Files
¶
- callback.go
- components.go
- contact.go
- discriminator.go
- encoding.go
- example.go
- externaldoc.go
- header.go
- info.go
- license.go
- link.go
- mediatype.go
- openapi.go
- operation.go
- parameter.go
- paths.go
- requestbody.go
- responses.go
- schema.go
- securityrequirement.go
- securityscheme.go
- server.go
- spec_extensions.go
- tag.go
- util.go
- xml.go