package spec3
import "k8s.io/kube-openapi/pkg/spec3"
Index ¶
- Variables
- type Components
- type Encoding
- func (e *Encoding) MarshalJSON() ([]byte, error)
- func (e *Encoding) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (e *Encoding) UnmarshalJSON(data []byte) error
- func (e *Encoding) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type EncodingProps
- type Example
- func (e *Example) MarshalJSON() ([]byte, error)
- func (e *Example) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (e *Example) UnmarshalJSON(data []byte) error
- func (e *Example) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- 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
- func (h *Header) MarshalJSON() ([]byte, error)
- func (h *Header) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (h *Header) UnmarshalJSON(data []byte) error
- func (h *Header) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type HeaderProps
- type Link
- func (r *Link) MarshalJSON() ([]byte, error)
- func (r *Link) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (r *Link) UnmarshalJSON(data []byte) error
- func (l *Link) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type LinkProps
- type MediaType
- func (m *MediaType) MarshalJSON() ([]byte, error)
- func (e *MediaType) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (m *MediaType) UnmarshalJSON(data []byte) error
- func (m *MediaType) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type MediaTypeProps
- type OAuthFlow
- func (o *OAuthFlow) MarshalJSON() ([]byte, error)
- func (o *OAuthFlow) UnmarshalJSON(data []byte) error
- type OAuthFlowProps
- type OpenAPI
- func (o *OpenAPI) MarshalJSON() ([]byte, error)
- func (o *OpenAPI) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (o *OpenAPI) UnmarshalJSON(data []byte) error
- type Operation
- func (o *Operation) MarshalJSON() ([]byte, error)
- func (o *Operation) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (o *Operation) UnmarshalJSON(data []byte) error
- func (o *Operation) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type OperationProps
- type Parameter
- func (p *Parameter) MarshalJSON() ([]byte, error)
- func (p *Parameter) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (p *Parameter) UnmarshalJSON(data []byte) error
- func (p *Parameter) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type ParameterProps
- type Path
- func (p *Path) MarshalJSON() ([]byte, error)
- func (p *Path) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (p *Path) UnmarshalJSON(data []byte) error
- func (p *Path) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type PathProps
- type Paths
- func (p *Paths) MarshalJSON() ([]byte, error)
- func (p *Paths) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (p *Paths) UnmarshalJSON(data []byte) error
- func (p *Paths) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type RequestBody
- func (r *RequestBody) MarshalJSON() ([]byte, error)
- func (r *RequestBody) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (r *RequestBody) UnmarshalJSON(data []byte) error
- func (r *RequestBody) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type RequestBodyProps
- type Response
- func (r *Response) MarshalJSON() ([]byte, error)
- func (r Response) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (r *Response) UnmarshalJSON(data []byte) error
- func (r *Response) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type ResponseProps
- type Responses
- func (r *Responses) MarshalJSON() ([]byte, error)
- func (r Responses) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (r *Responses) UnmarshalJSON(data []byte) error
- func (r *Responses) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) (err error)
- type ResponsesProps
- func (r ResponsesProps) MarshalJSON() ([]byte, error)
- func (r *ResponsesProps) UnmarshalJSON(data []byte) error
- type SecurityScheme
- func (s *SecurityScheme) MarshalJSON() ([]byte, error)
- func (s *SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *SecurityScheme) UnmarshalJSON(data []byte) error
- type SecuritySchemeProps
- type SecuritySchemes
- type Server
- func (s *Server) MarshalJSON() ([]byte, error)
- func (s *Server) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *Server) UnmarshalJSON(data []byte) error
- func (s *Server) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- 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
Variables ¶
var OpenAPIV3FuzzFuncs []interface{} = []interface{}{ func(s *string, c randfill.Continue) { str := randAlphanumString() *s = str }, func(o *OpenAPI, c randfill.Continue) { c.FillNoCustom(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 randfill.Continue) { switch c.Intn(3) { case 0: *r = nil case 1: n := c.String(0) + "x" *r = n case 2: n := c.Float64() *r = n } }, func(v **spec.Info, c randfill.Continue) { *v = &spec.Info{} c.FillNoCustom(*v) (*v).Title = c.String(0) + "x" }, func(v *Paths, c randfill.Continue) { c.Fill(&v.VendorExtensible) num := c.Intn(5) if num > 0 { v.Paths = make(map[string]*Path) } for i := 0; i < num; i++ { val := Path{} c.Fill(&val) v.Paths["/"+c.String(0)] = &val } }, func(v *SecurityScheme, c randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Refable) return } switch c.Intn(4) { case 0: v.Type = "apiKey" v.Name = c.String(0) + "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.String(0) + "x" v.Flows["implicit"] = &flow flow.Scopes = make(map[string]string) flow.Scopes["foo"] = "bar" case 3: v.Type = "openIdConnect" v.OpenIdConnectUrl = "https://" + c.String(0) } v.Scheme = "basic" }, func(v *spec.Ref, c randfill.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 randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Refable) return } c.Fill(&v.ParameterProps) c.Fill(&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 randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Refable) return } c.Fill(&v.RequestBodyProps) c.Fill(&v.VendorExtensible) }, func(v *Header, c randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Refable) return } c.Fill(&v.HeaderProps) c.Fill(&v.VendorExtensible) }, func(v *ResponsesProps, c randfill.Continue) { c.Fill(&v.Default) n := c.Intn(5) for i := 0; i < n; i++ { r2 := Response{} c.Fill(&r2) code := c.Intn(500) + 100 v.StatusCodeResponses = make(map[int]*Response) v.StatusCodeResponses[code] = &r2 } }, func(v *Response, c randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Refable) return } c.Fill(&v.ResponseProps) c.Fill(&v.VendorExtensible) }, func(v *Operation, c randfill.Continue) { c.FillNoCustom(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 randfill.Continue) { numChildren := c.Intn(5) for i := 0; i < numChildren; i++ { if *v == nil { *v = spec.Extensions{} } (*v)["x-"+c.String(0)] = c.String(0) } }, func(v *spec.ExternalDocumentation, c randfill.Continue) { c.Fill(&v.Description) v.URL = "https://" + randAlphanumString() }, func(v *spec.SchemaURL, c randfill.Continue) { *v = spec.SchemaURL("https://" + randAlphanumString()) }, func(v *spec.SchemaOrBool, c randfill.Continue) { *v = spec.SchemaOrBool{} if c.Bool() { v.Allows = c.Bool() } else { v.Schema = &spec.Schema{} v.Allows = true c.Fill(&v.Schema) } }, func(v *spec.SchemaOrArray, c randfill.Continue) { *v = spec.SchemaOrArray{} if c.Bool() { schema := spec.Schema{} c.Fill(&schema) v.Schema = &schema } else { v.Schemas = []spec.Schema{} numChildren := c.Intn(5) for i := 0; i < numChildren; i++ { schema := spec.Schema{} c.Fill(&schema) v.Schemas = append(v.Schemas, schema) } } }, func(v *spec.SchemaOrStringArray, c randfill.Continue) { if c.Bool() { *v = spec.SchemaOrStringArray{} if c.Bool() { c.Fill(&v.Property) } else { c.Fill(&v.Schema) } } }, func(v *spec.Schema, c randfill.Continue) { if c.Intn(refChance) == 0 { c.Fill(&v.Ref) return } if c.Bool() { c.Fill(&v.Default) c.Fill(&v.Description) c.Fill(&v.Example) c.Fill(&v.ExternalDocs) c.Fill(&v.Format) c.Fill(&v.ReadOnly) c.Fill(&v.Required) c.Fill(&v.Title) v.Type = spec.StringOrArray{"file"} } else { c.Fill(&v.SchemaProps) c.Fill(&v.SwaggerSchemaProps) c.Fill(&v.VendorExtensible) c.Fill(&v.ExtraProps) } }, }
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 ExternalDocumentationProps ¶
type ExternalDocumentationProps 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"`
}
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 ¶
func (r *Responses) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) (err error)
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"`
}
Source Files ¶
component.go encoding.go example.go external_documentation.go fuzz.go header.go media_type.go operation.go parameter.go path.go request_body.go response.go security_scheme.go server.go spec.go
- Version
- v0.0.0-20250628140032-d90c4fd18f59 (latest)
- Published
- Jun 28, 2025
- Platform
- windows/amd64
- Imports
- 10 packages
- Last checked
- 10 months ago –
Tools for package owners.