spec3

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

OAI object model Build Status codecov Slack Status

license GoDoc

This repository is not usable at this moment, the implementation is incomplete

The object model for OpenAPI specification v3 documents.

It aims to fix some mistakes that were made in the spec for v2. Top-level maps are now sorted by default so you can rely on their ordering.

Schemas

Schema struct{} + map Unit tests (struct{} + map)
OpenAPI 🔲
Info 🔲
Contact 🔲
License 🔲
Server 🔲
Server Variable ☑ + 🔲 🔲 + 🔲
Components 🔲
Paths 🔲
Path Item ☑ + 🔲 🔲 + 🔲
Operation 🔲
External Documentation 🔲
Parameter ☑ + 🔲 🔲 + 🔲
Request Body ☑ + 🔲 🔲 + 🔲
Media Type ☑ + 🔲 🔲 + 🔲
Encoding ☑ + 🔲 🔲 + 🔲
Responses ☑ + 🔲 🔲 + 🔲
Response 🔲
Callback ☑ + 🔲 🔲 + 🔲
Example ☑ + 🔲 🔲 + 🔲
Link ☑ + 🔲 🔲 + 🔲
Header ☑ + 🔲 🔲 + 🔲
Tag 🔲
Reference 🔲
Schema 🔲 + 🔲 🔲 + 🔲
Discriminator 🔲
XML 🔲
Security Scheme ☑ + 🔲 🔲 + 🔲
OAuth Flows 🔲
OAuth Flow 🔲
Security Requirement 🔲

TODO

  • Update OrderedMap to use ART under the hood instead of the golang's map
  • Use GoJay for decoding/encoding the JSON
  • Retire EasyJson dependency from the project

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LowerCaseKeys = strings.ToLower

LowerCaseKeys lowercases keys when looking up in the map

Functions

func MatchAll

func MatchAll(_ string) bool

MatchAll keys, is used as default filter

func MatchExtension

func MatchExtension(key string) bool

MatchExtension is used as filter for vendor extensions

func MatchNonEmptyKeys

func MatchNonEmptyKeys(key string) bool

MatchNonEmptyKeys keys, is used to allow only non empty strings

func NOPNormalizer

func NOPNormalizer(s string) string

NOPNormalizer passes the key through, used as default

Types

type Callback

type Callback struct {
	// contains filtered or unexported fields
}

Callback 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. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

func NewCallback

func NewCallback() Callback

NewCallback creates a new instance of Callback with correct filter

func (*Callback) ForEach

func (s *Callback) ForEach(fn func(string, *PathItem) error) error

ForEach executes the function for each security requirement

func (*Callback) Get

func (s *Callback) Get(key string) *PathItem

Get gets the security requirement by key

func (*Callback) GetOK

func (s *Callback) GetOK(key string) (*PathItem, bool)

GetOK checks if the key exists in the security requirement

func (*Callback) Keys

func (s *Callback) Keys() []string

Keys gets the list of keys

func (*Callback) Set

func (s *Callback) Set(key string, val *PathItem) bool

Set sets the value to the security requirement

type Components

type Components struct {
	VendorExtensible

	Schemas         OrderedSchemas         `json:"schemas,omitempty"`
	Responses       OrderedResponses       `json:"responses,omitempty"`
	Parameters      OrderedParameters      `json:"parameters,omitempty"`
	Examples        OrderedExamples        `json:"examples,omitempty"`
	RequestBodies   OrderedRequestBodies   `json:"requestBodies,omitempty"`
	Headers         OrderedHeaders         `json:"headers,omitempty"`
	SecuritySchemes OrderedSecuritySchemes `json:"securitySchemes,omitempty"`
	Links           OrderedLinks           `json:"links,omitempty"`
	Callbacks       OrderedCallbacks       `json:"callbacks,omitempty"`
}

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.

type Contact

type Contact struct {
	VendorExtensible

	Name  string
	URL   string
	Email string
}

Contact contains information for the exposed API.

func (Contact) MarshalEasyJSON

func (v Contact) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Contact) MarshalJSON

