Documentation ¶
Index ¶
- Variables
- type Components
- type Encoding
- type EncodingProps
- type Example
- type ExampleProps
- type ExternalDocumentation
- func (e *ExternalDocumentation) MarshalJSON() ([]byte, error)
- func (e *ExternalDocumentation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error
- func (e *ExternalDocumentation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type ExternalDocumentationProps
- type Header
- type HeaderProps
- type Link
- type LinkProps
- type MediaType
- type MediaTypeProps
- type OAuthFlow
- type OAuthFlowProps
- type OpenAPI
- type Operation
- type OperationProps
- type Parameter
- type ParameterProps
- type Path
- type PathProps
- type Paths
- type RequestBody
- type RequestBodyProps
- type Response
- type ResponseProps
- type Responses
- type ResponsesProps
- type SecurityScheme
- type SecuritySchemeProps
- type SecuritySchemes
- type Server
- type ServerProps
- type ServerVariable
- func (s *ServerVariable) MarshalJSON() ([]byte, error)
- func (s *ServerVariable) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *ServerVariable) UnmarshalJSON(data []byte) error
- func (s *ServerVariable) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type ServerVariableProps
Constants ¶
This section is empty.
Variables ¶
var OpenAPIV3FuzzFuncs []interface{} = []interface{}{ func(s *string, c fuzz.Continue) { str := randAlphanumString() *s = str }, func(o *OpenAPI, c fuzz.Continue) { c.FuzzNoCustom(o) o.Version = "3.0.0" for i, val := range o.SecurityRequirement { if val == nil { o.SecurityRequirement[i] = make(map[string][]string) } for k, v := range val { if v == nil { val[k] = make([]string, 0) } } } }, func(r *interface{}, c fuzz.Continue) { switch c.Intn(3) { case 0: *r = nil case 1: n := c.RandString() + "x" *r = n case 2: n := c.Float64() *r = n } }, func(v **spec.Info, c fuzz.Continue) { *v = &spec.Info{} c.FuzzNoCustom(*v) (*v).Title = c.RandString() + "x" }, func(v *Paths, c fuzz.Continue) { c.Fuzz(&v.VendorExtensible) num := c.Intn(5) if num > 0 { v.Paths = make(map[string]*Path) } for i := 0; i < num; i++ { val := Path{} c.Fuzz(&val) v.Paths["/"+c.RandString()] = &val } }, func(v *SecurityScheme, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Refable) return } switch c.Intn(4) { case 0: v.Type = "apiKey" v.Name = c.RandString() + "x" switch c.Intn(3) { case 0: v.In = "query" case 1: v.In = "header" case 2: v.In = "cookie" } case 1: v.Type = "http" case 2: v.Type = "oauth2" v.Flows = make(map[string]*OAuthFlow) flow := OAuthFlow{} flow.AuthorizationUrl = c.RandString() + "x" v.Flows["implicit"] = &flow flow.Scopes = make(map[string]string) flow.Scopes["foo"] = "bar" case 3: v.Type = "openIdConnect" v.OpenIdConnectUrl = "https://" + c.RandString() } v.Scheme = "basic" }, func(v *spec.Ref, c fuzz.Continue) { switch c.Intn(7) { case 0: *v = spec.MustCreateRef("#/components/schemas/" + randAlphanumString()) case 1: *v = spec.MustCreateRef("#/components/responses/" + randAlphanumString()) case 2: *v = spec.MustCreateRef("#/components/headers/" + randAlphanumString()) case 3: *v = spec.MustCreateRef("#/components/securitySchemes/" + randAlphanumString()) case 5: *v = spec.MustCreateRef("#/components/parameters/" + randAlphanumString()) case 6: *v = spec.MustCreateRef("#/components/requestBodies/" + randAlphanumString()) } }, func(v *Parameter, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Refable) return } c.Fuzz(&v.ParameterProps) c.Fuzz(&v.VendorExtensible) switch c.Intn(3) { case 0: v.In = "query" case 1: v.In = "header" case 2: v.In = "cookie" } }, func(v *RequestBody, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Refable) return } c.Fuzz(&v.RequestBodyProps) c.Fuzz(&v.VendorExtensible) }, func(v *Header, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Refable) return } c.Fuzz(&v.HeaderProps) c.Fuzz(&v.VendorExtensible) }, func(v *ResponsesProps, c fuzz.Continue) { c.Fuzz(&v.Default) n := c.Intn(5) for i := 0; i < n; i++ { r2 := Response{} c.Fuzz(&r2) code := c.Intn(500) + 100 v.StatusCodeResponses = make(map[int]*Response) v.StatusCodeResponses[code] = &r2 } }, func(v *Response, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Refable) return } c.Fuzz(&v.ResponseProps) c.Fuzz(&v.VendorExtensible) }, func(v *Operation, c fuzz.Continue) { c.FuzzNoCustom(v) for i, val := range v.SecurityRequirement { if val == nil { v.SecurityRequirement[i] = make(map[string][]string) } for k, v := range val { if v == nil { val[k] = make([]string, 0) } } } }, func(v *spec.Extensions, c fuzz.Continue) { numChildren := c.Intn(5) for i := 0; i < numChildren; i++ { if *v == nil { *v = spec.Extensions{} } (*v)["x-"+c.RandString()] = c.RandString() } }, func(v *spec.ExternalDocumentation, c fuzz.Continue) { c.Fuzz(&v.Description) v.URL = "https://" + randAlphanumString() }, func(v *spec.SchemaURL, c fuzz.Continue) { *v = spec.SchemaURL("https://" + randAlphanumString()) }, func(v *spec.SchemaOrBool, c fuzz.Continue) { *v = spec.SchemaOrBool{} if c.RandBool() { v.Allows = c.RandBool() } else { v.Schema = &spec.Schema{} v.Allows = true c.Fuzz(&v.Schema) } }, func(v *spec.SchemaOrArray, c fuzz.Continue) { *v = spec.SchemaOrArray{} if c.RandBool() { schema := spec.Schema{} c.Fuzz(&schema) v.Schema = &schema } else { v.Schemas = []spec.Schema{} numChildren := c.Intn(5) for i := 0; i < numChildren; i++ { schema := spec.Schema{} c.Fuzz(&schema) v.Schemas = append(v.Schemas, schema) } } }, func(v *spec.SchemaOrStringArray, c fuzz.Continue) { if c.RandBool() { *v = spec.SchemaOrStringArray{} if c.RandBool() { c.Fuzz(&v.Property) } else { c.Fuzz(&v.Schema) } } }, func(v *spec.Schema, c fuzz.Continue) { if c.Intn(refChance) == 0 { c.Fuzz(&v.Ref) return } if c.RandBool() { c.Fuzz(&v.Default) c.Fuzz(&v.Description) c.Fuzz(&v.Example) c.Fuzz(&v.ExternalDocs) c.Fuzz(&v.Format) c.Fuzz(&v.ReadOnly) c.Fuzz(&v.Required) c.Fuzz(&v.Title) v.Type = spec.StringOrArray{"file"} } else { c.Fuzz(&v.SchemaProps) c.Fuzz(&v.SwaggerSchemaProps) c.Fuzz(&v.VendorExtensible) c.Fuzz(&v.ExtraProps) } }, }
Functions ¶
This section is empty.
Types ¶
type Components ¶
type Components struct { // Schemas holds reusable Schema Objects Schemas map[string]*spec.Schema `json:"schemas,omitempty"` // SecuritySchemes holds reusable Security Scheme Objects, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securitySchemeObject SecuritySchemes SecuritySchemes `json:"securitySchemes,omitempty"` // Responses holds reusable Responses Objects Responses map[string]*Response `json:"responses,omitempty"` // Parameters holds reusable Parameters Objects Parameters map[string]*Parameter `json:"parameters,omitempty"` // Example holds reusable Example objects Examples map[string]*Example `json:"examples,omitempty"` // RequestBodies holds reusable Request Body objects RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty"` // Links is a map of operations links that can be followed from the response Links map[string]*Link `json:"links,omitempty"` // Headers holds a maps of a headers name to its definition Headers map[string]*Header `json:"headers,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.
more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#componentsObject
type Encoding ¶
type Encoding struct { EncodingProps spec.VendorExtensible }
func (*Encoding) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Encoding as JSON
func (*Encoding) MarshalNextJSON ¶
func (*Encoding) UnmarshalJSON ¶
func (*Encoding) UnmarshalNextJSON ¶
type EncodingProps ¶
type EncodingProps struct { // Content Type for encoding a specific property ContentType string `json:"contentType,omitempty"` // A map allowing additional information to be provided as headers Headers map[string]*Header `json:"headers,omitempty"` // Describes how a specific property value will be serialized depending on its type 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 Explode bool `json:"explode,omitempty"` // AllowReserved determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 AllowReserved bool `json:"allowReserved,omitempty"` }
type Example ¶
type Example struct { spec.Refable ExampleProps spec.VendorExtensible }
func (*Example) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode RequestBody as JSON
func (*Example) MarshalNextJSON ¶
func (*Example) UnmarshalJSON ¶
func (*Example) UnmarshalNextJSON ¶
type ExampleProps ¶
type ExampleProps struct { // Summary holds a short description of the example Summary string `json:"summary,omitempty"` // Description holds a long description of the example Description string `json:"description,omitempty"` // Embedded literal example. Value interface{} `json:"value,omitempty"` // 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. ExternalValue string `json:"externalValue,omitempty"` }
type ExternalDocumentation ¶
type ExternalDocumentation struct { ExternalDocumentationProps spec.VendorExtensible }
func (*ExternalDocumentation) MarshalJSON ¶
func (e *ExternalDocumentation) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (*ExternalDocumentation) MarshalNextJSON ¶
func (e *ExternalDocumentation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
func (*ExternalDocumentation) UnmarshalJSON ¶
func (e *ExternalDocumentation) UnmarshalJSON(data []byte) error
func (*ExternalDocumentation) UnmarshalNextJSON ¶
func (e *ExternalDocumentation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type Header ¶
type Header struct { spec.Refable HeaderProps spec.VendorExtensible }
Header a struct that describes a single operation parameter, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject
Note that this struct is actually a thin wrapper around HeaderProps to make it referable and extensible
func (*Header) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Header as JSON
func (*Header) MarshalNextJSON ¶
func (*Header) UnmarshalJSON ¶
func (*Header) UnmarshalNextJSON ¶
type HeaderProps ¶
type HeaderProps struct { // Description holds a brief description of the parameter Description string `json:"description,omitempty"` // Required determines whether this parameter is mandatory Required bool `json:"required,omitempty"` // Deprecated declares this operation to be deprecated Deprecated bool `json:"deprecated,omitempty"` // AllowEmptyValue sets the ability to pass empty-valued parameters AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // Style describes how the parameter value will be serialized depending on the type of the parameter value Style string `json:"style,omitempty"` // Explode when true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map Explode bool `json:"explode,omitempty"` // AllowReserved determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 AllowReserved bool `json:"allowReserved,omitempty"` // Schema holds the schema defining the type used for the parameter Schema *spec.Schema `json:"schema,omitempty"` // Content holds a map containing the representations for the parameter Content map[string]*MediaType `json:"content,omitempty"` // Example of the header Example interface{} `json:"example,omitempty"` // Examples of the header Examples map[string]*Example `json:"examples,omitempty"` }
HeaderProps a struct that describes a header object
type Link ¶
type Link struct { spec.Refable LinkProps spec.VendorExtensible }
Link represents a possible design-time link for a response, more at https://swagger.io/specification/#link-object
func (*Link) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Link as JSON
func (*Link) MarshalNextJSON ¶
func (*Link) UnmarshalJSON ¶
func (*Link) UnmarshalNextJSON ¶
type LinkProps ¶
type LinkProps struct { // OperationId is the name of an existing, resolvable OAS operation OperationId string `json:"operationId,omitempty"` // Parameters is a map representing parameters to pass to an operation as specified with operationId or identified via operationRef Parameters map[string]interface{} `json:"parameters,omitempty"` // Description holds a description of the link Description string `json:"description,omitempty"` // RequestBody is a literal value or expresion to use as a request body when calling the target operation RequestBody interface{} `json:"requestBody,omitempty"` // Server holds a server object used by the target operation Server *Server `json:"server,omitempty"` }
LinkProps describes a single response from an API Operation, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject
type MediaType ¶
type MediaType struct { MediaTypeProps spec.VendorExtensible }
MediaType a struct that allows you to specify content format, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#mediaTypeObject
Note that this struct is actually a thin wrapper around MediaTypeProps to make it referable and extensible
func (*MediaType) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode MediaType as JSON
func (*MediaType) MarshalNextJSON ¶
func (*MediaType) UnmarshalJSON ¶
func (*MediaType) UnmarshalNextJSON ¶
type MediaTypeProps ¶
type MediaTypeProps struct { // Schema holds the schema defining the type used for the media type Schema *spec.Schema `json:"schema,omitempty"` // Example of the media type Example interface{} `json:"example,omitempty"` // Examples of the media type. Each example object should match the media type and specific schema if present 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"` }
MediaTypeProps a struct that allows you to specify content format, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#mediaTypeObject
type OAuthFlow ¶
type OAuthFlow struct { OAuthFlowProps spec.VendorExtensible }
OAuthFlow contains configuration information for the flow types supported.
func (*OAuthFlow) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode OAuthFlow as JSON
func (*OAuthFlow) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type OAuthFlowProps ¶
type OAuthFlowProps struct { // AuthorizationUrl hold the authorization URL to be used for this flow AuthorizationUrl string `json:"authorizationUrl,omitempty"` // TokenUrl holds the token URL to be used for this flow TokenUrl string `json:"tokenUrl,omitempty"` // RefreshUrl holds the URL to be used for obtaining refresh tokens RefreshUrl string `json:"refreshUrl,omitempty"` // Scopes holds the available scopes for the OAuth2 security scheme Scopes map[string]string `json:"scopes,omitempty"` }
OAuthFlowProps holds configuration details for a supported OAuth Flow
type OpenAPI ¶
type OpenAPI struct { // Version represents the semantic version number of the OpenAPI Specification that this document uses Version string `json:"openapi"` // Info provides metadata about the API Info *spec.Info `json:"info"` // Paths holds the available target and operations for the API Paths *Paths `json:"paths,omitempty"` // Servers is an array of Server objects which provide connectivity information to a target server Servers []*Server `json:"servers,omitempty"` // Components hold various schemas for the specification Components *Components `json:"components,omitempty"` // SecurityRequirement holds a declaration of which security mechanisms can be used across the API SecurityRequirement []map[string][]string `json:"security,omitempty"` // ExternalDocs holds additional external documentation ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` }
OpenAPI is an object that describes an API and conforms to the OpenAPI Specification.
func (*OpenAPI) MarshalJSON ¶
func (*OpenAPI) MarshalNextJSON ¶
func (*OpenAPI) UnmarshalJSON ¶
type Operation ¶
type Operation struct { OperationProps spec.VendorExtensible }
Operation describes a single API operation on a path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#operationObject
Note that this struct is actually a thin wrapper around OperationProps to make it referable and extensible
func (*Operation) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Operation as JSON
func (*Operation) MarshalNextJSON ¶
func (*Operation) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Operation) UnmarshalNextJSON ¶
type OperationProps ¶
type OperationProps struct { // Tags holds a list of tags for API documentation control Tags []string `json:"tags,omitempty"` // Summary holds a short summary of what the operation does Summary string `json:"summary,omitempty"` // Description holds a verbose explanation of the operation behavior Description string `json:"description,omitempty"` // ExternalDocs holds additional external documentation for this operation ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` // OperationId holds a unique string used to identify the operation OperationId string `json:"operationId,omitempty"` // Parameters a list of parameters that are applicable for this operation Parameters []*Parameter `json:"parameters,omitempty"` // RequestBody holds the request body applicable for this operation RequestBody *RequestBody `json:"requestBody,omitempty"` // Responses holds the list of possible responses as they are returned from executing this operation Responses *Responses `json:"responses,omitempty"` // Deprecated declares this operation to be deprecated Deprecated bool `json:"deprecated,omitempty"` // SecurityRequirement holds a declaration of which security mechanisms can be used for this operation SecurityRequirement []map[string][]string `json:"security,omitempty"` // Servers contains an alternative server array to service this operation Servers []*Server `json:"servers,omitempty"` }
OperationProps describes a single API operation on a path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#operationObject
type Parameter ¶
type Parameter struct { spec.Refable ParameterProps spec.VendorExtensible }
Parameter a struct that describes a single operation parameter, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject
Note that this struct is actually a thin wrapper around ParameterProps to make it referable and extensible
func (*Parameter) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Parameter as JSON
func (*Parameter) MarshalNextJSON ¶
func (*Parameter) UnmarshalJSON ¶
func (*Parameter) UnmarshalNextJSON ¶
type ParameterProps ¶
type ParameterProps struct { // Name holds the name of the parameter Name string `json:"name,omitempty"` // In holds the location of the parameter In string `json:"in,omitempty"` // Description holds a brief description of the parameter Description string `json:"description,omitempty"` // Required determines whether this parameter is mandatory Required bool `json:"required,omitempty"` // Deprecated declares this operation to be deprecated Deprecated bool `json:"deprecated,omitempty"` // AllowEmptyValue sets the ability to pass empty-valued parameters AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` // Style describes how the parameter value will be serialized depending on the type of the parameter value Style string `json:"style,omitempty"` // Explode when true, parameter values of type array or object generate separate parameters for each value of the array or key-value pair of the map Explode bool `json:"explode,omitempty"` // AllowReserved determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 AllowReserved bool `json:"allowReserved,omitempty"` // Schema holds the schema defining the type used for the parameter Schema *spec.Schema `json:"schema,omitempty"` // Content holds a map containing the representations for the parameter Content map[string]*MediaType `json:"content,omitempty"` // Example of the parameter's potential value Example interface{} `json:"example,omitempty"` // Examples of the parameter's potential value. Each example SHOULD contain a value in the correct format as specified in the parameter encoding Examples map[string]*Example `json:"examples,omitempty"` }
ParameterProps a struct that describes a single operation parameter, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#parameterObject
type Path ¶
type Path struct { spec.Refable PathProps spec.VendorExtensible }
Path describes the operations available on a single path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject
Note that this struct is actually a thin wrapper around PathProps to make it referable and extensible
func (*Path) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Path as JSON
func (*Path) MarshalNextJSON ¶
func (*Path) UnmarshalJSON ¶
func (*Path) UnmarshalNextJSON ¶
type PathProps ¶
type PathProps struct { // Summary holds a summary for all operations in this path Summary string `json:"summary,omitempty"` // Description holds a description for all operations in this path Description string `json:"description,omitempty"` // Get defines GET operation Get *Operation `json:"get,omitempty"` // Put defines PUT operation Put *Operation `json:"put,omitempty"` // Post defines POST operation Post *Operation `json:"post,omitempty"` // Delete defines DELETE operation Delete *Operation `json:"delete,omitempty"` // Options defines OPTIONS operation Options *Operation `json:"options,omitempty"` // Head defines HEAD operation Head *Operation `json:"head,omitempty"` // Patch defines PATCH operation Patch *Operation `json:"patch,omitempty"` // Trace defines TRACE operation Trace *Operation `json:"trace,omitempty"` // Servers is an alternative server array to service all operations in this path Servers []*Server `json:"servers,omitempty"` // Parameters a list of parameters that are applicable for this operation Parameters []*Parameter `json:"parameters,omitempty"` }
PathProps describes the operations available on a single path, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathItemObject
type Paths ¶
type Paths struct { Paths map[string]*Path spec.VendorExtensible }
Paths describes the available paths and operations for the API, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#pathsObject
func (*Paths) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Paths as JSON
func (*Paths) MarshalNextJSON ¶
func (*Paths) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Paths) UnmarshalNextJSON ¶
type RequestBody ¶
type RequestBody struct { spec.Refable RequestBodyProps spec.VendorExtensible }
RequestBody describes a single request body, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#requestBodyObject
Note that this struct is actually a thin wrapper around RequestBodyProps to make it referable and extensible
func (*RequestBody) MarshalJSON ¶
func (r *RequestBody) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshal function that knows how to encode RequestBody as JSON
func (*RequestBody) MarshalNextJSON ¶
func (r *RequestBody) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
func (*RequestBody) UnmarshalJSON ¶
func (r *RequestBody) UnmarshalJSON(data []byte) error
func (*RequestBody) UnmarshalNextJSON ¶
func (r *RequestBody) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type RequestBodyProps ¶
type RequestBodyProps struct { // Description holds a brief description of the request body Description string `json:"description,omitempty"` // Content is the content of the request body. The key is a media type or media type range and the value describes it Content map[string]*MediaType `json:"content,omitempty"` // Required determines if the request body is required in the request Required bool `json:"required,omitempty"` }
RequestBodyProps describes a single request body, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#requestBodyObject
type Response ¶
type Response struct { spec.Refable ResponseProps spec.VendorExtensible }
Response describes a single response from an API Operation, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject
Note that this struct is actually a thin wrapper around ResponseProps to make it referable and extensible
func (*Response) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Response as JSON
func (Response) MarshalNextJSON ¶
func (*Response) UnmarshalJSON ¶
func (*Response) UnmarshalNextJSON ¶
type ResponseProps ¶
type ResponseProps struct { // Description holds a short description of the response Description string `json:"description,omitempty"` // Headers holds a maps of a headers name to its definition Headers map[string]*Header `json:"headers,omitempty"` // Content holds a map containing descriptions of potential response payloads Content map[string]*MediaType `json:"content,omitempty"` // Links is a map of operations links that can be followed from the response Links map[string]*Link `json:"links,omitempty"` }
ResponseProps describes a single response from an API Operation, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responseObject
type Responses ¶
type Responses struct { ResponsesProps spec.VendorExtensible }
Responses holds the list of possible responses as they are returned from executing this operation
Note that this struct is actually a thin wrapper around ResponsesProps to make it referable and extensible
func (*Responses) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (Responses) MarshalNextJSON ¶
func (*Responses) UnmarshalJSON ¶
func (*Responses) UnmarshalNextJSON ¶
type ResponsesProps ¶
type ResponsesProps struct { // Default holds the documentation of responses other than the ones declared for specific HTTP response codes. Use this field to cover undeclared responses Default *Response `json:"-"` // StatusCodeResponses holds a map of any HTTP status code to the response definition StatusCodeResponses map[int]*Response `json:"-"` }
ResponsesProps holds the list of possible responses as they are returned from executing this operation
func (ResponsesProps) MarshalJSON ¶
func (r ResponsesProps) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshal function that knows how to encode ResponsesProps as JSON
func (*ResponsesProps) UnmarshalJSON ¶
func (r *ResponsesProps) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals responses from JSON
type SecurityScheme ¶
type SecurityScheme struct { spec.Refable SecuritySchemeProps spec.VendorExtensible }
SecurityScheme defines reusable Security Scheme Object, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securitySchemeObject
func (*SecurityScheme) MarshalJSON ¶
func (s *SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshal function that knows how to encode SecurityScheme as JSON
func (*SecurityScheme) MarshalNextJSON ¶
func (s *SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
func (*SecurityScheme) UnmarshalJSON ¶
func (s *SecurityScheme) UnmarshalJSON(data []byte) error
UnmarshalJSON hydrates this items instance with the data from JSON
type SecuritySchemeProps ¶
type SecuritySchemeProps struct { // Type of the security scheme Type string `json:"type,omitempty"` // Description holds a short description for security scheme Description string `json:"description,omitempty"` // Name holds the name of the header, query or cookie parameter to be used Name string `json:"name,omitempty"` // In holds the location of the API key In string `json:"in,omitempty"` // Scheme holds the name of the HTTP Authorization scheme to be used in the Authorization header Scheme string `json:"scheme,omitempty"` // BearerFormat holds a hint to the client to identify how the bearer token is formatted BearerFormat string `json:"bearerFormat,omitempty"` // Flows contains configuration information for the flow types supported. Flows map[string]*OAuthFlow `json:"flows,omitempty"` // OpenIdConnectUrl holds an url to discover OAuth2 configuration values from OpenIdConnectUrl string `json:"openIdConnectUrl,omitempty"` }
SecuritySchemeProps defines a security scheme that can be used by the operations
type SecuritySchemes ¶
type SecuritySchemes map[string]*SecurityScheme
SecuritySchemes holds reusable Security Scheme Objects, more at https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#securitySchemeObject
type Server ¶
type Server struct { ServerProps spec.VendorExtensible }
func (*Server) MarshalJSON ¶
MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (*Server) MarshalNextJSON ¶
func (*Server) UnmarshalJSON ¶
func (*Server) UnmarshalNextJSON ¶
type ServerProps ¶
type ServerProps struct { // Description is a short description of the target documentation. CommonMark syntax MAY be used for rich text representation. Description string `json:"description,omitempty"` // URL is the URL for the target documentation. URL string `json:"url"` // Variables contains a map between a variable name and its value. The value is used for substitution in the server's URL templeate Variables map[string]*ServerVariable `json:"variables,omitempty"` }
type ServerVariable ¶
type ServerVariable struct { ServerVariableProps spec.VendorExtensible }
func (*ServerVariable) MarshalJSON ¶
func (s *ServerVariable) MarshalJSON() ([]byte, error)
MarshalJSON is a custom marshal function that knows how to encode Responses as JSON
func (*ServerVariable) MarshalNextJSON ¶
func (s *ServerVariable) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
func (*ServerVariable) UnmarshalJSON ¶
func (s *ServerVariable) UnmarshalJSON(data []byte) error
func (*ServerVariable) UnmarshalNextJSON ¶
func (s *ServerVariable) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type ServerVariableProps ¶
type ServerVariableProps struct { // Enum is an enumeration of string values to be used if the substitution options are from a limited set Enum []string `json:"enum,omitempty"` // Default is the default value to use for substitution, which SHALL be sent if an alternate value is not supplied Default string `json:"default"` // Description is a description for the server variable Description string `json:"description,omitempty"` }