Documentation ¶
Index ¶
- Constants
- type Any
- type AnyOrExpressions
- type Callback
- type Components
- type Contact
- type Discriminator
- type Encoding
- type Entiter
- type Entity
- type Example
- type Expressions
- type ExternalDocumentation
- type Header
- type Info
- type License
- type Link
- type MediaType
- type OAPIType
- type OAuthFlow
- type OAuthFlows
- type OpenAPI
- type Operation
- type Parameter
- func (p *Parameter) AllowsEmptyValues() *Parameter
- func (p *Parameter) AsOptional() *Parameter
- func (s Parameter) Entity() Entity
- func (p *Parameter) NoEmptyValues() *Parameter
- func (p *Parameter) WithDescription(description string) *Parameter
- func (p *Parameter) WithLocation(in string) *Parameter
- func (p *Parameter) WithName(name string) *Parameter
- func (p *Parameter) WithSchema(schema *Schema) *Parameter
- type PathItem
- type Paths
- type Refable
- type RequestBody
- func FormDataRequestBody(schema *Schema) *RequestBody
- func JSONRequestBody(schema *Schema) *RequestBody
- func NewRequestBody(typ string, schema *Schema) *RequestBody
- func OctetStreamRequestBody(schema *Schema) *RequestBody
- func TextPlainRequestBody(schema *Schema) *RequestBody
- func URLEncodedRequestBody(schema *Schema) *RequestBody
- func XMLRequestBody(schema *Schema) *RequestBody
- type Response
- func FormDataResponse(schema *Schema) *Response
- func JSONResponse(schema *Schema) *Response
- func NewResponse(typ string, schema *Schema) *Response
- func OctetStreamResponse(schema *Schema) *Response
- func TextPlainResponse(schema *Schema) *Response
- func URLEncodedResponse(schema *Schema) *Response
- func XMLResponse(schema *Schema) *Response
- func (r *Response) AddContent(name string, content *MediaType) *Response
- func (r *Response) AddHeader(name string, header *Header) *Response
- func (r *Response) AddLink(name string, link *Link) *Response
- func (s Response) Entity() Entity
- func (r *Response) RemoveContent(name string) *Response
- func (r *Response) RemoveHeader(name string) *Response
- func (r *Response) RemoveLink(name string) *Response
- func (r *Response) WithDescription(description string) *Response
- type Schema
- func AllSchema(schemas ...*Schema) *Schema
- func AnySchema(schemas ...*Schema) *Schema
- func ArrayProperty(items *Schema) *Schema
- func BinaryProperty() *Schema
- func BooleanProperty() *Schema
- func ByteProperty() *Schema
- func DateProperty() *Schema
- func DateTimeProperty() *Schema
- func Float32Property() *Schema
- func Float64Property() *Schema
- func FloatFmtProperty(format string) *Schema
- func Int16Property() *Schema
- func Int32Property() *Schema
- func Int64Property() *Schema
- func Int8Property() *Schema
- func IntFmtProperty(format string) *Schema
- func MapProperty(property *Schema) *Schema
- func NotSchema(schema *Schema) *Schema
- func OneSchema(schemas ...*Schema) *Schema
- func PasswordProperty() *Schema
- func StrFmtProperty(format string) *Schema
- func StringProperty() *Schema
- func (s *Schema) AddRequired(items ...string) *Schema
- func (s *Schema) AddToAllOf(schemas ...*Schema) *Schema
- func (s *Schema) AllowDuplicates() *Schema
- func (s *Schema) AsReadOnly() *Schema
- func (s *Schema) AsUnwrappedXML() *Schema
- func (s *Schema) AsWrappedXML() *Schema
- func (s *Schema) AsWritable() *Schema
- func (s *Schema) AsXMLAttribute() *Schema
- func (s *Schema) AsXMLElement() *Schema
- func (s Schema) Entity() Entity
- func (s *Schema) UniqueValues() *Schema
- func (s *Schema) WithAllOf(schemas ...*Schema) *Schema
- func (s *Schema) WithDefault(defaultValue Any) *Schema
- func (s *Schema) WithDescription(description string) *Schema
- func (s *Schema) WithEnum(values ...Any) *Schema
- func (s *Schema) WithExample(example Any) *Schema
- func (s *Schema) WithExternalDocs(description, url string) *Schema
- func (s *Schema) WithFormat(format string) *Schema
- func (s *Schema) WithMaxItems(size int64) *Schema
- func (s *Schema) WithMaxLength(max int64) *Schema
- func (s *Schema) WithMaxProperties(max int64) *Schema
- func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema
- func (s *Schema) WithMinItems(size int64) *Schema
- func (s *Schema) WithMinLength(min int64) *Schema
- func (s *Schema) WithMinProperties(min int64) *Schema
- func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema
- func (s *Schema) WithMultipleOf(number float64) *Schema
- func (s *Schema) WithPattern(pattern string) *Schema
- func (s *Schema) WithProperties(schemas map[string]*Schema) *Schema
- func (s *Schema) WithProperty(name string, schema *Schema) *Schema
- func (s *Schema) WithRequired(items ...string) *Schema
- func (s *Schema) WithTitle(title string) *Schema
- func (s *Schema) WithType(typ OAPIType, format string) *Schema
- func (s *Schema) WithXMLName(name string) *Schema
- func (s *Schema) WithXMLNamespace(namespace string) *Schema
- func (s *Schema) WithXMLPrefix(prefix string) *Schema
- type SecurityRequirement
- type SecurityScheme
- func APIKeyAuth(fieldName, valueSource string) *SecurityScheme
- func BasicAuth() *SecurityScheme
- func BearerAuth(bearerFormat string) *SecurityScheme
- func OAuth2AuthorizationCode(tokenURL string) *SecurityScheme
- func OAuth2ClientCredentials(authorizationURL, tokenURL string) *SecurityScheme
- func OAuth2Implicit(authorizationURL string) *SecurityScheme
- func OAuth2Password(tokenURL string) *SecurityScheme
- type Server
- type ServerVariable
- type Tag
- type XML
Constants ¶
const ( InPath = "path" // Used together with Path Templating, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. InQuery = "query" // Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. InHeader = "header" // Custom headers that are expected as part of the request. Note that RFC7230 states header names are case insensitive. InCookie = "cookie" // Used to pass a specific cookie value to the API. )
Parameter Locations There are four possible parameter locations specified by the in field:
const ( MimeJSON = "application/json" MimeXML = "application/xml" MimeTextPlain = "text/plain" MimeOctetStream = "application/octet-stream" MimeURLEncoded = "application/x-www-form-urlencoded" MimeFormData = "multipart/form-data" )
Media type definitions are spread across several resources. The media type definitions SHOULD be in compliance with RFC6838. Some examples of possible media type definitions:
const ( SecurityHTTP = "http" SecurityAPIKey = "apiKey" SecurityOAuth2 = "oauth2" SecurityOpenIDConnect = "openIdConnect" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Any ¶
type Any []byte
Any is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
func (Any) MarshalJSON ¶
MarshalJSON returns m as the JSON encoding of m.
func (*Any) UnmarshalJSON ¶
UnmarshalJSON sets *m to a copy of data.
type AnyOrExpressions ¶
type AnyOrExpressions struct { Expressions Expressions Any Any }
AnyOrExpressions It's the Union type of any and expressions
func (AnyOrExpressions) MarshalJSON ¶
func (m AnyOrExpressions) MarshalJSON() ([]byte, error)
MarshalJSON returns m as the JSON encoding of m.
func (*AnyOrExpressions) UnmarshalJSON ¶
func (m *AnyOrExpressions) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *m to a copy of data.
type Callback ¶
type Callback struct { Refable `json:",inline"` Callback map[Expressions]*PathItem }
Callback It's the Union type of callback and Refable
func (Callback) MarshalJSON ¶
MarshalJSON returns m as the JSON encoding of callback or Refable.
func (*Callback) UnmarshalJSON ¶
UnmarshalJSON sets callback or Refable to data.
type Components ¶
type Components struct { // An object to hold reusable Schema Objects. Schemas map[string]*Schema `json:"schemas,omitempty"` // An object to hold reusable Response Objects. Responses map[string]*Response `json:"responses,omitempty"` // An object to hold reusable Parameter Objects. Parameters map[string]*Parameter `json:"parameters,omitempty"` // An object to hold reusable Example Objects. Examples map[string]*Example `json:"examples,omitempty"` // An object to hold reusable Request Body Objects. RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty"` // An object to hold reusable Header Objects. Headers map[string]*Header `json:"headers,omitempty"` // An object to hold reusable Security Scheme Objects. SecuritySchemes map[string]*SecurityScheme `json:"securitySchemes,omitempty"` // An object to hold reusable Link Objects. Links map[string]*Link `json:"links,omitempty"` // An object to hold reusable Callback Objects. Callbacks map[string]*Callback `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 { // The identifying name of the contact person/organization. Name string `json:"name"` // The URL pointing to the contact information. // MUST be in the format of a URL. URL string `json:"url,omitempty"` // The email address of the contact person/organization. // MUST be in the format of an email address. Email string `json:"email,omitempty"` }
Contact information for the exposed API.
type Discriminator ¶
type Discriminator struct { // REQUIRED. // The name of the property in the payload that will hold the discriminator value. PropertyName string `json:"propertyName"` // An object to hold mappings between payload values and schema names or references. Mapping map[string]string `json:"mapping,omitempty"` }
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. When using the discriminator, inline schemas will not be considered.
type Encoding ¶
type Encoding struct { // The Content-Type for encoding a specific property. // Default value depends on the property type: for string with format being binary – application/octet-stream; // for other primitive types – text/plain; for object - application/json; for array – the default is defined based on the inner type. // 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"` // 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 map[string]*Header `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. Style string `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. 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. AllowReserved bool `json:"allowReserved,omitempty"` }
Encoding A single encoding definition applied to a single schema property.
type Entiter ¶
type Entiter interface {
Entity() Entity
}
Entiter is forcing given struct to admit its purpose
type Entity ¶
type Entity uint
Entity reflets kind of component
const ( // InvalidKind designating invalid scheme InvalidKind Entity = iota + 1 // ReferenceKind designating *Refable ReferenceKind // SchemaKind designating *Schema SchemaKind // ResponseKind designating *Response ResponseKind // ParameterKind designating *Parameter ParameterKind // ExampleKind designating *Example ExampleKind // RequestBodyKind designating *RequestBody RequestBodyKind // HeaderKind designating *Header HeaderKind // SecuritySchemeKind designating *SecurityScheme SecuritySchemeKind // LinkKind designating *Link LinkKind // CallbackKind designating *Callback CallbackKind // PathItemKind designating *Path PathItemKind )
type Example ¶
type Example struct { Refable `json:",inline"` // 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"` // 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 Any `json:"value"` // A URL 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. ExternalValue string `json:"externalValue,omitempty"` }
type Expressions ¶
type Expressions string
Expressions Runtime expressions allow defining values based on information that will only be available within the HTTP message in an actual API call. This mechanism is used by Link Objects and Callback Objects. The runtime expression is defined by the following ABNF syntax
expression = ( "$url" | "$method" | "$statusCode" | "$request." source | "$response." source ) source = ( header-reference | query-reference | path-reference | body-reference ) header-reference = "header." token query-reference = "query." name path-reference = "path." name body-reference = "body" ["#" fragment] fragment = a JSON Pointer [RFC 6901](https://tools.ietf.org/html/rfc6901) name = *( char ) char = as per RFC [7159](https://tools.ietf.org/html/rfc7159#section-7) token = as per RFC [7230](https://tools.ietf.org/html/rfc7230#section-3.2.6)
The name identifier is case-sensitive, whereas token is not. The table below provides examples of runtime expressions and examples of their use in a value:
type ExternalDocumentation ¶
type ExternalDocumentation struct { // A short description of the target documentation. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description"` // REQUIRED. // The URL for the target documentation. // Value MUST be in the format of a URL. URL string `json:"url,omitempty"` }
ExternalDocumentation Allows referencing an external resource for extended documentation.
type Header ¶
type Header struct { Refable `json:",inline"` // 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. 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. 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"` // 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"` // Example of the media type. // The example SHOULD match the specified schema and encoding properties if present. // 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. // To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. Example Any `json:"example,omitempty"` // Examples of the media type. // 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 which contains an example, the examples value SHALL override the example provided by the schema. Examples map[string]*Example `json:"examples,omitempty"` // A map containing the representations for the parameter. // The key is the media type and the value describes it. // The map MUST only contain one entry. Content map[string]*MediaType `json:"content,omitempty"` }
Header The Header Object follows the structure of the Parameter Object with the following changes: 1. name MUST NOT be specified, it is given in the corresponding headers map. 2. in MUST NOT be specified, it is implicitly in header. 3. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
func (*Header) AllowsEmptyValues ¶
AllowsEmptyValues flags this parameter as being ok with empty values
func (*Header) AsOptional ¶
AsOptional flags this parameter as optional
func (*Header) NoEmptyValues ¶
NoEmptyValues flags this parameter as not liking empty values
func (*Header) WithDescription ¶
WithDescription sets the description on this response, allows for chaining
type Info ¶
type Info struct { // REQUIRED. // The title of the application. Title string `json:"title"` // A short description of the application. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // A URL to the Terms of Service for the API. // MUST be in the format of a URL. TermsOfService string `json:"termsOfService,omitempty"` // The contact information for the exposed API. Contact *Contact `json:"contact,omitempty"` // The license information for the exposed API. License *License `json:"license,omitempty"` // REQUIRED. // The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version). Version string `json:"version"` }
Info The object 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.
type License ¶
type License struct { // REQUIRED. // The license name used for the API. Name string `json:"name"` // A URL to the license used for the API. // MUST be in the format of a URL. URL string `json:"url,omitempty"` }
License information for the exposed API.
type Link ¶
type Link struct { Refable `json:",inline"` // A relative or absolute 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. 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 map[string]*AnyOrExpressions `json:"parameters,omitempty"` // A literal value or to use as a request body when calling the target operation. RequestBody *AnyOrExpressions `json:"requestBody,omitempty"` // A description of the link. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // A server object to be used by the target operation. Server *Server `json:"server,omitempty"` }
Link The Link object 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.
type MediaType ¶
type MediaType struct { // The schema defining the type used for the request body. Schema *Schema `json:"schema,omitempty"` // Any 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 Any `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 map[string]*Example `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 map[string]*Encoding `json:"encoding,omitempty"` }
MediaType Each Media Type Object provides schema and examples for the media type identified by its key.
type OAPIType ¶
type OAPIType string
Primitive data types in the OAS are based on the types supported by the JSON Schema Specification Wright Draft 00. Note that integer as a type is also supported and is defined as a JSON number without a fraction or exponent part. null is not supported as a type (see nullable for an alternative solution). Models are defined using the Schema Object, which is an extended subset of JSON Schema Specification Wright Draft 00.
type OAuthFlow ¶
type OAuthFlow struct { // oauth2 ("implicit", "authorizationCode") // REQUIRED. // The authorization URL to be used for this flow. // This MUST be in the form of a URL. AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2 ("password", "clientCredentials", "authorizationCode") // REQUIRED. // The token URL to be used for this flow. // This MUST be in the form of a URL. TokenURL string `json:"tokenUrl,omitempty"` // oauth2 The URL to be used for obtaining refresh tokens. // This MUST be in the form of a URL. RefreshURL string `json:"refreshUrl,omitempty"` // oauth2 // REQUIRED. // The available scopes for the OAuth2 security scheme. // A map between the scope name and a short description for it. Acopes map[string]string `json:"acopes,omitempty"` }
OAuthFlow Configuration details for a supported OAuth Flow
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"` }
OAuthFlows Allows configuration of the supported OAuth Flows.
type OpenAPI ¶
type OpenAPI struct { // REQUIRED. // This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses. // The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document. // This is not related to the API info.version string. OpenAPI string `json:"openapi,omitempty"` // REQUIRED. // Provides metadata about the API. // The metadata MAY be used by tooling as required. Info *Info `json:"info,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"` // REQUIRED. // The available paths and operations for the API. Paths Paths `json:"paths,omitempty"` // An element to hold various schemas for the specification. Components *Components `json:"components,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. Security []map[string]SecurityRequirement `json:"security,omitempty"` // A list of tags used by the specification 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"` // Additional extern ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` }
OpenAPI This is the root document object of the OpenAPI document.
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"` // Additional external documentation for this operation. ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` // Unique string used to identify the operation. // The id MUST be unique among all operations described in the API. // 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 []*Parameter `json:"parameters,omitempty"` // The request body applicable for this operation. // The requestBody is only 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, requestBody SHALL be ignored by consumers. RequestBody *RequestBody `json:"requestBody,omitempty"` // REQUIRED. // The list of possible responses as they are returned from executing this operation. Responses map[string]*Response `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. // 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. Callbacks map[string]*Callback `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. // This definition overrides any declared top-level security. // To remove a top-level security declaration, an empty array can be used. Security []map[string]SecurityRequirement `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"` }
Operation Describes a single API operation on a path.
type Parameter ¶
type Parameter struct { Refable `json:",inline"` // REQUIRED. // The name of the parameter. // Parameter names are case sensitive. // If in is "path", the name field MUST correspond to the associated path segment from 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. Name string `json:"name"` // REQUIRED. // The location of the parameter. // Possible values are "query", "header", "path" or "cookie". In string `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. 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. 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"` // 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"` // Example of the media type. // The example SHOULD match the specified schema and encoding properties if present. // 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. // To represent examples of media types that cannot naturally be represented in JSON or YAML, a string value can contain the example with escaping where necessary. Example Any `json:"example,omitempty"` // Examples of the media type. // 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 which contains an example, the examples value SHALL override the example provided by the schema. Examples map[string]*Example `json:"examples,omitempty"` // A map containing the representations for the parameter. // The key is the media type and the value describes it. // The map MUST only contain one entry. Content map[string]*MediaType `json:"content,omitempty"` }
Parameter Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. Parameter Locations There are four possible parameter locations specified by the in field: path - Used together with Path Templating, where the parameter value is actually part of the operation's URL. This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId. query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id. header - Custom headers that are expected as part of the request. Note that RFC7230 states header names are case insensitive. cookie - Used to pass a specific cookie value to the API.
func CookieParam ¶
CookieParam creates a path parameter, this is always required
func HeaderParam ¶
HeaderParam creates a header parameter, this is always required by default
func QueryParam ¶
QueryParam creates a query parameter
func (*Parameter) AllowsEmptyValues ¶
AllowsEmptyValues flags this parameter as being ok with empty values
func (*Parameter) AsOptional ¶
AsOptional flags this parameter as optional
func (*Parameter) NoEmptyValues ¶
NoEmptyValues flags this parameter as not liking empty values
func (*Parameter) WithDescription ¶
WithDescription sets the description on this response, allows for chaining
func (*Parameter) WithLocation ¶
WithLocation a fluent builder method to override the location of the parameter
func (*Parameter) WithSchema ¶
WithSchema a fluent builder method to override the schema of the parameter
type PathItem ¶
type PathItem struct { // 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 []*Parameter `json:"parameters,omitempty"` }
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.
func (PathItem) Operations ¶
Operations returns all operations as a array
type Paths ¶
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.
type Refable ¶
type Refable struct { // REQUIRED. // The reference string. Ref *pointer.Pointer `json:"$ref,omitempty"` }
Refable A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
type RequestBody ¶
type RequestBody struct { Refable `json:",inline"` // 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"` // REQUIRED. // 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/* Content map[string]*MediaType `json:"content"` // Determines if the request body is required in the request. // Defaults to false. Required bool `json:"required,omitempty"` }
RequestBody Describes a single request body.
func FormDataRequestBody ¶
func FormDataRequestBody(schema *Schema) *RequestBody
FormDataRequestBody creates a request body
func JSONRequestBody ¶
func JSONRequestBody(schema *Schema) *RequestBody
JSONRequestBody creates a request body
func NewRequestBody ¶
func NewRequestBody(typ string, schema *Schema) *RequestBody
NewRequestBody creates a request body
func OctetStreamRequestBody ¶
func OctetStreamRequestBody(schema *Schema) *RequestBody
OctetStreamRequestBody creates a request body
func TextPlainRequestBody ¶
func TextPlainRequestBody(schema *Schema) *RequestBody
TextPlainRequestBody creates a request body
func URLEncodedRequestBody ¶
func URLEncodedRequestBody(schema *Schema) *RequestBody
URLEncodedRequestBody creates a request body
func XMLRequestBody ¶
func XMLRequestBody(schema *Schema) *RequestBody
XMLRequestBody creates a request body
func (RequestBody) Entity ¶
func (s RequestBody) Entity() Entity
Entity satisfies componenter interface
type Response ¶
type Response struct { Refable `json:",inline"` // REQUIRED. // A short description of the response. // CommonMark syntax MAY be used for rich text representation. 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 map[string]*Header `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 map[string]*MediaType `json:"content"` // 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 map[string]*Link `json:"links,omitempty"` }
Response Describes a single response from an API Operation, including design-time, static links to operations based on the response.
func FormDataResponse ¶
FormDataResponse creates a request body
func NewResponse ¶
NewResponse creates a response
func OctetStreamResponse ¶
OctetStreamResponse creates a request body
func TextPlainResponse ¶
TextPlainResponse creates a request body
func URLEncodedResponse ¶
URLEncodedResponse creates a request body
func (*Response) AddContent ¶
AddContent adds a content to this response
func (*Response) RemoveContent ¶
RemoveContent removes a content from this response
func (*Response) RemoveHeader ¶
RemoveHeader removes a header from this response
func (*Response) RemoveLink ¶
RemoveLink removes a link from this response
func (*Response) WithDescription ¶
WithDescription sets the description on this response, allows for chaining
type Schema ¶
type Schema struct { Refable `json:",inline"` // Allows sending a null value for the defined schema. // Default value is false. Nullable bool `json:"nullable,omitempty"` // Adds support for polymorphism. // The discriminator is an object name that is used to differentiate between other schemas which may satisfy the payload description. // See Composition and Inheritance for more details. Discriminator *Discriminator `json:"discriminator,omitempty"` // Relevant only for Schema "properties" definitions. // Declares the property as "read only". // This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. // If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. // A property MUST NOT be marked as both readOnly and writeOnly being true. // Default value is false. ReadOnly bool `json:"readOnly,omitempty"` // Relevant only for Schema "properties" definitions. // Declares the property as "write only". // Therefore, it MAY be sent as part of a request but SHOULD NOT be sent as part of the response. // If the property is marked as writeOnly being true and is in the required list, the required will take effect on the request only. // A property MUST NOT be marked as both readOnly and writeOnly being true. // Default value is false. WriteOnly bool `json:"writeOnly,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"` // Additional external documentation for this schema. ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` // Any A free-form property to include an example of an instance for this schema. // To represent examples that cannot be naturally represented in JSON or YAML, a string value can be used to contain the example with escaping where necessary. Example Any `json:"example,omitempty"` // Specifies that a schema is deprecated and SHOULD be transitioned out of usage. // Default value is false. Deprecated bool `json:"deprecated,omitempty"` Title string `json:"title,omitempty"` // Numbers MultipleOf *float64 `json:"multipleOf,omitempty"` Maximum *float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum *float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` // Strings MaxLength *int64 `json:"maxLength,omitempty"` MinLength *int64 `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` // Arrays MaxItems *int64 `json:"maxItems,omitempty"` MinItems *int64 `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` // Objects MaxProperties *int64 `json:"maxProperties,omitempty"` MinProperties *int64 `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` // All Enum []Any `json:"enum,omitempty"` // Value MUST be a string. // Multiple types via an array are not supported. Type OAPIType `json:"type,omitempty"` // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. AllOf []*Schema `json:"allOf,omitempty"` // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. OneOf []*Schema `json:"oneOf,omitempty"` // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. AnyOf []*Schema `json:"anyOf,omitempty"` // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. Not *Schema `json:"not,omitempty"` // Value MUST be an object and not an array. // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. // items MUST be present if the type is array. Items *Schema `json:"items,omitempty"` // Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced). Properties map[string]*Schema `json:"properties,omitempty"` // Value can be boolean or object. // Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. AdditionalProperties *Schema `json:"additionalProperties,omitempty"` // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // See Data Type Formats for further details. // While relying on JSON Schema's defined formats, the OAS offers a few additional predefined formats. Format string `json:"format,omitempty"` // The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided. // Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level. // For example, if type is string, then default can be "foo" but cannot be 1. Default Any `json:"default,omitempty"` }
Schema The 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. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
func ArrayProperty ¶
ArrayProperty creates an array property
func BinaryProperty ¶
func BinaryProperty() *Schema
BinaryProperty creates a string property any sequence of octets.
func ByteProperty ¶
func ByteProperty() *Schema
ByteProperty creates a string property base64 encoded characters.
func DateTimeProperty ¶
func DateTimeProperty() *Schema
DateTimeProperty creates a date time property
func Float32Property ¶
func Float32Property() *Schema
Float32Property creates a float32/float property
func Float64Property ¶
func Float64Property() *Schema
Float64Property creates a float64/double property
func FloatFmtProperty ¶
FloatFmtProperty creates a property for the named float format
func IntFmtProperty ¶
IntFmtProperty creates a property for the named int format
func PasswordProperty ¶
func PasswordProperty() *Schema
PasswordProperty creates a string property A hint to UIs to obscure input.
func StrFmtProperty ¶
StrFmtProperty creates a property for the named string format
func (*Schema) AddRequired ¶
AddRequired adds field names to the required properties array
func (*Schema) AddToAllOf ¶
AddToAllOf adds a schema to the allOf property
func (*Schema) AllowDuplicates ¶
AllowDuplicates this array can have duplicates
func (*Schema) AsReadOnly ¶
AsReadOnly flags this schema as readonly
func (*Schema) AsUnwrappedXML ¶
AsUnwrappedXML flags this object as an xml node
func (*Schema) AsWrappedXML ¶
AsWrappedXML flags this object as wrapped, this is mostly useful for array types
func (*Schema) AsWritable ¶
AsWritable flags this schema as writeable (not read-only)
func (*Schema) AsXMLAttribute ¶
AsXMLAttribute flags this object as xml attribute
func (*Schema) AsXMLElement ¶
AsXMLElement flags this object as an xml node
func (*Schema) UniqueValues ¶
UniqueValues dictates that this array can only have unique items
func (*Schema) WithDefault ¶
WithDefault sets the default value on this parameter
func (*Schema) WithDescription ¶
WithDescription sets the description for this schema, allows for chaining
func (*Schema) WithExample ¶
WithExample sets the example for this schema
func (*Schema) WithExternalDocs ¶
WithExternalDocs sets/removes the external docs for/from this schema. When you pass empty strings as params the external documents will be removed. When you pass non-empty string as one value then those values will be used on the external docs object. So when you pass a non-empty description, you should also pass the url and vice versa.
func (*Schema) WithFormat ¶
WithFormat sets the format of this schema for a single value item
func (*Schema) WithMaxItems ¶
WithMaxItems sets the max items
func (*Schema) WithMaxLength ¶
WithMaxLength sets a max length value
func (*Schema) WithMaxProperties ¶
WithMaxProperties sets the max number of properties an object can have
func (*Schema) WithMaximum ¶
WithMaximum sets a maximum number value
func (*Schema) WithMinItems ¶
WithMinItems sets the min items
func (*Schema) WithMinLength ¶
WithMinLength sets a min length value
func (*Schema) WithMinProperties ¶
WithMinProperties sets the min number of properties an object must have
func (*Schema) WithMinimum ¶
WithMinimum sets a minimum number value
func (*Schema) WithMultipleOf ¶
WithMultipleOf sets a multiple of value
func (*Schema) WithPattern ¶
WithPattern sets a pattern value
func (*Schema) WithProperties ¶
WithProperties sets the properties for this schema
func (*Schema) WithProperty ¶
WithProperty sets a property on this schema
func (*Schema) WithRequired ¶
WithRequired flags this parameter as required
func (*Schema) WithXMLName ¶
WithXMLName sets the xml name for the object
func (*Schema) WithXMLNamespace ¶
WithXMLNamespace sets the xml namespace for the object
func (*Schema) WithXMLPrefix ¶
WithXMLPrefix sets the xml prefix for the object
type SecurityRequirement ¶
type SecurityRequirement []string
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 Open API object or Operation Object, only one of 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. For other security scheme types, the array MUST be empty.
type SecurityScheme ¶
type SecurityScheme struct { Refable `json:",inline"` // Any REQUIRED. // The type of the security scheme. // Valid values are "apiKey", "http", "oauth2", "openIdConnect". Type string `json:"type"` // Any A short description for security scheme. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // apiKey REQUIRED. // The name of the header, query or cookie parameter to be used. Name string `json:"name,omitempty"` // apiKey REQUIRED. // The location of the API key. // Valid values are "query", "header" or "cookie". In string `json:"in,omitempty"` // http REQUIRED. // The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235. 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"` // oauth2 REQUIRED. // An object containing configuration information for the flow types supported. Flows *OAuthFlows `json:"flows,omitempty"` // openIdConnect REQUIRED. // OpenId Connect URL to discover OAuth2 configuration values. // This MUST be in the form of a URL. OpenIDConnectURL string `json:"openIdConnectUrl,omitempty"` }
SecurityScheme an API key (either as a header or as a query parameter), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect Discovery.
func APIKeyAuth ¶
func APIKeyAuth(fieldName, valueSource string) *SecurityScheme
APIKeyAuth creates an api key auth security scheme
func BearerAuth ¶
func BearerAuth(bearerFormat string) *SecurityScheme
BearerAuth creates a bearer auth security scheme
func OAuth2AuthorizationCode ¶
func OAuth2AuthorizationCode(tokenURL string) *SecurityScheme
OAuth2AuthorizationCode creates an application flow oauth2 security scheme
func OAuth2ClientCredentials ¶
func OAuth2ClientCredentials(authorizationURL, tokenURL string) *SecurityScheme
OAuth2ClientCredentials creates an access token flow oauth2 security scheme
func OAuth2Implicit ¶
func OAuth2Implicit(authorizationURL string) *SecurityScheme
OAuth2Implicit creates an implicit flow oauth2 security scheme
func OAuth2Password ¶
func OAuth2Password(tokenURL string) *SecurityScheme
OAuth2Password creates a password flow oauth2 security scheme
func (SecurityScheme) Entity ¶
func (s SecurityScheme) Entity() Entity
Entity satisfies componenter interface
type Server ¶
type Server struct { // REQUIRED. // 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"` // An optional string describing 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"` }
Server An object representing a Server.
func NewServers ¶
NewServers Will list all possible server options based on all servers
type ServerVariable ¶
type ServerVariable struct { // An enumeration of string values to be used if the substitution options are from a limited set. Enum []string `json:"enum,omitempty"` // REQUIRED. // The default value to use for substitution, and to send, if an alternate value is not supplied. // Unlike the Schema Object's default, this value MUST be provided by the consumer. Default string `json:"default"` // An optional description for the server variable. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` }
ServerVariable An object representing a Server Variable for server URL template substitution.
type Tag ¶
type Tag struct { // REQUIRED. // The name of the tag. Name string `json:"name"` // A short description for the tag. // CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // Additional external documentation for this tag ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` }
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.
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"` // The URI of the namespace definition. // Value 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"` }
XML 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.
func (*XML) AsAttribute ¶
AsAttribute flags this object as xml attribute
func (*XML) AsUnwrapped ¶
AsUnwrapped flags this object as an xml node
func (*XML) AsWrapped ¶
AsWrapped flags this object as wrapped, this is mostly useful for array types
func (*XML) WithNamespace ¶
WithNamespace sets the xml namespace for the object
func (*XML) WithPrefix ¶
WithPrefix sets the xml prefix for the object
Source Files ¶
- any.go
- any_or_expressions.go
- callback.go
- components.go
- contact.go
- discriminator.go
- doc.go
- encoding.go
- entity.go
- example.go
- expressions.go
- external_docs.go
- header.go
- header_util.go
- info.go
- license.go
- link.go
- media_type.go
- oauth_flow.go
- oauth_flows.go
- openapi.go
- operation.go
- parameter.go
- parameter_util.go
- paths.go
- refable.go
- request_body.go
- request_body_util.go
- response.go
- response_util.go
- schema.go
- schema_util.go
- security_requirement.go
- security_scheme.go
- security_scheme_util.go
- server.go
- server_util.go
- server_variable.go
- tag.go
- xml.go