func (v Contact) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Contact) UnmarshalEasyJSON

func (v *Contact) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Contact) UnmarshalJSON

func (v *Contact) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Discriminator

type Discriminator struct {
	PropertyName string         `json:"propertyName"`
	Mapping      OrderedStrings `json:"mapping"`
}

Discriminator When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

type Encoding

type Encoding struct {
	VendorExtensible

	ContentType   string         `json:"contentType,omitempty"`
	Headers       OrderedHeaders `json:"headers,omitempty"`
	Style         string         `json:"style,omitempty"`
	Explode       bool           `json:"explode,omitempty"`
	AllowReserved bool           `json:"allowReserved,omitempty"`
}

Encoding definition applied to a single schema property.

type Example

type Example struct {
	VendorExtensible
	Reference

	Summary       string      `json:"summary"`
	Description   string      `json:"description"`
	Value         interface{} `json:"value"`
	ExternalValue string      `json:"externalValue"`
}

Example

type Extensions

type Extensions struct {
	// contains filtered or unexported fields
}

Extensions vendor specific extensions

func (Extensions) Add

func (e Extensions) Add(key string, value interface{})

Add adds a value to these extensions

func (Extensions) Get

func (e Extensions) Get(key string) interface{}

func (Extensions) GetBool

func (e Extensions) GetBool(key string) (bool, bool)

GetBool gets a boolean value from the extensions

func (Extensions) GetInt

func (e Extensions) GetInt(key string) (int, bool)

GetInt gets an int value from the extensions

func (Extensions) GetInt32

func (e Extensions) GetInt32(key string) (int32, bool)

GetInt32 gets an int32 value from the extensions

func (Extensions) GetInt64

func (e Extensions) GetInt64(key string) (int64, bool)

GetInt64 gets an int64 value from the extensions

func (Extensions) GetOK

func (e Extensions) GetOK(key string) (interface{}, bool)

func (Extensions) GetString

func (e Extensions) GetString(key string) (string, bool)

GetString gets a string value from the extensions

func (Extensions) GetStringSlice

func (e Extensions) GetStringSlice(key string) ([]string, bool)

GetStringSlice gets a string value from the extensions

func (Extensions) MarshalEasyJSON

func (e Extensions) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Extensions) MarshalJSON

func (e Extensions) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Extensions) Set

func (e Extensions) Set(key string, value interface{}) bool

func (*Extensions) UnmarshalEasyJSON

func (e *Extensions) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Extensions) UnmarshalJSON

func (e *Extensions) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ExternalDocumentation

type ExternalDocumentation struct {
	VendorExtensible

	Description string
	URL         string
}

ExternalDocumentation allows referencing an external resource for extended documentation. easyjson:json

func (ExternalDocumentation) MarshalEasyJSON

func (v ExternalDocumentation) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ExternalDocumentation) MarshalJSON

func (v ExternalDocumentation) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ExternalDocumentation) UnmarshalEasyJSON

func (v *ExternalDocumentation) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ExternalDocumentation) UnmarshalJSON

func (v *ExternalDocumentation) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Filter

type Filter func(string) bool

Filter for deciding which keys make it into the sorted map

type Header struct {
	Parameter
}

Header follows the structure of the Parameter Object

type Info

type Info struct {
	VendorExtensible

	Title          string
	Description    string
	TermsOfService string
	Contact        *Contact
	License        *License
	Version        string
}

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. easyjson:json

func (Info) MarshalEasyJSON

func (v Info) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Info) MarshalJSON

func (v Info) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Info) UnmarshalEasyJSON

func (v *Info) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Info) UnmarshalJSON

func (v *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type License

type License struct {
	VendorExtensible

	Name string
	URL  string
}

License contains information for the exposed API. easyjson:json

func (License) MarshalEasyJSON

func (v License) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (License) MarshalJSON

func (v License) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*License) UnmarshalEasyJSON

func (v *License) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*License) UnmarshalJSON

