Documentation ¶
Index ¶
- Variables
- func IsExtensionKey(key string) bool
- func Validate(data []byte) error
- type Boolean
- type Callback
- type CallbackKind
- type CallbackObj
- type Callbacks
- type Components
- type Contact
- type Content
- type Discriminator
- type Encoding
- type Encodings
- type Example
- type ExampleKind
- type ExampleObj
- type Examples
- type Extensions
- func (e Extensions) Decode(dst interface{}) error
- func (e Extensions) DecodeExtension(key string, dst interface{}) error
- func (e Extensions) Extension(name string) (interface{}, bool)
- func (e *Extensions) SetEncodedExtension(key string, val []byte)
- func (e *Extensions) SetExtension(key string, val interface{}) error
- type ExternalDocs
- type Header
- type HeaderKind
- type HeaderObj
- type Headers
- type In
- type Info
- type License
- type Link
- type LinkKind
- type LinkObj
- func (l *LinkObj) DecodeRequestBody(dst interface{}) error
- func (l *LinkObj) LinkKind() LinkKind
- func (l LinkObj) MarshalJSON() ([]byte, error)
- func (l LinkObj) MarshalYAML() (interface{}, error)
- func (l *LinkObj) UnmarshalJSON(data []byte) error
- func (l *LinkObj) UnmarshalYAML(unmarshal func(interface{}) error) error
- type LinkParameters
- func (lp LinkParameters) Decode(dst interface{}) error
- func (lp LinkParameters) DecodeParameter(key string, dst interface{}) error
- func (lp LinkParameters) Has(key string) bool
- func (lp *LinkParameters) Set(key string, value interface{}) error
- func (lp *LinkParameters) SetEncoded(key string, value []byte)
- type Links
- type MediaType
- type Number
- func (n Number) BigFloat(m big.RoundingMode) (*big.Float, error)
- func (n Number) BigInt() (*big.Int, bool)
- func (n Number) BigRat() (*big.Rat, bool)
- func (n Number) Float64() (float64, error)
- func (n Number) Int64() (int64, error)
- func (n Number) MarshalJSON() ([]byte, error)
- func (n Number) String() string
- func (n *Number) UnmarshalJSON(data []byte) error
- type OAuthFlow
- type OAuthFlows
- type OpenAPI
- type OpenAPIs
- type Operation
- type Parameter
- type ParameterList
- type ParameterObj
- type ParameterType
- type Parameters
- type Path
- type PathItems
- type PathKind
- type PathObj
- type PathValue
- type Paths
- type Referencable
- type Reference
- func (r *Reference) CallbackKind() CallbackKind
- func (r *Reference) ExampleKind() ExampleKind
- func (r *Reference) HeaderKind() HeaderKind
- func (r *Reference) LinkKind() LinkKind
- func (r Reference) MarshalYAML() (interface{}, error)
- func (r *Reference) ParameterType() ParameterType
- func (r *Reference) PathKind() PathKind
- func (r *Reference) RequestBodyKind() RequestBodyKind
- func (r *Reference) ResponseKind() ResponseKind
- func (r *Reference) SecuritySchemeKind() SecuritySchemeKind
- func (r *Reference) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Regexp
- type RequestBodies
- type RequestBody
- type RequestBodyKind
- type RequestBodyObj
- func (rb RequestBodyObj) MarshalJSON() ([]byte, error)
- func (rb RequestBodyObj) MarshalYAML() (interface{}, error)
- func (rb *RequestBodyObj) RequestBodyKind() RequestBodyKind
- func (rb *RequestBodyObj) UnmarshalJSON(data []byte) error
- func (rb *RequestBodyObj) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Response
- type ResponseKind
- type ResponseObj
- type Responses
- type Schema
- type SchemaKind
- type SchemaObj
- func (s *SchemaObj) DecodeKeyword(key string, dst interface{}) error
- func (s *SchemaObj) DecodeKeywords(dst interface{}) error
- func (s SchemaObj) Detail() *SchemaObj
- func (s *SchemaObj) IsBool() bool
- func (s *SchemaObj) IsRef() bool
- func (s *SchemaObj) IsStrings() bool
- func (s SchemaObj) MarshalJSON() ([]byte, error)
- func (s SchemaObj) MarshalYAML() (interface{}, error)
- func (s *SchemaObj) SchemaKind() SchemaKind
- func (s *SchemaObj) SetEncodedKeyword(key string, value []byte) error
- func (s *SchemaObj) SetKeyword(key string, value interface{}) error
- func (s *SchemaObj) UnmarshalJSON(data []byte) error
- func (s *SchemaObj) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SchemaSet
- type SchemaType
- type Schemas
- type SecurityRequirement
- type SecurityRequirements
- type SecurityScheme
- type SecuritySchemeKind
- type SecuritySchemeObj
- func (sso SecuritySchemeObj) MarshalJSON() ([]byte, error)
- func (sso SecuritySchemeObj) MarshalYAML() (interface{}, error)
- func (sso SecuritySchemeObj) SecuritySchemeKind() SecuritySchemeKind
- func (sso *SecuritySchemeObj) UnmarshalJSON(data []byte) error
- func (sso *SecuritySchemeObj) UnmarshalYAML(unmarshal func(interface{}) error) error
- type SecuritySchemeType
- type SecuritySchemes
- type Server
- type ServerVariable
- type Style
- type Tag
- type Types
- func (t *Types) Add(typ SchemaType) Types
- func (t Types) Contains(typ SchemaType) bool
- func (t Types) ContainsArray() bool
- func (t Types) ContainsBoolean() bool
- func (t Types) ContainsInteger() bool
- func (t Types) ContainsNull() bool
- func (t Types) ContainsNumber() bool
- func (t Types) ContainsObject() bool
- func (t Types) ContainsString() bool
- func (t Types) IsSingle() bool
- func (t Types) Len() int
- func (t Types) MarshalJSON() ([]byte, error)
- func (t *Types) Remove(typ SchemaType) Types
- func (t *Types) UnmarshalJSON(data []byte) error
- type XML
Constants ¶
This section is empty.
Variables ¶
var ErrLinkParameterNotFound = errors.New("error: link parameter not found")
ErrLinkParameterNotFound is returned if a
var ErrNotReference = errors.New("error: data is not a Reference")
ErrNotReference indicates not a reference
Functions ¶
func IsExtensionKey ¶
IsExtensionKey returns true if the key starts with "x-"
Types ¶
type Boolean ¶
type Boolean bool
Boolean is a bool value, which can be used as a Schema
func (Boolean) SchemaKind ¶
func (b Boolean) SchemaKind() SchemaKind
SchemaKind returns SchemaKindBool
type Callback ¶
type Callback interface {
CallbackKind() CallbackKind
}
Callback can either be a CallbackObj or a Reference
type CallbackKind ¶
type CallbackKind uint8
CallbackKind indicates whether the CallbackObj is a Callback or a Reference
const ( // CallbackKindObj = CallbackObj CallbackKindObj CallbackKind = iota // CallbackKindRef = Reference CallbackKindRef )
type CallbackObj ¶
type CallbackObj struct { Paths PathItems `json:"-"` Extensions `json:"-"` }
CallbackObj is 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. 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.
To describe incoming requests from the API provider independent from another API call, use the webhooks field.
func (*CallbackObj) CallbackKind ¶
func (c *CallbackObj) CallbackKind() CallbackKind
CallbackKind returns CallbackKindCallback
func (CallbackObj) MarshalJSON ¶
func (c CallbackObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (CallbackObj) MarshalYAML ¶
func (c CallbackObj) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*CallbackObj) UnmarshalJSON ¶
func (c *CallbackObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*CallbackObj) UnmarshalYAML ¶
func (c *CallbackObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type Callbacks ¶
Callbacks is a map of reusable Callback Objects.
func (Callbacks) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Callbacks) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*Callbacks) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type Components ¶
type Components struct { // An object to hold reusable Schema Objects. Schemas *Schemas `json:"schemas,omitempty"` // An object to hold reusable Response Objects. Responses *Responses `json:"responses,omitempty"` // An object to hold reusable Parameter Objects. Parameters *Parameters `json:"parameters,omitempty"` // An object to hold reusable Example Objects. Examples *Examples `json:"examples,omitempty"` // An object to hold reusable Request Body Objects. RequestBodies *RequestBodies `json:"requestBodies,omitempty"` // An object to hold reusable Header Objects. Headers *Headers `json:"headers,omitempty"` // An object to hold reusable Security Scheme Objects. SecuritySchemes *SecuritySchemes `json:"securitySchemes,omitempty"` // An object to hold reusable Link Objects. Links *Links `json:"links,omitempty"` // An object to hold reusable Callback Objects. Callbacks *Callbacks `json:"callbacks,omitempty"` // An object to hold reusable Path Item Object. PathItems *PathItems `json:"pathItems,omitempty"` Extensions `json:"-"` }
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.
func (Components) MarshalJSON ¶
func (c Components) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (Components) MarshalYAML ¶
func (c Components) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*Components) UnmarshalJSON ¶
func (c *Components) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*Components) UnmarshalYAML ¶
func (c *Components) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type Contact ¶
type Contact struct { // The identifying name of the contact person/organization. Name string `json:"name,omitempty"` // The URL pointing to the contact information. This MUST be in the form of // a URL. URL string `json:"url,omitempty"` // The email address of the contact person/organization. This MUST be in the // form of an email address. Emails string `json:"email,omitempty"` Extensions `json:"-"` }
Contact information for the exposed API.
func (Contact) MarshalJSON ¶
MarshalJSON marshals JSON
func (Contact) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Contact) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*Contact) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type Content ¶
Content is a map containing descriptions of potential response payloads. The key is a media type or media type range and the value describes it. For responses that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
type Discriminator ¶
type Discriminator struct { // The name of the property in the payload that will hold the discriminator // value. // // *required PropertyName string `json:"propertyName"` // An object to hold mappings between payload values and schema names or // references. Mapping map[string]string `json:"mapping,omitempty"` Extensions `json:"-"` }
Discriminator can be used to aid in serialization, deserialization, and validation of request bodies or response payloads which may be one of a number of different schemas. The discriminator is a specific object in a schema which is used to inform the consumer of the document of an alternative schema based on the value associated with it.
func (Discriminator) MarshalJSON ¶
func (d Discriminator) MarshalJSON() ([]byte, error)
MarshalJSON marshals d into JSON
func (Discriminator) MarshalYAML ¶
func (d Discriminator) MarshalYAML() (interface{}, error)
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*Discriminator) UnmarshalJSON ¶
func (d *Discriminator) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json into d
func (*Discriminator) UnmarshalYAML ¶
func (d *Discriminator) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals yaml into s
type Encoding ¶
type Encoding struct { // The Content-Type for encoding a specific property. Default value depends // on the property type: // // - for object - application/json; // - for array – the default is defined based on the inner type; // - for all other cases the default is application/octet-stream. // The value can be a specific media type (e.g. application/json), a // wildcard media type (e.g. image/*), or a comma-separated list of the two // types. ContentType string `json:"contentType,omitempty"` // A map allowing additional information to be provided as headers, for // example Content-Disposition. Content-Type is described separately and // SHALL be ignored in this section. This property SHALL be ignored if the // request body media type is not a multipart. Headers Headers `json:"headers,omitempty"` // Describes how a specific property value will be serialized depending on // its type. See Parameter Object for details on the style property. The // behavior follows the same values as query parameters, including default // values. This property SHALL be ignored if the request body media type is // not application/x-www-form-urlencoded or multipart/form-data. If a value // is explicitly defined, then the value of contentType (implicit or // explicit) SHALL be ignored. Style Style `json:"style,omitempty"` // 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. For other types of properties this property has no effect. When // style is form, the default value is true. For all other styles, the // default value is false. This property SHALL be ignored if the request // body media type is not application/x-www-form-urlencoded or // multipart/form-data. If a value is explicitly defined, then the value of // contentType (implicit or explicit) SHALL be ignored. Explode *bool `json:"explode,omitempty"` // Determines whether the parameter value SHOULD allow reserved characters, // as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without // percent-encoding. The default value is false. This property SHALL be // ignored if the request body media type is not // application/x-www-form-urlencoded or multipart/form-data. If a value is // explicitly defined, then the value of contentType (implicit or explicit) // SHALL be ignored. AllowReserved *bool `json:"allowReserved,omitempty"` Extensions `json:"-"` }
Encoding definition applied to a single schema property.
func (Encoding) MarshalJSON ¶
MarshalJSON marshals e into JSON
func (Encoding) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Encoding) UnmarshalJSON ¶
UnmarshalJSON unmarshals json into e
func (*Encoding) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type Encodings ¶
Encodings is a map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
type Example ¶
type Example interface {
ExampleKind() ExampleKind
}
Example is either an Example or a Reference
type ExampleKind ¶
type ExampleKind uint8
ExampleKind indicates wheter the ExampleObj is an Example or a Reference
const ( // ExampleKindObj indicates an ExampleObj ExampleKindObj ExampleKind = iota // ExampleKindRef indicates a Reference ExampleKindRef )
type ExampleObj ¶
type ExampleObj struct { // Short description for the example. Summary string `json:"summary,omitempty"` // Long description for the example. CommonMark syntax MAY be used for rich // text representation. Description string `json:"description,omitempty"` // Any embedded literal example. The value field and externalValue field are // mutually exclusive. To represent examples of media types that cannot // naturally represented in JSON or YAML, use a string value to contain the // example, escaping where necessary. Value json.RawMessage `json:"value,omitempty"` // A URI that points to the literal example. This provides the capability to // reference examples that cannot easily be included in JSON or YAML // documents. The value field and externalValue field are mutually // exclusive. See the rules for resolving Relative References. ExternalValue string `json:"externalValue,omitempty"` Extensions `json:"-"` }
ExampleObj is an example for various api interactions such as Responses
In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.
func (ExampleObj) ExampleKind ¶
func (e ExampleObj) ExampleKind() ExampleKind
ExampleKind returns ExampleKindObj
func (ExampleObj) MarshalJSON ¶
func (e ExampleObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (ExampleObj) MarshalYAML ¶
func (e ExampleObj) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*ExampleObj) UnmarshalJSON ¶
func (e *ExampleObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*ExampleObj) UnmarshalYAML ¶
func (e *ExampleObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type Examples ¶
Examples is an object to hold reusable Examples.
func (*Examples) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
type Extensions ¶
type Extensions map[string]json.RawMessage
Extensions for OpenAPI
While the OpenAPI Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points.
The extensions properties are implemented as patterned fields that are always prefixed by "x-".
Field Pattern Type Description ^x- Any Allows extensions to the OpenAPI Schema. The field name MUST begin with x-, for example, x-internal-id. Field names beginning x-oai- and x-oas- are reserved for uses defined by the OpenAPI Initiative. The value can be null, a primitive, an array or an object. The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced).
Security Filtering Some objects in the OpenAPI Specification MAY be declared and remain empty, or be completely removed, even though they are inherently the core of the API documentation.
The reasoning is to allow an additional layer of access control over the documentation. While not part of the specification itself, certain libraries MAY choose to allow access to parts of the documentation based on some form of authentication/authorization.
Two examples of this:
The Paths Object MAY be present but empty. It may be counterintuitive, but this may tell the viewer that they got to the right place, but can't access any documentation. They would still have access to at least the Info Object which may contain additional information regarding authentication. The Path Item Object MAY be empty. In this case, the viewer will be aware that the path exists, but will not be able to see any of its operations or parameters. This is different from hiding the path itself from the Paths Object, because the user will be aware of its existence. This allows the documentation provider to finely control what the viewer can see.
func (Extensions) Decode ¶
func (e Extensions) Decode(dst interface{}) error
Decode decodes all extensions into dst.
func (Extensions) DecodeExtension ¶
func (e Extensions) DecodeExtension(key string, dst interface{}) error
DecodeExtension decodes extension at key into dst.
func (Extensions) Extension ¶
func (e Extensions) Extension(name string) (interface{}, bool)
Extension returns an extension by name
func (*Extensions) SetEncodedExtension ¶
func (e *Extensions) SetEncodedExtension(key string, val []byte)
SetEncodedExtension sets val to key
func (*Extensions) SetExtension ¶
func (e *Extensions) SetExtension(key string, val interface{}) error
SetExtension encodes val and sets the result to key
type ExternalDocs ¶
type ExternalDocs struct { // The URL for the target documentation. This MUST be in the form of a URL. // // *required* URL string `json:"url"` // A description of the target documentation. CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty" yaml:"description,omitempty"` Extensions `json:"-"` }
ExternalDocs allows referencing an external resource for extended documentation.
func (ExternalDocs) MarshalJSON ¶
func (ed ExternalDocs) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (ExternalDocs) MarshalYAML ¶
func (ed ExternalDocs) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*ExternalDocs) UnmarshalJSON ¶
func (ed *ExternalDocs) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*ExternalDocs) UnmarshalYAML ¶
func (ed *ExternalDocs) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type Header ¶
type Header interface {
HeaderKind() HeaderKind
}
Header is either a Header or a Reference
type HeaderKind ¶
type HeaderKind uint8
HeaderKind distinguishes between Header and Reference
const ( // HeaderKindObj = Header HeaderKindObj HeaderKind = iota // HeaderKindRef = Reference HeaderKindRef )
type HeaderObj ¶
type HeaderObj struct { // A brief description of the parameter. This could contain examples of use. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // Determines whether this parameter is mandatory. If the parameter location // is "path", this property is REQUIRED and its value MUST be true. // Otherwise, the property MAY be included and its default value is false. Required *bool `json:"required,omitempty"` // Specifies that a parameter is deprecated and SHOULD be transitioned out // of usage. Default value is false. Deprecated *bool `json:"deprecated,omitempty"` // Sets the ability to pass empty-valued parameters. This is valid only for // query parameters and allows sending a parameter with an empty value. // Default value is false. If style is used, and if behavior is n/a (cannot // be serialized), the value of allowEmptyValue SHALL be ignored. Use of // this property is NOT RECOMMENDED, as it is likely to be removed in a // later revision. AllowEmptyValue *bool `json:"allowEmptyValue,omitempty"` // Describes how the parameter value will be serialized depending on the // type of the parameter value. // Default values (based on value of in): // - for query - form; // - for path - simple; // - for header - simple; // - for cookie - form. Style string `json:"style,omitempty"` // 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. For other types of parameters this property has no effect. When // style is form, the default value is true. For all other styles, the // default value is false. Explode *bool `json:"explode,omitempty"` // Determines whether the parameter value SHOULD allow reserved characters, // as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without // percent-encoding. This property only applies to parameters with an in // value of query. The default value is false. AllowReserved *bool `json:"allowReserved,omitempty"` // The schema defining the type used for the parameter. Schema *SchemaObj `json:"schema,omitempty"` // Examples of the parameter's potential value. Each example SHOULD // contain a value in the correct format as specified in the parameter // encoding. The examples field is mutually exclusive of the example // field. Furthermore, if referencing a schema that contains an example, // the examples value SHALL override the example provided by the schema. Examples map[string]Example `json:"examples,omitempty"` // OpenAPI extensions Extensions `json:"-"` }
HeaderObj 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 (HeaderObj) HeaderKind ¶
func (h HeaderObj) HeaderKind() HeaderKind
HeaderKind distinguishes h as a Header by returning HeaderKindHeader
func (HeaderObj) MarshalJSON ¶
MarshalJSON marshals h into JSON
func (HeaderObj) MarshalYAML ¶
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*HeaderObj) UnmarshalJSON ¶
UnmarshalJSON unmarshals json into h
func (*HeaderObj) UnmarshalYAML ¶
UnmarshalYAML unmarshals yaml into s
type Headers ¶
Headers holds reusable HeaderObjs.
func (Headers) MarshalYAML ¶
MarshalYAML marshals p into YAML
func (*Headers) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into p
func (*Headers) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into p
type In ¶
type In string
In is a location where a paremeter may be located in a request.
const ( // InQuery - Parameters that are appended to the URL. For example, in // /items?id=###, the query parameter is id. InQuery In = "query" // InHeader - Custom headers that are expected as part of the request. Note // that RFC7230 states header names are case insensitive. InHeader In = "header" // InCookie - Used to pass a specific cookie value to the API. InCookie In = "cookie" // InPath - 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. InPath In = "path" )
type Info ¶
type Info struct { // The title of the API. // // *required* Title string `json:"title" yaml:"title"` // A short summary of the API. Summary string `json:"summary,omitempty" yaml:"summary,omitempty"` // A description of the API. CommonMark syntax MAY be used for rich text // representation. Description string `json:"description,omitempty" yaml:"description,omitempty"` // A URL to the Terms of Service for the API. This MUST be in the form of a URL. TermsOfService string `json:"termsOfService,omitempty" bson:"termsOfService,omitempty"` // The contact information for the exposed API. Contact *Contact `json:"contact,omitempty" bson:"contact,omitempty"` // License information for the exposed API. License *License `json:"license,omitempty" bson:"license,omitempty"` // Version of the OpenAPI document (which is distinct from the OpenAPI // Specification version or the API implementation version). // // *required* Version string `json:"version" yaml:"version"` Extensions `json:"-"` }
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) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Info) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*Info) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into i
type License ¶
type License struct { // The license name used for the API. // // *required* Name string `json:"name" yaml:"name"` // An SPDX license expression for the API. The identifier field is mutually // exclusive of the url field. Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` // A URL to the license used for the API. This MUST be in the form of a URL. // The url field is mutually exclusive of the identifier field. URL string `json:"url,omitempty" yaml:"url,omitempty"` }
License information for the exposed API.
type LinkObj ¶
type LinkObj struct { // A relative or absolute URI reference to an OAS operation. This field is // mutually exclusive of the operationId field, and MUST point to an // Operation Object. Relative operationRef values MAY be used to locate an // existing Operation Object in the OpenAPI definition. See the rules for // resolving Relative References. OperationRef string `json:"operationRef,omitempty"` // The name of an existing, resolvable OAS operation, as defined with a // unique operationId. This field is mutually exclusive of the operationRef // field. OperationID string `json:"operationId,omitempty"` // A map representing parameters to pass to an operation as specified with // operationId or identified via operationRef. The key is the parameter name // to be used, whereas the value can be a constant or an expression to be // evaluated and passed to the linked operation. The parameter name can be // qualified using the parameter location [{in}.]{name} for operations that // use the same parameter name in different locations (e.g. path.id). Parameters LinkParameters `json:"parameters,omitempty"` // A literal value or {expression} to use as a request body when calling the // target operation. RequestBody json.RawMessage `json:"requestBody,omitempty"` // A description of the link. CommonMark syntax MAY be used for rich text // representation. Description string `json:"description,omitempty"` Extensions `json:"-"` }
LinkObj 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 (*LinkObj) DecodeRequestBody ¶
DecodeRequestBody decodes l.RequestBody into dst
dst should be a pointer to a concrete type
func (LinkObj) MarshalJSON ¶
MarshalJSON marshals JSON
func (LinkObj) MarshalYAML ¶
MarshalYAML marshals YAML
func (*LinkObj) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*LinkObj) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type LinkParameters ¶
type LinkParameters map[string]json.RawMessage
LinkParameters is a map representing parameters to pass to an operation as specified with operationId or identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
func (LinkParameters) Decode ¶
func (lp LinkParameters) Decode(dst interface{}) error
Decode decodes all parameters into dst
func (LinkParameters) DecodeParameter ¶
func (lp LinkParameters) DecodeParameter(key string, dst interface{}) error
DecodeParameter decodes a given parameter by name. It returns an error if the parameter can not be found.
func (LinkParameters) Has ¶
func (lp LinkParameters) Has(key string) bool
Has returns true if key exists in lp
func (*LinkParameters) Set ¶
func (lp *LinkParameters) Set(key string, value interface{}) error
Set concrete object to lp. To add JSON, use SetEncoded
func (*LinkParameters) SetEncoded ¶
func (lp *LinkParameters) SetEncoded(key string, value []byte)
SetEncoded sets the value of key to value.
Value should be a json encoded byte slice
type Links ¶
Links is a map to hold reusable LinkObjs.
func (*Links) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
type MediaType ¶
type MediaType struct { // The schema defining the content of the request, response, or parameter. Schema Schema `json:"schema,omitempty"` // Example of the media type. The example object SHOULD be in the correct // format as specified by the media type. The example field is mutually // exclusive of the examples field. Furthermore, if referencing a schema // which contains an example, the example value SHALL override the example // provided by the schema. Example json.RawMessage `json:"example,omitempty"` // Examples of the media type. Each example object SHOULD match the media // type and specified schema if present. The examples field is mutually // exclusive of the example field. Furthermore, if referencing a schema // which contains an example, the examples value SHALL override the example // provided by the schema. Examples Examples `json:"examples,omitempty"` // A map between a property name and its encoding information. The key, // being the property name, MUST exist in the schema as a property. The // encoding object SHALL only apply to requestBody objects when the media // type is multipart or application/x-www-form-urlencoded. Encoding Encodings `json:"encoding,omitempty"` Extensions `json:"-"` }
MediaType provides schema and examples for the media type identified by its key.
func (MediaType) MarshalJSON ¶
MarshalJSON marshals mt into JSON
func (MediaType) MarshalYAML ¶
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*MediaType) UnmarshalJSON ¶
UnmarshalJSON unmarshals json into mt
func (*MediaType) UnmarshalYAML ¶
UnmarshalYAML unmarshals yaml into mt
type Number ¶
A Number represents a JSON / YAML number literal.
func (*Number) UnmarshalJSON ¶
UnmarshalJSON unmarshals json
type OAuthFlow ¶
type OAuthFlow struct { // The authorization URL to be used for this flow. This MUST be in the form // of a URL. The OAuth2 standard requires the use of TLS. // // Applies to: OAuth2 ("implicit", "authorizationCode") // // *required* AuthorizationURL string `json:"authorizationUrl,omitempty"` // The token URL to be used for this flow. This MUST be in the form of a // URL. The OAuth2 standard requires the use of TLS. // // Applies to: OAuth2Flow ("password", "clientCredentials", "authorizationCode") // // *required* TokenURL string `json:"tokenUrl,omitempty"` // The URL to be used for obtaining refresh tokens. This MUST be in the form // of a URL. The OAuth2 standard requires the use of TLS. RefreshURL string `json:"refreshUrl,omitempty"` // 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. // // *required* Scopes map[string]string `json:"scopes"` Extensions `json:"-"` }
OAuthFlow configuration details for a supported OAuth Flow
func (OAuthFlow) MarshalJSON ¶
MarshalJSON marshals json
func (OAuthFlow) MarshalYAML ¶
MarshalYAML marshals YAML
func (*OAuthFlow) UnmarshalJSON ¶
UnmarshalJSON unmarshals json
func (*OAuthFlow) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type OAuthFlows ¶
type OAuthFlows struct { // Configuration for the OAuth Implicit flow Implicit *OAuthFlow `json:"implicit,omitempty"` // Configuration for the OAuth Resource Owner Password flow Password *OAuthFlow `json:"password,omitempty"` // Configuration for the OAuth Client Credentials flow. Previously called // application in OpenAPI 2.0. ClientCredentials *OAuthFlow `json:"clientCredentials,omitempty"` // Configuration for the OAuth Authorization Code flow. Previously called accessCode in OpenAPI 2.0. AuthorizationCode *OAuthFlow `json:"authorizationCode,omitempty"` Extensions `json:"-"` }
OAuthFlows allows configuration of the supported OAuth Flows.
func (OAuthFlows) MarshalJSON ¶
func (oaf OAuthFlows) MarshalJSON() ([]byte, error)
MarshalJSON marshals json
func (OAuthFlows) MarshalYAML ¶
func (oaf OAuthFlows) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*OAuthFlows) UnmarshalJSON ¶
func (oaf *OAuthFlows) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json
func (*OAuthFlows) UnmarshalYAML ¶
func (oaf *OAuthFlows) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type OpenAPI ¶
type OpenAPI struct { // Version - OpenAPI Version // // This string MUST be the version number of the OpenAPI // Specification that the OpenAPI document uses. The openapi field SHOULD be // used by tooling to interpret the OpenAPI document. This is not related to // the API info.version string. Version string `json:"openapi" yaml:"openapi"` // Provides metadata about the API. The metadata MAY be used by // tooling as required. // // *required* Info *Info `json:"info" yaml:"info"` // The default value for the $schema keyword within Schema Objects contained // within this OAS document. This MUST be in the form of a URI. JSONSchemaDialect string `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"` // An array of Server Objects, 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 a url value of /. Servers []*Server `json:"servers,omitempty" yaml:"servers,omitempty,omtiempty"` // The available paths and operations for the API. Paths *Paths `json:"paths,omitempty" yaml:"paths,omitempty"` // 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 *PathItems `json:"webhooks,omitempty" yaml:"webhooks,omitempty"` // An element to hold various schemas for the document. Components *Components `json:"components,omitempty" yaml:"components,omitempty"` // 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. Tags []*Tag `json:"tags,omitempty" yaml:"tags,omitempty"` // 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. // Security []*SecurityRequirement `json:"security,omitempty" yaml:"security,omitempty"` // externalDocs Additional external documentation. ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"` Extensions `json:"-"` }
OpenAPI root object of the OpenAPI document.
func (OpenAPI) MarshalJSON ¶
MarshalJSON marshals JSON
func (OpenAPI) MarshalYAML ¶
MarshalYAML marshals o into yaml
func (*OpenAPI) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*OpenAPI) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into o
type Operation ¶
type Operation struct { // A list of tags for API documentation control. Tags can be used for // logical grouping of operations by resources or any other qualifier. Tags []string `json:"tags,omitempty"` // A short summary of what the operation does. Summary string `json:"summary,omitempty"` // A verbose explanation of the operation behavior. CommonMark syntax MAY be // used for rich text representation. Description string `json:"description,omitempty"` // externalDocs Additional external documentation. ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"` // Unique string used to identify the operation. The id MUST be unique among // all operations described in the API. The operationId value is // case-sensitive. Tools and libraries MAY use the operationId to uniquely // identify an operation, therefore, it is RECOMMENDED to follow common // programming naming conventions. OperationID string `json:"operationId,omitempty"` // 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. The list MUST NOT include duplicated // parameters. A unique parameter is defined by a combination of a name and // location. The list can use the Reference Object to link to parameters // that are defined at the OpenAPI Object's components/parameters. Parameters *ParameterList `json:"parameters,omitempty"` // The request body applicable for this operation. The requestBody is fully // supported in HTTP methods where the HTTP 1.1 specification RFC7231 has // explicitly defined semantics for request bodies. In other cases where the // HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is // permitted but does not have well-defined semantics and SHOULD be avoided // if possible. RequestBody RequestBody `json:"requestBody,omitempty"` // The list of possible responses as they are returned from executing this // operation. Responses Responses `json:"responses,omitempty"` // A map of possible out-of band callbacks related to the parent operation. // The key is a unique identifier for the Callback Object. Each value in the // map is a Callback Object that describes a request that may be initiated // by the API provider and the expected responses. Callbacks Callbacks `json:"callbacks,omitempty"` // Declares this operation to be deprecated. Consumers SHOULD refrain from // usage of the declared operation. Default value is false. Deprecated bool `json:"deprecated,omitempty"` // A declaration of which security mechanisms can be used for this // operation. 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. To make security optional, // an empty security requirement ({}) can be included in the array. This // definition overrides any declared top-level security. To remove a // top-level security declaration, an empty array can be used. Security SecurityRequirements `json:"security,omitempty"` // An alternative server array to service this operation. If an alternative // server object is specified at the Path Item Object or Root level, it will // be overridden by this value. Servers []*Server `json:"servers,omitempty"` Extensions `json:"-"` }
Operation describes a single API operation on a path.
func (Operation) MarshalJSON ¶
MarshalJSON marshals JSON
func (Operation) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Operation) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*Operation) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type Parameter ¶
type Parameter interface {
ParameterType() ParameterType
}
Parameter is either a ParameterObject or a ReferenceObject
type ParameterList ¶
type ParameterList []Parameter
ParameterList is list of parameters that are applicable for a given operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object's components/parameters.
Can either be a Parameter or a Reference
func (ParameterList) MarshalJSON ¶
func (p ParameterList) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (ParameterList) MarshalYAML ¶
func (p ParameterList) MarshalYAML() (interface{}, error)
MarshalYAML marshals p into YAML
func (*ParameterList) UnmarshalJSON ¶
func (p *ParameterList) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON data into p
func (*ParameterList) UnmarshalYAML ¶
func (p *ParameterList) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML data into p
type ParameterObj ¶
type ParameterObj struct { // The name of the parameter. Parameter names are case sensitive: // - If In is "path", the name field MUST correspond to a template // expression occurring within the path field in the Paths Object. // See Path Templating for further information. // - If In is "header" and the name field is "Accept", "Content-Type" // or "Authorization", the parameter definition SHALL be ignored. // - For all other cases, the name corresponds to the parameter name // used by the in property. // // *required* Name string `json:"name"` // The location of the parameter. Possible values are "query", "header", // "path" or "cookie". // // *required* In In `json:"in"` // A brief description of the parameter. This could contain examples of use. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // Determines whether this parameter is mandatory. If the parameter location // is "path", this property is REQUIRED and its value MUST be true. // Otherwise, the property MAY be included and its default value is false. Required *bool `json:"required,omitempty"` // Specifies that a parameter is deprecated and SHOULD be transitioned out // of usage. Default value is false. Deprecated bool `json:"deprecated,omitempty"` // Sets the ability to pass empty-valued parameters. This is valid only for // query parameters and allows sending a parameter with an empty value. // Default value is false. If style is used, and if behavior is n/a (cannot // be serialized), the value of allowEmptyValue SHALL be ignored. Use of // this property is NOT RECOMMENDED, as it is likely to be removed in a // later revision. AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // Describes how the parameter value will be serialized depending on the // type of the parameter value. // Default values (based on value of in): // - for query - form; // - for path - simple; // - for header - simple; // - for cookie - form. Style string `json:"style,omitempty"` // 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. For other types of parameters this property has no effect. When // style is form, the default value is true. For all other styles, the // default value is false. Explode bool `json:"explode,omitempty"` // Determines whether the parameter value SHOULD allow reserved characters, // as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without // percent-encoding. This property only applies to parameters with an in // value of query. The default value is false. AllowReserved bool `json:"allowReserved,omitempty"` // The schema defining the type used for the parameter. Schema Schema `json:"schema,omitempty"` // Examples of the parameter's potential value. Each example SHOULD // contain a value in the correct format as specified in the parameter // encoding. The examples field is mutually exclusive of the example // field. Furthermore, if referencing a schema that contains an example, // the examples value SHALL override the example provided by the schema. Examples map[string]Example `json:"examples,omitempty"` Content Content `json:"content,omitempty"` Extensions `json:"-"` }
ParameterObj describes a single operation parameter.
A unique parameter is defined by a combination of a name and location.
func (ParameterObj) MarshalJSON ¶
func (p ParameterObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals h into JSON
func (ParameterObj) MarshalYAML ¶
func (p ParameterObj) MarshalYAML() (interface{}, error)
MarshalYAML marshals p into YAML
func (*ParameterObj) ParameterType ¶
func (p *ParameterObj) ParameterType() ParameterType
ParameterType indicates that this is a Parameter for unmarshaling ParameterObjs by returning ParameterTypeParameter
func (*ParameterObj) UnmarshalJSON ¶
func (p *ParameterObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json into p
func (*ParameterObj) UnmarshalYAML ¶
func (p *ParameterObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML data into p
type ParameterType ¶
type ParameterType uint
ParameterType indicates whether the entry is a ParameterDef or a Reference
const ( // ParameterTypeObj is a ParameterObj ParameterTypeObj ParameterType = iota // ParameterTypeReference indicates the Parameter is a Reference ParameterTypeReference )
type Parameters ¶
Parameters is a map of Parameter
func (*Parameters) UnmarshalJSON ¶
func (p *Parameters) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
type PathItems ¶
PathItems is a map of Paths that can either be a Path or a Reference
func (PathItems) MarshalYAML ¶
MarshalYAML marshals rp into YAML
func (*PathItems) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into rp
func (*PathItems) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into rp
type PathObj ¶
type PathObj struct { // Allows for a referenced definition of this path item. The referenced // structure MUST be in the form of a Path Item Object. In case a Path Item // Object field appears both in the defined object and the referenced // object, the behavior is undefined. See the rules for resolving Relative // References. Ref string `json:"$ref,omitempty"` // An optional, string summary, intended to apply to all operations in this path. Summary string `json:"summary,omitempty"` // An optional, string description, intended to apply to all operations in // this path. CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // A definition of a GET operation on this path. Get *Operation `json:"get,omitempty"` // A definition of a PUT operation on this path. Put *Operation `json:"put,omitempty"` // A definition of a POST operation on this path. Post *Operation `json:"post,omitempty"` // A definition of a DELETE operation on this path. Delete *Operation `json:"delete,omitempty"` // A definition of a OPTIONS operation on this path. Options *Operation `json:"options,omitempty"` // A definition of a HEAD operation on this path. Head *Operation `json:"head,omitempty"` // A definition of a PATCH operation on this path. Patch *Operation `json:"patch,omitempty"` // A definition of a TRACE operation on this path. Trace *Operation `json:"trace,omitempty"` // An alternative server array to service all operations in this path. Servers []*Server `json:"servers,omitempty"` // A list of parameters that are applicable for all the operations described // under this path. These parameters can be overridden at the operation // level, but cannot be removed there. The list MUST NOT include duplicated // parameters. A unique parameter is defined by a combination of a name and // location. The list can use the Reference Object to link to parameters // that are defined at the OpenAPI Object's components/parameters. Parameters *ParameterList `json:"parameters,omitempty"` Extensions `json:"-"` }
PathObj describes the operations available on a single path. A PathObj 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 (PathObj) MarshalJSON ¶
MarshalJSON marshals p into JSON
func (PathObj) MarshalYAML ¶
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*PathObj) UnmarshalJSON ¶
UnmarshalJSON unmarshals json into p
func (*PathObj) UnmarshalYAML ¶
UnmarshalYAML unmarshals yaml into s
type PathValue ¶
type PathValue string
PathValue is relative path to an individual endpoint. The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. PathValue templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use.
func (PathValue) MarshalJSON ¶
MarshalJSON Marshals PathEntry to JSON
func (PathValue) MarshalYAML ¶
MarshalYAML Marshals PathEntry to YAML
type Paths ¶
type Paths struct { Items map[PathValue]*PathObj `json:"-"` Extensions `json:"-"` }
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. The Paths MAY be empty, due to Access Control List (ACL) constraints.
func (*Paths) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into p
type Referencable ¶
type Referencable interface {
IsRef() bool
}
Referencable is any object type which could also be a Reference
type Reference ¶
type Reference struct { // The reference identifier. This MUST be in the form of a URI. // // *required* Ref string `yaml:"$ref" json:"$ref"` // A short summary which by default SHOULD override that of the referenced // component. If the referenced object-type does not allow a summary field, // then this field has no effect. Summary string `yaml:"summary,omitempty" json:"summary,omitempty"` // A description which by default SHOULD override that of the referenced // component. CommonMark syntax MAY be used for rich text representation. If // the referenced object-type does not allow a description field, then this // field has no effect. Description string `yaml:"description" json:"description,omitempty"` }
Reference is simple object to allow referencing other components in the OpenAPI document, internally and externally.
The $ref string value contains a URI [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986), which identifies the location of the value being referenced.
See the [rules for resolving Relative References](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#relativeReferencesURI).
func (*Reference) CallbackKind ¶
func (r *Reference) CallbackKind() CallbackKind
CallbackKind returns CallbackKindRef
func (*Reference) ExampleKind ¶
func (r *Reference) ExampleKind() ExampleKind
ExampleKind distinguishes Reference by returning HeaderKindRef
func (*Reference) HeaderKind ¶
func (r *Reference) HeaderKind() HeaderKind
HeaderKind distinguishes Reference by returning HeaderKindRef
func (Reference) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Reference) ParameterType ¶
func (r *Reference) ParameterType() ParameterType
ParameterType returns ParameterTypeReference
func (*Reference) RequestBodyKind ¶
func (r *Reference) RequestBodyKind() RequestBodyKind
RequestBodyKind returns RequestBodyKindRef
func (*Reference) ResponseKind ¶
func (r *Reference) ResponseKind() ResponseKind
ResponseKind distinguishes Reference by returning HeaderKindRef
func (*Reference) SecuritySchemeKind ¶
func (r *Reference) SecuritySchemeKind() SecuritySchemeKind
SecuritySchemeKind returns SecuritySchemeKindRef
func (*Reference) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML
type Regexp ¶
Regexp is a wrapper around *regexp.Regexp to allow for marshinaling/unmarshaling
func (Regexp) MarshalJSON ¶
MarshalJSON unmarshals data into sr
func (*Regexp) UnmarshalJSON ¶
UnmarshalJSON unmarshals data into sr
type RequestBodies ¶
type RequestBodies map[string]RequestBody
RequestBodies is a map of RequestBody
func (RequestBodies) UnmarshalJSON ¶
func (rb RequestBodies) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
type RequestBody ¶
type RequestBody interface {
RequestBodyKind() RequestBodyKind
}
RequestBody can either be a RequestBody or a Reference
type RequestBodyKind ¶
type RequestBodyKind int
RequestBodyKind distinguishes a RequestBodyObj as either a RequestBody or Reference
const ( // RequestBodyKindObj = RequestBodyObj RequestBodyKindObj RequestBodyKind = iota // RequestBodyKindRef = Reference RequestBodyKindRef )
type RequestBodyObj ¶
type RequestBodyObj struct { // A brief description of the request body. This could contain examples of // use. CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // The content of the request body. The key is a media type or media type range and the value describes it. For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text // // *required* Content Content `json:"content,omitempty"` // Determines if the request body is required in the request. Defaults to false. Required bool `json:"required,omitempty"` Extensions `json:"-"` }
RequestBodyObj describes a single request body.
func (RequestBodyObj) MarshalJSON ¶
func (rb RequestBodyObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals h into JSON
func (RequestBodyObj) MarshalYAML ¶
func (rb RequestBodyObj) MarshalYAML() (interface{}, error)
MarshalYAML marshals rb into YAML
func (*RequestBodyObj) RequestBodyKind ¶
func (rb *RequestBodyObj) RequestBodyKind() RequestBodyKind
RequestBodyKind returns RequestBodyKindRequestBody
func (*RequestBodyObj) UnmarshalJSON ¶
func (rb *RequestBodyObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json into rb
func (*RequestBodyObj) UnmarshalYAML ¶
func (rb *RequestBodyObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML data into rb
type Response ¶
type Response interface {
ResponseKind() ResponseKind
}
Response is either a Response or a Reference
type ResponseKind ¶
type ResponseKind int
ResponseKind is an indicator for either a ResponseObj or a Reference
const ( // ResponseKindObj = Response ResponseKindObj ResponseKind = iota // ResponseKindRef = Reference ResponseKindRef )
type ResponseObj ¶
type ResponseObj struct { // A description of the response. CommonMark syntax MAY be used for rich // text representation. // // *required* Description string `json:"description,omitempty"` // Maps a header name to its definition. RFC7230 states header names are // case insensitive. If a response header is defined with the name // "Content-Type", it SHALL be ignored. Headers Headers `json:"headers,omitempty"` // A map containing descriptions of potential response payloads. The key is // a media type or media type range and the value describes it. For // responses that match multiple keys, only the most specific key is // applicable. e.g. text/plain overrides text/* Content Content `json:"content,omitempty"` // A map of operations links that can be followed from the response. The key // of the map is a short name for the link, following the naming constraints // of the names for Component Objects. Links Links `json:"links,omitempty"` Extensions `json:"-"` }
ResponseObj describes a single response from an API Operation, including design-time, static links to operations based on the response.
func (ResponseObj) MarshalJSON ¶
func (r ResponseObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals r into JSON
func (ResponseObj) MarshalYAML ¶
func (r ResponseObj) MarshalYAML() (interface{}, error)
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (ResponseObj) ResponseKind ¶
func (r ResponseObj) ResponseKind() ResponseKind
ResponseKind returns ResponseKindResponse, indicates that this is a Response
func (*ResponseObj) UnmarshalJSON ¶
func (r *ResponseObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json into r
func (*ResponseObj) UnmarshalYAML ¶
func (r *ResponseObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals yaml into s
type Responses ¶
Responses is a container for the expected responses of an operation. The container maps a HTTP response code to the expected response.
The documentation 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 (Responses) MarshalYAML ¶
MarshalYAML marshals r into YAML
func (*Responses) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into r
func (*Responses) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into r
type Schema ¶
type Schema interface { SchemaKind() SchemaKind IsRef() bool }
Schema can either be a SchemaObj, Reference, or Boolean
type SchemaKind ¶
type SchemaKind uint8
SchemaKind indicates whether the Schema is a SchemaObj, Reference, or Boolean
const ( // SchemaKindObj = *SchemaObj SchemaKindObj SchemaKind = iota // SchemaKindBool = *Boolean SchemaKindBool )
type SchemaObj ¶
type SchemaObj struct { Schema string `json:"$schema,omitempty"` // The value of $id is a URI-reference without a fragment that resolves // against the Retrieval URI. The resulting URI is the base URI for the // schema. // // https://json-schema.org/understanding-json-schema/structuring.html?highlight=id#id ID string `json:"$id,omitempty"` // At its core, JSON Schema defines the following basic types: // // "string", "number", "integer", "object", "array", "boolean", "null" // // https://json-schema.org/understanding-json-schema/reference/type.html#type Type Types `json:"type,omitempty"` // The "$ref" keyword is an applicator that is used to reference a // statically identified schema. Its results are the results of the // referenced schema. [CREF5] // // The value of the "$ref" keyword MUST be a string which is a // URI-Reference. Resolved against the current URI base, it produces the URI // of the schema to apply. This resolution is safe to perform on schema // load, as the process of evaluating an instance cannot change how the // reference resolves. // // https://json-schema.org/draft/2020-12/json-schema-core.html#ref // // https://json-schema.org/understanding-json-schema/structuring.html?highlight=ref#ref Ref string `json:"$ref,omitempty"` // The "$defs" keyword reserves a location for schema authors to inline // re-usable JSON Schemas into a more general schema. The keyword does not // directly affect the validation result. // // This keyword's value MUST be an object. Each member value of this object // MUST be a valid JSON Schema. // // https://json-schema.org/draft/2020-12/json-schema-core.html#defs // // https://json-schema.org/understanding-json-schema/structuring.html?highlight=defs#defs Definitions Schemas `json:"$defs,omitempty"` // The format keyword allows for basic semantic identification of certain kinds of string values that are commonly used. For example, because JSON doesn’t have a “DateTime” type, dates need to be encoded as strings. format allows the schema author to indicate that the string value should be interpreted as a date. By default, format is just an annotation and does not effect validation. // // Optionally, validator implementations can provide a configuration option to // enable format to function as an assertion rather than just an annotation. // That means that validation will fail if, for example, a value with a date // format isn’t in a form that can be parsed as a date. This can allow values to // be constrained beyond what the other tools in JSON Schema, including Regular // Expressions can do. // // https://json-schema.org/understanding-json-schema/reference/string.html#format Format string `json:"format,omitempty"` DynamicAnchor string `json:"$dynamicAnchor,omitempty"` // The "$dynamicRef" keyword is an applicator that allows for deferring the // full resolution until runtime, at which point it is resolved each time it // is encountered while evaluating an instance. // // https://json-schema.org/draft/2020-12/json-schema-core.html#dynamic-ref DynamicRef string `json:"$dynamicRef,omitempty"` // A less common way to identify a subschema is to create a named anchor in // the schema using the $anchor keyword and using that name in the URI // fragment. Anchors must start with a letter followed by any number of // letters, digits, -, _, :, or .. // // https://json-schema.org/understanding-json-schema/structuring.html?highlight=anchor#anchor Anchor string `json:"$anchor,omitempty"` // The const keyword is used to restrict a value to a single value. // // https://json-schema.org/understanding-json-schema/reference/generic.html?highlight=const#constant-values Const json.RawMessage `json:"const,omitempty"` // The enum keyword is used to restrict a value to a fixed set of values. It // must be an array with at least one element, where each element is unique. // // https://json-schema.org/understanding-json-schema/reference/generic.html?highlight=const#enumerated-values Enum []string `json:"enum,omitempty"` // The $comment keyword is strictly intended for adding comments to a // schema. Its value must always be a string. Unlike the annotations title, // description, and examples, JSON schema implementations aren’t allowed to // attach any meaning or behavior to it whatsoever, and may even strip them // at any time. Therefore, they are useful for leaving notes to future // editors of a JSON schema, but should not be used to communicate to users // of the schema. // // https://json-schema.org/understanding-json-schema/reference/generic.html?highlight=const#comments Comments string `json:"$comment,omitempty"` // The not keyword declares that an instance validates if it doesn’t // validate against the given subschema. // // https://json-schema.org/understanding-json-schema/reference/combining.html?highlight=not#not Not Schema `json:"not,omitempty"` // validate against allOf, the given data must be valid against all of the // given subschemas. // // https://json-schema.org/understanding-json-schema/reference/combining.html?highlight=anyof#anyof AllOf SchemaSet `json:"allOf,omitempty"` // validate against anyOf, the given data must be valid against any (one or // more) of the given subschemas. // // https://json-schema.org/understanding-json-schema/reference/combining.html?highlight=allof#allof AnyOf SchemaSet `json:"anyOf,omitempty"` // alidate against oneOf, the given data must be valid against exactly one of the given subschemas. // // https://json-schema.org/understanding-json-schema/reference/combining.html?highlight=oneof#oneof OneOf SchemaSet `json:"oneOf,omitempty"` // if, then and else keywords allow the application of a subschema based on // the outcome of another schema, much like the if/then/else constructs // you’ve probably seen in traditional programming languages. // // https://json-schema.org/understanding-json-schema/reference/conditionals.html#if-then-else If Schema `json:"if,omitempty"` // https://json-schema.org/understanding-json-schema/reference/conditionals.html#if-then-else Then Schema `json:"then,omitempty"` // https://json-schema.org/understanding-json-schema/reference/conditionals.html#if-then-else Else Schema `json:"else,omitempty"` MinProperties *int `json:"minProperties,omitempty"` MaxProperties *int `json:"maxProperties,omitempty"` Required []string `json:"required,omitempty"` Properties Schemas `json:"properties,omitempty"` PropertyNames Schema `json:"propertyNames,omitempty"` RegexProperties *bool `json:"regexProperties,omitempty"` PatternProperties Schemas `json:"patternProperties,omitempty"` AdditionalProperties Schema `json:"additionalProperties,omitempty"` // The dependentRequired keyword conditionally requires that certain // properties must be present if a given property is present in an object. // For example, suppose we have a schema representing a customer. If you // have their credit card number, you also want to ensure you have a billing // address. If you don’t have their credit card number, a billing address // would not be required. We represent this dependency of one property on // another using the dependentRequired keyword. The value of the // dependentRequired keyword is an object. Each entry in the object maps // from the name of a property, p, to an array of strings listing properties // that are required if p is present. DependentRequired map[string][]string `json:"dependentRequired,omitempty"` // The dependentSchemas keyword conditionally applies a subschema when a // given property is present. This schema is applied in the same way allOf // applies schemas. Nothing is merged or extended. Both schemas apply // independently. DependentSchemas Schemas `json:"dependentSchemas,omitempty"` UnevaluatedProperties Schema `json:"unevaluatedProperties,omitempty"` UniqueObjs *bool `json:"uniqueObjs,omitempty"` // List validation is useful for arrays of arbitrary length where each item // matches the same schema. For this kind of array, set the items keyword to // a single schema that will be used to validate all of the items in the // array. Items Schema `json:"items,omitempty"` UnevaluatedObjs Schema `json:"unevaluatedObjs,omitempty"` AdditionalObjs Schema `json:"additionalObjs,omitempty"` PrefixObjs SchemaSet `json:"prefixObjs,omitempty"` Contains Schema `json:"contains,omitempty"` MinContains *Number `json:"minContains,omitempty"` MaxContains *Number `json:"maxContains,omitempty"` MinLength *Number `json:"minLength,omitempty"` MaxLength *Number `json:"maxLength,omitempty"` Pattern *Regexp `json:"pattern,omitempty"` ContentEncoding string `json:"contentEncoding,omitempty"` ContentMediaType string `json:"contentMediaType,omitempty"` Minimum *Number `json:"minimum,omitempty"` ExclusiveMinimum *Number `json:"exclusiveMinimum,omitempty"` Maximum *Number `json:"maximum,omitempty"` ExclusiveMaximum *Number `json:"exclusiveMaximum,omitempty"` MultipleOf *Number `json:"multipleOf,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Default json.RawMessage `json:"default,omitempty"` ReadOnly *bool `json:"readOnly,omitempty"` WriteOnly *bool `json:"writeOnly,omitempty"` Examples json.RawMessage `json:"examples,omitempty"` Deprecated *bool `json:"deprecated,omitempty"` ExternalDocs string `json:"externalDocs,omitempty"` // Deprecated: renamed to dynamicAnchor RecursiveAnchor *bool `json:"$recursiveAnchor,omitempty"` // Deprecated: renamed to dynamicRef RecursiveRef string `json:"$recursiveRef,omitempty"` Discriminator *Discriminator `json:"discriminator,omitempty"` // This MAY be used only on properties schemas. It has no effect on root // schemas. Adds additional metadata to describe the XML representation of // this property. XML *XML `json:"xml,omitempty"` Extensions `json:"-"` Keywords map[string]json.RawMessage `json:"-"` }
SchemaObj allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is a superset of the [JSON SchemaObj Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00).
For more information about the properties, see [JSON SchemaObj Core](https://tools.ietf.org/html/draft-bhutton-json-schema-00) and [JSON SchemaObj Validation](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00).
Unless stated otherwise, the property definitions follow those of JSON SchemaObj and do not add any additional semantics. Where JSON SchemaObj indicates that behavior is defined by the application (e.g. for annotations), OAS also defers the definition of semantics to the application consuming the OpenAPI document.
The OpenAPI SchemaObj Object [dialect](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-4.3.3) is defined as requiring the [OAS base vocabulary](#baseVocabulary), in addition to the vocabularies as specified in the JSON SchemaObj draft 2020-12 [general purpose meta-schema](https://tools.ietf.org/html/draft-bhutton-json-schema-00#section-8).
The OpenAPI SchemaObj Object dialect for this version of the specification is identified by the URI `https://spec.openapis.org/oas/3.1/dialect/base` (the <a name="dialectSchemaId"></a>"OAS dialect schema id").
The following properties are taken from the JSON SchemaObj specification but their definitions have been extended by the OAS:
- description - [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation. - format - See [Data Type Formats](#dataTypeFormat) for further details. While relying on JSON SchemaObj's defined formats, the OAS offers a few additional predefined formats.
In addition to the JSON SchemaObj properties comprising the OAS dialect, the SchemaObj Object supports keywords from any other vocabularies, or entirely arbitrary properties. A SchemaObj represents compiled version of json-schema.
func (*SchemaObj) DecodeKeyword ¶
DecodeKeyword unmarshals the keyword's raw data into dst
func (*SchemaObj) DecodeKeywords ¶
DecodeKeywords unmarshals all keywords raw data into dst
func (SchemaObj) MarshalJSON ¶
MarshalJSON marshals JSON
func (SchemaObj) MarshalYAML ¶
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*SchemaObj) SchemaKind ¶
func (s *SchemaObj) SchemaKind() SchemaKind
SchemaKind returns SchemaKindObj
func (*SchemaObj) SetEncodedKeyword ¶
SetEncodedKeyword sets the keyword key to value
func (*SchemaObj) SetKeyword ¶
SetKeyword encodes and sets the keyword key to the encoded value
func (*SchemaObj) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*SchemaObj) UnmarshalYAML ¶
UnmarshalYAML unmarshals yaml into s
type SchemaSet ¶
type SchemaSet []Schema
SchemaSet is a slice of *Schema
func (*SchemaSet) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
type SchemaType ¶
type SchemaType string
SchemaType restricts to a JSON Schema specific type
https://json-schema.org/understanding-json-schema/reference/type.html#type
const ( // TypeString = string // // https://json-schema.org/understanding-json-schema/reference/string.html#string TypeString SchemaType = "string" // TypeNumber = number // // https://json-schema.org/understanding-json-schema/reference/numeric.html#number TypeNumber SchemaType = "number" // TypeInteger = integer // // https://json-schema.org/understanding-json-schema/reference/numeric.html#integer TypeInteger SchemaType = "integer" // TypeObject = object // // https://json-schema.org/understanding-json-schema/reference/object.html#object TypeObject SchemaType = "object" // TypeArray = array // // https://json-schema.org/understanding-json-schema/reference/array.html#array TypeArray SchemaType = "array" // TypeBoolean = boolean // // https://json-schema.org/understanding-json-schema/reference/boolean.html#boolean TypeBoolean SchemaType = "boolean" // TypeNull = null // // https://json-schema.org/understanding-json-schema/reference/null.html#null TypeNull SchemaType = "null" )
func (SchemaType) String ¶
func (t SchemaType) String() string
type Schemas ¶
Schemas is a map of Schemas
func (*Schemas) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
type SecurityRequirement ¶
SecurityRequirement lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.
Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.
When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
Each name MUST correspond to a security scheme which is declared in the Security Schemes under the Components Object. If the security scheme is of type "oauth2" or "openIdConnect", then the value is a list of scope names required for the execution, and the list MAY be empty if authorization does not require a specified scope. For other security scheme types, the array MAY contain a list of role names which are required for the execution, but are not otherwise defined or exchanged in-band.
type SecurityRequirements ¶
type SecurityRequirements []SecurityRequirement
SecurityRequirements is a list of SecurityRequirement
type SecurityScheme ¶
type SecurityScheme interface {
SecuritySchemeKind() SecuritySchemeKind
}
SecurityScheme can either be a ScecuritySchemeObj or a Reference
type SecuritySchemeKind ¶
type SecuritySchemeKind uint8
SecuritySchemeKind is either a SecuritySchemeObj or Reference
const ( // SecuritySchemeKindObj = SecuritySchemeObj SecuritySchemeKindObj SecuritySchemeKind = iota // SecuritySchemeKindRef = Reference SecuritySchemeKindRef )
type SecuritySchemeObj ¶
type SecuritySchemeObj struct { // The type of the security scheme. // // *required Type SecuritySchemeType `json:"type,omitempty"` // Any description for security scheme. CommonMark syntax MAY be used for // rich text representation. Description string `json:"description,omitempty"` // The name of the header, query or cookie parameter to be used. // // Applies to: API Key // // *required* Name string `json:"name,omitempty"` // The location of the API key. Valid values are "query", "header" or "cookie". // // Applies to: APIKey // // *required* In In `json:"in,omitempty"` // The name of the HTTP Authorization scheme to be used in the Authorization // header as defined in RFC7235. The values used SHOULD be registered in the // IANA Authentication Scheme registry. // // *required* Scheme string `json:"scheme,omitempty"` // http ("bearer") A hint to the client to identify how the bearer token is // formatted. Bearer tokens are usually generated by an authorization // server, so this information is primarily for documentation purposes. BearerFormat string `json:"bearerFormat,omitempty"` // An object containing configuration information for the flow types supported. // // *required* Flows *OAuthFlows `json:"flows,omitempty"` // OpenId Connect URL to discover OAuth2 configuration values. This MUST be // in the form of a URL. The OpenID Connect standard requires the use of // TLS. // // *required* OpenIDConnectURL string `json:"openIdConnect,omitempty"` Extensions `json:"-"` }
SecuritySchemeObj defines a security scheme that can be used by the operations.
func (SecuritySchemeObj) MarshalJSON ¶
func (sso SecuritySchemeObj) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (SecuritySchemeObj) MarshalYAML ¶
func (sso SecuritySchemeObj) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (SecuritySchemeObj) SecuritySchemeKind ¶
func (sso SecuritySchemeObj) SecuritySchemeKind() SecuritySchemeKind
SecuritySchemeKind returns SecuritySchemeKindObj
func (*SecuritySchemeObj) UnmarshalJSON ¶
func (sso *SecuritySchemeObj) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*SecuritySchemeObj) UnmarshalYAML ¶
func (sso *SecuritySchemeObj) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type SecuritySchemeType ¶
type SecuritySchemeType string
SecuritySchemeType represents the type of the security scheme.
const ( // SecuritySchemeTypeAPIKey = "apiKey" SecuritySchemeTypeAPIKey SecuritySchemeType = "apiKey" // SecuritySchemeTypeHTTP = "http" SecuritySchemeTypeHTTP SecuritySchemeType = "http" // SecuritySchemeTypeMutualTLS = mutualTLS SecuritySchemeTypeMutualTLS SecuritySchemeType = "mutualTLS" // SecuritySchemeTypeOAuth2 = oauth2 SecuritySchemeTypeOAuth2 SecuritySchemeType = "oauth2" // SecuritySchemeTypeOpenIDConnect = "openIdConnect" SecuritySchemeTypeOpenIDConnect SecuritySchemeType = "openIdConnect" )
func (SecuritySchemeType) String ¶
func (ss SecuritySchemeType) String() string
type SecuritySchemes ¶
type SecuritySchemes map[string]SecurityScheme
SecuritySchemes is a map of SecurityScheme
func (SecuritySchemes) MarshalYAML ¶
func (ss SecuritySchemes) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*SecuritySchemes) UnmarshalJSON ¶
func (ss *SecuritySchemes) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals json
func (*SecuritySchemes) UnmarshalYAML ¶
func (ss *SecuritySchemes) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML
type Server ¶
type Server struct { // A URL to the target host. This URL supports Server Variables and MAY be // relative, to indicate that the host location is relative to the location // where the OpenAPI document is being served. Variable substitutions will // be made when a variable is named in {brackets}. URL string `json:"url"` // Description of the host designated by the URL. CommonMark syntax MAY be // used for rich text representation. Description string `json:"description,omitempty"` // A map between a variable name and its value. The value is used for // substitution in the server's URL template. Variables map[string]*ServerVariable `json:"variables,omitempty"` Extensions `json:"-"` }
Server represention of a Server.
func (Server) MarshalYAML ¶
MarshalYAML marshals YAML
func (*Server) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
func (*Server) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML data into s
type ServerVariable ¶
type ServerVariable struct { // An enumeration of string values to be used if the substitution options // are from a limited set. The array MUST NOT be empty. Enum []string `json:"enum" yaml:"enum"` // The default value to use for substitution, which SHALL be sent if an // alternate value is not supplied. Note this behavior is different than the // Schema Object's treatment of default values, because in those cases // parameter values are optional. If the enum is defined, the value MUST // exist in the enum's values. // // *required* Default string `json:"default" yaml:"default"` // An optional description for the server variable. CommonMark syntax MAY be // used for rich text representation. Description string `json:"description,omitempty" yaml:"description,omitempty"` Extensions `json:"-"` }
ServerVariable for server URL template substitution.
func (ServerVariable) MarshalJSON ¶
func (sv ServerVariable) MarshalJSON() ([]byte, error)
MarshalJSON marshals JSON
func (ServerVariable) MarshalYAML ¶
func (sv ServerVariable) MarshalYAML() (interface{}, error)
MarshalYAML marshals YAML
func (*ServerVariable) UnmarshalJSON ¶
func (sv *ServerVariable) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals JSON
func (*ServerVariable) UnmarshalYAML ¶
func (sv *ServerVariable) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals YAML data into s
type Style ¶
type Style string
Style describes how the parameter value will be serialized depending on the type of the parameter value.
const ( // StyleForm for StyleForm Style = "form" // StyleSimple comma-separated values. Corresponds to the // {param_name} URI template. StyleSimple Style = "simple" // StyleMatrix semicolon-prefixed values, also known as path-style // expansion. Corresponds to the {;param_name} URI template. StyleMatrix Style = "matrix" // StyleLabel dot-prefixed values, also known as label expansion. // Corresponds to the {.param_name} URI template. StyleLabel Style = "label" // StyleDeepObject a simple way of rendering nested objects using // form parameters (applies to objects only). StyleDeepObject Style = "deepObject" // StylePipeDelimited is pipeline-separated array values. Same as // collectionFormat: pipes in OpenAPI 2.0. Has effect only for non-exploded // arrays (explode: false), that is, the pipe separates the array values if // the array is a single parameter, as in arr=a|b|c StylePipeDelimited Style = "pipeDelimited" )
type Tag ¶
type Tag struct { // The name of the tag. // // *required* Name string `json:"name" yaml:"name"` // A description for the tag. // // CommonMark syntax MAY be used for rich text representation. // // https://spec.commonmark.org/ Description string `json:"description,omitempty" yaml:"description,omitempty"` // Additional external documentation for this tag. ExternalDocs *ExternalDocs `json:"externalDocs,omitempty" bson:"externalDocs,omitempty"` Extensions `json:"-"` }
Tag adds metadata that is used by the Operation Object.
It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
func (Tag) MarshalJSON ¶
MarshalJSON marshals t into JSON
func (Tag) MarshalYAML ¶
MarshalYAML first marshals and unmarshals into JSON and then marshals into YAML
func (*Tag) UnmarshalJSON ¶
UnmarshalJSON unmarshals json into t
func (*Tag) UnmarshalYAML ¶
UnmarshalYAML unmarshals yaml into t
type Types ¶
type Types []SchemaType
Types is a set of Types. A single Type marshals/unmarshals into a string while 2+ marshals into an array.
func (Types) Contains ¶
func (t Types) Contains(typ SchemaType) bool
Contains returns true if t contains typ
func (Types) ContainsArray ¶
ContainsArray returns true if TypeArray is present
func (Types) ContainsBoolean ¶
ContainsBoolean returns true if TypeBoolean is present
func (Types) ContainsInteger ¶
ContainsInteger returns true if TypeInteger is present
func (Types) ContainsNull ¶
ContainsNull returns true if TypeNull is present
func (Types) ContainsNumber ¶
ContainsNumber returns true if TypeNumber is present
func (Types) ContainsObject ¶
ContainsObject returns true if TypeObject is present
func (Types) ContainsString ¶
ContainsString returns true if TypeString is present
func (*Types) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON
type XML ¶
type XML struct { // Replaces the name of the element/attribute used for the described schema // property. When defined within items, it will affect the name of the // individual XML elements within the list. When defined alongside type // being array (outside the items), it will affect the wrapping element and // only if wrapped is true. If wrapped is false, it will be ignored. Name string `json:"name,omitempty"` // The URI of the namespace definition. This MUST be in the form of an // absolute URI. Namespace string `json:"namespace,omitempty"` // The prefix to be used for the name. Prefix string `json:"prefix,omitempty"` // Declares whether the property definition translates to an attribute // instead of an element. Default value is false. Attribute bool `json:"attribute,omitempty"` // MAY be used only for an array definition. Signifies whether the array is // wrapped (for example, <books><book/><book/></books>) or unwrapped // (<book/><book/>). Default value is false. The definition takes effect // only when defined alongside type being array (outside the items). Wrapped bool `json:"wrapped,omitempty"` Extensions `json:"-"` }
XML is a metadata object that allows for more fine-tuned XML model definitions.
When using arrays, XML element names are not inferred (for singular/plural forms) and the name property SHOULD be used to add that information. See examples for expected behavior.
Source Files ¶
- boolean.go
- callback.go
- components.go
- contact.go
- discriminator.go
- encoding.go
- example.go
- extension.go
- external_docs.go
- header.go
- in.go
- info.go
- license.go
- link.go
- media_type.go
- number.go
- oauth_flow.go
- openapi.go
- operation.go
- parameter.go
- path.go
- reference.go
- regexp.go
- request_body.go
- response.go
- schema.go
- security.go
- server.go
- tag.go
- validate.go
- xml.go