func (v *License) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Link struct {
	VendorExtensible
	Reference

	OperationRef string                 `json:"operationRef,omitempty"`
	OperationID  string                 `json:"operationId,omitempty"`
	Parameters   map[string]interface{} `json:"parameters,omitempty"`
	RequestBody  interface{}            `json:"requestBody,omitempty"`
	Description  string                 `json:"description,omitempty"`
	Server       Server                 `json:"server,omitempty"`
}

Link 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.

type MapEntry

type MapEntry struct {
	Key   string
	Value interface{}
}

MapEntry represents a key value pair

type MediaType

type MediaType struct {
	VendorExtensible

	Schema   Schema           `json:"schema,omitempty"`
	Example  interface{}      `json:"example,omitempty"`
	Examples OrderedExamples  `json:"examples,omitempty"`
	Encoding OrderedEncodings `json:"encoding,omitempty"`
}

MediaType provides schema and examples for the media type identified by its key.

type Normalizer

type Normalizer func(string) string

Normalizer is used to normalize keys when writing to a map

type OAuthFlow

type OAuthFlow struct {
	VendorExtensible

	AuthorizationURL string         `json:"authorizationUrl,omitempty"`
	TokenURL         string         `json:"tokenUrl,omitempty"`
	RefreshURL       string         `json:"refreshUrl,omitempty"`
	Scopes           OrderedStrings `json:"scopes,omitempty"`
}

OAuthFlow configuration details for a supported OAuth Flow

type OAuthFlows

type OAuthFlows struct {
	VendorExtensible

	Implicit          OAuthFlow `json:"implicit,omitempty"`
	Password          OAuthFlow `json:"password,omitempty"`
	ClientCredentials OAuthFlow `json:"clientCredentials,omitempty"`
	AuthorizationCode OAuthFlow `json:"authorizationCode,omitempty"`
}

OAuthFlows allows configuration of the supported OAuth Flows.

type OpenAPI

type OpenAPI struct {
	VendorExtensible

	Components   *Components             `json:"components,omitempty"`
	ExternalDocs []ExternalDocumentation `json:"externalDocs,omitempty"`
	Info         *Info                   `json:"info,omitempty"`
	OpenAPI      string                  `json:"openapi"`
	Paths        *PathItem               `json:"paths"`
	Security     []SecurityRequirement   `json:"security,omitempty"`
	Servers      []Server                `json:"servers,omitempty"`
	Tags         []Tag                   `json:"tags,omitempty"`
}

OpenAPI is the root document object of the OpenAPI document

type Operation

type Operation struct {
	VendorExtensible

	Tags         []string              `json:"tags,omitempty"`
	Summary      string                `json:"summary,omitempty"`
	Description  string                `json:"description,omitempty"`
	ExternalDocs ExternalDocumentation `json:"externalDocs,omitempty"`
	OperationID  string                `json:"operationId,omitempty"`
	Parameters   []Parameter           `json:"parameters,omitempty"`
	RequestBody  RequestBody           `json:"requestBody,omitempty"`
	Responses    OrderedResponses      `json:"responses,omitempty"`
	Callbacks    map[string]Callback   `json:"callbacks,omitempty"`
	Deprecated   bool                  `json:"deprecated,omitempty"`
	Security     []SecurityRequirement `json:"security,omitempty"`
	Servers      []Server              `json:"servers,omitempty"`
}

Operation describes a single API operation on a path.

type OrderedCallbacks

type OrderedCallbacks struct {
	// contains filtered or unexported fields
}

OrderedCallbacks is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedCallbacks

func NewOrderedCallbacks() OrderedCallbacks

NewOrderedCallbacks creates a new instance of OrderedCallbacks with correct filter

func (*OrderedCallbacks) ForEach

func (s *OrderedCallbacks) ForEach(fn func(string, *Callback) error) error

ForEach executes the function for each security requirement

func (*OrderedCallbacks) Get

func (s *OrderedCallbacks) Get(key string) *Callback

Get gets the security requirement by key

func (*OrderedCallbacks) GetOK

func (s *OrderedCallbacks) GetOK(key string) (*Callback, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedCallbacks) Keys

func (s *OrderedCallbacks) Keys() []string

Keys gets the list of keys

func (*OrderedCallbacks) Set

func (s *OrderedCallbacks) Set(key string, val *Callback) bool

Set sets the value to the security requirement

type OrderedEncodings

type OrderedEncodings struct {
	// contains filtered or unexported fields
}

OrderedEncodings is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedEncodings

func NewOrderedEncodings() OrderedEncodings

NewOrderedEncodings creates a new instance of OrderedEncodings with correct filter

func (*OrderedEncodings) ForEach

func (s *OrderedEncodings) ForEach(fn func(string, *Encoding) error) error

ForEach executes the function for each security requirement

func (*OrderedEncodings) Get

func (s *OrderedEncodings) Get(key string) *Encoding

Get gets the security requirement by key

func (*OrderedEncodings) GetOK

func (s *OrderedEncodings) GetOK(key string) (*Encoding, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedEncodings) Keys

func (s *OrderedEncodings) Keys() []string

Keys gets the list of keys

func (*OrderedEncodings) Set

func (s *OrderedEncodings) Set(key string, val *Encoding) bool

Set sets the value to the security requirement

type OrderedExamples

type OrderedExamples struct {
	// contains filtered or unexported fields
}

OrderedExamples is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedExamples

func NewOrderedExamples() OrderedExamples

NewOrderedExamples creates a new instance of OrderedExamples with correct filter

func (*OrderedExamples) ForEach

func (s *OrderedExamples) ForEach(fn func(string, *Example) error) error

ForEach executes the function for each security requirement

func (*OrderedExamples) Get

func (s *OrderedExamples) Get(key string) *Example

Get gets the security requirement by key

func (*OrderedExamples) GetOK

func (s *OrderedExamples) GetOK(key string) (*Example, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedExamples) Keys

func (s *OrderedExamples) Keys() []string

Keys gets the list of keys

func (*OrderedExamples) Set

func (s *OrderedExamples) Set(key string, val *Example) bool

Set sets the value to the security requirement

type OrderedHeaders

type OrderedHeaders struct {
	// contains filtered or unexported fields
}

OrderedHeaders is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedHeaders

func NewOrderedHeaders() OrderedHeaders

NewOrderedHeaders creates a new instance of OrderedHeaders with correct filter

func (*OrderedHeaders) ForEach

func (s *OrderedHeaders) ForEach(fn func(string, *Header) error) error

ForEach executes the function for each security requirement

func (*OrderedHeaders) Get

func (s *OrderedHeaders) Get(key string) *Header

Get gets the security requirement by key

func (*OrderedHeaders) GetOK

func (s *OrderedHeaders) GetOK(key string) (*Header, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedHeaders) Keys

func (s *OrderedHeaders) Keys() []string

Keys gets the list of keys

func (*OrderedHeaders) Set

func (s *OrderedHeaders) Set(key string, val *Header) bool

Set sets the value to the security requirement

type OrderedLinks struct {
	// contains filtered or unexported fields
}

OrderedLinks is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedLinks() OrderedLinks

NewOrderedLinks creates a new instance of OrderedLinks with correct filter

func (*OrderedLinks) ForEach

func (s *OrderedLinks) ForEach(fn func(string, *Link) error) error

ForEach executes the function for each security requirement

func (*OrderedLinks) Get

func (s *OrderedLinks) Get(key string) *Link

Get gets the security requirement by key

func (*OrderedLinks) GetOK

func (s *OrderedLinks) GetOK(key string) (*Link, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedLinks) Keys

func (s *OrderedLinks) Keys() []string

Keys gets the list of keys

func (*OrderedLinks) Set

func (s *OrderedLinks) Set(key string, val *Link) bool

Set sets the value to the security requirement

type OrderedMap

type OrderedMap struct {
	// contains filtered or unexported fields
}

OrderedMap is a map that preserves insertion order

func (*OrderedMap) Delete

func (s *OrderedMap) Delete(k string) bool

Delete a value from the map

func (*OrderedMap) Entries

func (s *OrderedMap) Entries() []MapEntry

Entries in the order of addition to the map

func (*OrderedMap) ForEach

func (s *OrderedMap) ForEach(fn func(string, interface{}) error) error

ForEach executes a function for each value in the map

func (*OrderedMap) Get

func (s *OrderedMap) Get(key string) interface{}

Get get a value for the specified key

func (*OrderedMap) GetOK

func (s *OrderedMap) GetOK(key string) (interface{}, bool)

GetOK get a value for the specified key, the boolean result indicates if the value was found or not

func (*OrderedMap) Keys

func (s *OrderedMap) Keys() []string

Keys in the order of addition to the map

func (*OrderedMap) Len

func (s *OrderedMap) Len() int

Len of the known keys

func (OrderedMap) MarshalEasyJSON

func (s OrderedMap) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderedMap) MarshalJSON

func (s OrderedMap) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderedMap) Set

func (s *OrderedMap) Set(key string, value interface{}) bool

Set a value in the map

func (OrderedMap) String

func (s OrderedMap) String() string

func (*OrderedMap) UnmarshalEasyJSON

func (s *OrderedMap) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderedMap) UnmarshalJSON

func (s *OrderedMap) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*OrderedMap) Values

func (s *OrderedMap) Values() []interface{}

Values in the order of addition to the map

type OrderedMediaTypes

type OrderedMediaTypes struct {
	// contains filtered or unexported fields
}

OrderedMediaTypes is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedMediaTypes

func NewOrderedMediaTypes() OrderedMediaTypes

NewOrderedMediaTypes creates a new instance of OrderedMediaTypes with correct filter

func (*OrderedMediaTypes) ForEach

func (s *OrderedMediaTypes) ForEach(fn func(string, *MediaType) error) error

ForEach executes the function for each security requirement

func (*OrderedMediaTypes) Get

func (s *OrderedMediaTypes) Get(key string) *MediaType

Get gets the security requirement by key

func (*OrderedMediaTypes) GetOK

func (s *OrderedMediaTypes) GetOK(key string) (*MediaType, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedMediaTypes) Keys

func (s *OrderedMediaTypes) Keys() []string

Keys gets the list of keys

func (*OrderedMediaTypes) Set

func (s *OrderedMediaTypes) Set(key string, val *MediaType) bool

Set sets the value to the security requirement

type OrderedParameters

type OrderedParameters struct {
	// contains filtered or unexported fields
}

func NewOrderedParameters

func NewOrderedParameters() OrderedParameters

func (*OrderedParameters) ForEach

func (s *OrderedParameters) ForEach(fn func(string, *Parameter) error) error

ForEach executes the function for each security requirement

func (*OrderedParameters) Get

func (s *OrderedParameters) Get(key string) *Parameter

Get gets the security requirement by key

func (*OrderedParameters) GetOK

func (s *OrderedParameters) GetOK(key string) (*Parameter, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedParameters) Keys

func (s *OrderedParameters) Keys() []string

Keys gets the list of keys

func (*OrderedParameters) Set

func (s *OrderedParameters) Set(key string, val *Parameter) bool

Set sets the value to the security requirement

type OrderedRequestBodies

type OrderedRequestBodies struct {
	// contains filtered or unexported fields
}

OrderedRequestBodies is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedRequestBodies

func NewOrderedRequestBodies() OrderedRequestBodies

NewOrderedRequestBodies creates a new instance of OrderedRequestBodies with correct filter

func (*OrderedRequestBodies) ForEach

func (s *OrderedRequestBodies) ForEach(fn func(string, *RequestBody) error) error

ForEach executes the function for each security requirement

func (*OrderedRequestBodies) Get

Get gets the security requirement by key

func (*OrderedRequestBodies) GetOK

func (s *OrderedRequestBodies) GetOK(key string) (*RequestBody, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedRequestBodies) Keys

func (s *OrderedRequestBodies) Keys() []string

Keys gets the list of keys

func (*OrderedRequestBodies) Set

func (s *OrderedRequestBodies) Set(key string, val *RequestBody) bool

Set sets the value to the security requirement

type OrderedResponses

type OrderedResponses struct {
	// contains filtered or unexported fields
}

OrderedResponses is a container for the expected responses of an operation. The container maps a HTTP response code to the expected response.

func NewOrderedResponses

func NewOrderedResponses() OrderedResponses

NewOrderedResponses creates the new instance of the OrderedResponses with correct key-filter

func (*OrderedResponses) ForEach

func (s *OrderedResponses) ForEach(fn func(string, *Response) error) error

ForEach executes the function for each security requirement

func (*OrderedResponses) Get

func (s *OrderedResponses) Get(key string) *Response

Get gets the security requirement by key

func (*OrderedResponses) GetOK

func (s *OrderedResponses) GetOK(key string) (*Response, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedResponses) Keys

func (s *OrderedResponses) Keys() []string

Keys gets the list of keys

func (OrderedResponses) MarshalEasyJSON

func (s OrderedResponses) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderedResponses) MarshalJSON

func (s OrderedResponses) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderedResponses) Set

func (s *OrderedResponses) Set(key string, val *Response) bool

Set sets the value to the security requirement

func (*OrderedResponses) UnmarshalEasyJSON

func (s *OrderedResponses) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderedResponses) UnmarshalJSON

func (s *OrderedResponses) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderedSchemas

type OrderedSchemas struct {
	// contains filtered or unexported fields
}

OrderedSchemas is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedSchemas

func NewOrderedSchemas() OrderedSchemas

NewOrderedSchemas creates a new instance of OrderedSchemas with correct filter

func (*OrderedSchemas) ForEach

func (s *OrderedSchemas) ForEach(fn func(string, *Schema) error) error

ForEach executes the function for each security requirement

func (*OrderedSchemas) Get

func (s *OrderedSchemas) Get(key string) *Schema

Get gets the security requirement by key

func (*OrderedSchemas) GetOK

func (s *OrderedSchemas) GetOK(key string) (*Schema, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedSchemas) Keys

func (s *OrderedSchemas) Keys() []string

Keys gets the list of keys

func (*OrderedSchemas) Set

func (s *OrderedSchemas) Set(key string, val *Schema) bool

Set sets the value to the security requirement

type OrderedSecuritySchemes

type OrderedSecuritySchemes struct {
	// contains filtered or unexported fields
}

OrderedSecuritySchemes is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedSecuritySchemes

func NewOrderedSecuritySchemes() OrderedSecuritySchemes

NewOrderedSecuritySchemes creates a new instance of OrderedSecuritySchemes with correct filter

func (*OrderedSecuritySchemes) ForEach

func (s *OrderedSecuritySchemes) ForEach(fn func(string, *SecurityScheme) error) error

ForEach executes the function for each security requirement

func (*OrderedSecuritySchemes) Get

Get gets the security requirement by key

func (*OrderedSecuritySchemes) GetOK

GetOK checks if the key exists in the security requirement

func (*OrderedSecuritySchemes) Keys

func (s *OrderedSecuritySchemes) Keys() []string

Keys gets the list of keys

func (*OrderedSecuritySchemes) Set

Set sets the value to the security requirement

type OrderedStrings

type OrderedStrings struct {
	// contains filtered or unexported fields
}

OrderedStrings is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewOrderedStrings

func NewOrderedStrings() OrderedStrings

NewOrderedStrings creates a new instance of OrderedStrings with correct filter

func (*OrderedStrings) ForEach

func (s *OrderedStrings) ForEach(fn func(string, *string) error) error

ForEach executes the function for each security requirement

func (*OrderedStrings) Get

func (s *OrderedStrings) Get(key string) *string

Get gets the security requirement by key

func (*OrderedStrings) GetOK

func (s *OrderedStrings) GetOK(key string) (*string, bool)

GetOK checks if the key exists in the security requirement

func (*OrderedStrings) Keys

func (s *OrderedStrings) Keys() []string

Keys gets the list of keys

func (*OrderedStrings) Set

func (s *OrderedStrings) Set(key string, val *string) bool

Set sets the value to the security requirement

type Parameter

type Parameter struct {
	VendorExtensible
	Reference

	Name            string            `json:"name"`
	In              string            `json:"in"`
	Description     string            `json:"description"`
	Required        bool              `json:"required"`
	Deprecated      bool              `json:"deprecated"`
	AllowEmptyValue bool              `json:"allowEmptyValue"`
	Style           string            `json:"style"`
	Explode         bool              `json:"explode"`
	AllowReserved   bool              `json:"allowReserved"`
	Schema          Schema            `json:"schema"`
	Example         interface{}       `json:"example"`
	Examples        OrderedExamples   `json:"examples"`
	Contents        OrderedMediaTypes `json:"contents"`
}

Parameter describes a single operation parameter. A unique parameter is defined by a combination of a name and location.

type PathItem

type PathItem struct {
	Reference

	Summary     string      `json:"summary"`
	Description string      `json:"description"`
	Get         Operation   `json:"get"`
	Put         Operation   `json:"put"`
	Post        Operation   `json:"post"`
	Delete      Operation   `json:"delete"`
	Options     Operation   `json:"options"`
	Head        Operation   `json:"head"`
	Patch       Operation   `json:"patch"`
	Trace       Operation   `json:"trace"`
	Servers     []Server    `json:"servers"`
	Parameters  []Parameter `json:"parameters"`
}

PathItem describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.

type Paths

type Paths struct {
	// contains filtered or unexported fields
}

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 ACL constraints.

func (*Paths) ForEach

func (p *Paths) ForEach(fn func(string, []string) error) error

func (*Paths) Get

func (p *Paths) Get(path string) *PathItem

func (*Paths) GetOK

func (p *Paths) GetOK(path string) (*PathItem, bool)

func (*Paths) Keys

func (p *Paths) Keys() []string

Keys gets list of all the keys

func (Paths) MarshalEasyJSON

func (p Paths) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Paths) MarshalJSON

func (p Paths) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Paths) Set

func (p *Paths) Set(path string, item *PathItem) bool

func (*Paths) UnmarshalEasyJSON

func (p *Paths) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Paths) UnmarshalJSON

func (p *Paths) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Reference

type Reference struct {
	Ref jsonreference.Ref
}

Reference is a simple object to allow referencing other components in the specification, internally and externally.

type RequestBody

type RequestBody struct {
	VendorExtensible
	Reference

	Description string `json:"description,omitempty"`
	Content     string `json:"content,omitempty"`
	Required    string `json:"required,omitempty"`
}

RequestBody describes a single request body.

type Response

type Response struct {
	VendorExtensible
	Reference

	Description string            `json:"description"`
	Headers     OrderedHeaders    `json:"headers"`
	Content     OrderedMediaTypes `json:"content"`
	Links       OrderedLinks      `json:"links"`
}

Response describes a single response from an API Operation, including design-time, static links to operations based on the response.

type Schema

type Schema struct {
	VendorExtensible
	Reference
}

Schema object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00.

type SecurityRequirement

type SecurityRequirement struct {
	// contains filtered or unexported fields
}

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.

func (*SecurityRequirement) ForEach

func (s *SecurityRequirement) ForEach(fn func(string, []string) error) error

ForEach executes the function for each security requirement

func (*SecurityRequirement) Get

func (s *SecurityRequirement) Get(key string) []string

Get gets the security requirement by key

func (*SecurityRequirement) GetOK

func (s *SecurityRequirement) GetOK(key string) ([]string, bool)

GetOK checks if the key exists in the security requirement

func (*SecurityRequirement) Keys

func (s *SecurityRequirement) Keys() []string

Keys gets the list of keys

func (SecurityRequirement) MarshalEasyJSON

func (s SecurityRequirement) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (SecurityRequirement) MarshalJSON

func (s SecurityRequirement) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*SecurityRequirement) Set

func (s *SecurityRequirement) Set(key string, scopes ...string) bool

Set sets the value to the security requirement

func (*SecurityRequirement) UnmarshalEasyJSON

func (s *SecurityRequirement) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*SecurityRequirement) UnmarshalJSON

func (s *SecurityRequirement) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type SecurityScheme

type SecurityScheme struct {
	VendorExtensible
	Reference

	Type             string    `json:"type,omitempty"`
	Description      string    `json:"description,omitempty"`
	Name             string    `json:"name,omitempty"`
	In               string    `json:"in,omitempty"`
	Scheme           string    `json:"scheme,omitempty"`
	BearerFormat     string    `json:"bearerFormat,omitempty"`
	Flows            OAuthFlow `json:"flows,omitempty"`
	OpenIDConnectURL string    `json:"openIdConnectUrl,omitempty"`
}

SecurityScheme defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.

type Server

type Server struct {
	VendorExtensible

	URL         string
	Description string
	Variables   ServerVariables
}

Server object representing a Server. easyjson:json

func (Server) MarshalEasyJSON

func (v Server) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Server) MarshalJSON

func (v Server) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Server) UnmarshalEasyJSON

func (v *Server) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Server) UnmarshalJSON

func (v *Server) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ServerVariable

type ServerVariable struct {
	VendorExtensible

	Enum        []string
	Default     string
	Description string
}

ServerVariable object representing a Server Variable for server URL template substitution.

func (ServerVariable) MarshalEasyJSON

func (v ServerVariable) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ServerVariable) MarshalJSON

func (v ServerVariable) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ServerVariable) UnmarshalEasyJSON

func (v *ServerVariable) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ServerVariable) UnmarshalJSON

func (v *ServerVariable) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ServerVariables

type ServerVariables struct {
	// contains filtered or unexported fields
}

ServerVariables is a map between a variable name and its value. The value is used for substitution in the server's URL template.

func NewServerVariables

func NewServerVariables() ServerVariables

NewServerVariables creates a new instance of ServerVariables with correct filter

func (*ServerVariables) ForEach

func (s *ServerVariables) ForEach(fn func(string, *ServerVariable) error) error

ForEach executes the function for each security requirement

func (*ServerVariables) Get

func (s *ServerVariables) Get(key string) *ServerVariable

Get gets the security requirement by key

func (*ServerVariables) GetOK

func (s *ServerVariables) GetOK(key string) (*ServerVariable, bool)

GetOK checks if the key exists in the security requirement

func (*ServerVariables) Keys

func (s *ServerVariables) Keys() []string

Keys gets the list of keys

func (ServerVariables) MarshalEasyJSON

func (v ServerVariables) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ServerVariables) MarshalJSON

func (v ServerVariables) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ServerVariables) Set

func (s *ServerVariables) Set(key string, val *ServerVariable) bool

Set sets the value to the security requirement

func (*ServerVariables) UnmarshalEasyJSON

func (v *ServerVariables) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ServerVariables) UnmarshalJSON

func (v *ServerVariables) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Tag

type Tag struct {
	VendorExtensible

	Name         string
	Description  string
	ExternalDocs *ExternalDocumentation
}

Tag adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. easyjson:json

func (Tag) MarshalEasyJSON

func (v Tag) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Tag) MarshalJSON

func (v Tag) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Tag) UnmarshalEasyJSON

func (v *Tag) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Tag) UnmarshalJSON

func (v *Tag) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type VendorExtensible

type VendorExtensible struct {
	Extensions Extensions
}

VendorExtensible composition block.

func (*VendorExtensible) AddExtension

func (v *VendorExtensible) AddExtension(key string, value interface{})

AddExtension adds an extension to this extensible object

func (VendorExtensible) MarshalJSON

func (v VendorExtensible) MarshalJSON() ([]byte, error)

MarshalJSON marshals the extensions to json

func (*VendorExtensible) UnmarshalJSON

func (v *VendorExtensible) UnmarshalJSON(data []byte) error

UnmarshalJSON for this extensible object

type XML

type XML struct {
	VendorExtensible

	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Prefix    string `json:"prefix"`
	Attribute bool   `json:"attribute"`
	Wrapped   bool   `json:"wrapped"`
}

XML a metadata object that allows for more fine-tuned XML model definitions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL