Documentation ¶
Index ¶
- type CommonValidations
- type ContactInfo
- type Definitions
- type Dependencies
- type Extensions
- type ExternalDocumentation
- type GnosticCommonParamProps
- type GnosticCommonParamPropsBodyParameter
- type GnosticCommonParamPropsFormData
- type GnosticCommonSecurityDefinition
- type GnosticCommonValidations
- type GnosticSimpleSchema
- type Header
- func (k *Header) FromGnostic(g *openapi_v2.Header) (err error)
- 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 Info
- func (k *Info) FromGnostic(g *openapi_v2.Info) (ok bool, err error)
- func (i Info) MarshalJSON() ([]byte, error)
- func (i Info) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (i *Info) UnmarshalJSON(data []byte) error
- func (i *Info) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type InfoProps
- type Items
- func (k *Items) FromGnostic(g *openapi_v2.PrimitivesItems) error
- func (i Items) MarshalJSON() ([]byte, error)
- func (i Items) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (i *Items) UnmarshalJSON(data []byte) error
- func (i *Items) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type License
- type Operation
- func (k *Operation) FromGnostic(g *openapi_v2.Operation) (ok bool, err error)
- 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 ParamProps
- type Parameter
- func (k *Parameter) FromGnostic(g *openapi_v2.Parameter) (ok bool, err error)
- func (k *Parameter) FromGnosticParametersItem(g *openapi_v2.ParametersItem) (ok bool, err error)
- 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 PathItem
- func (k *PathItem) FromGnostic(g *openapi_v2.PathItem) (ok bool, err error)
- func (p PathItem) MarshalJSON() ([]byte, error)
- func (p PathItem) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (p *PathItem) UnmarshalJSON(data []byte) error
- func (p *PathItem) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type PathItemProps
- type Paths
- func (k *Paths) FromGnostic(g *openapi_v2.Paths) (ok bool, err error)
- 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 Ref
- type Refable
- type Response
- func (k *Response) FromGnostic(g *openapi_v2.Response) (ok bool, err error)
- func (k *Response) FromGnosticResponseValue(g *openapi_v2.ResponseValue) (ok bool, err error)
- 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 (k *Responses) FromGnostic(g *openapi_v2.Responses) (ok bool, err error)
- 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
- type Schema
- func ArrayProperty(items *Schema) *Schema
- func BoolProperty() *Schema
- func BooleanProperty() *Schema
- func CharProperty() *Schema
- func ComposedSchema(schemas ...Schema) *Schema
- func DateProperty() *Schema
- func DateTimeProperty() *Schema
- func Float32Property() *Schema
- func Float64Property() *Schema
- func Int16Property() *Schema
- func Int32Property() *Schema
- func Int64Property() *Schema
- func Int8Property() *Schema
- func MapProperty(property *Schema) *Schema
- func RefProperty(name string) *Schema
- func RefSchema(name string) *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) AddType(tpe, format string) *Schema
- func (s *Schema) AllowDuplicates() *Schema
- func (s *Schema) AsNullable() *Schema
- func (s *Schema) AsReadOnly() *Schema
- func (s *Schema) AsWritable() *Schema
- func (s *Schema) CollectionOf(items Schema) *Schema
- func (k *Schema) FromGnostic(g *openapi_v2.Schema) (ok bool, err error)
- func (k *Schema) FromGnosticSchemaItem(g *openapi_v2.SchemaItem) (ok bool, err error)
- func (s Schema) MarshalJSON() ([]byte, error)
- func (s Schema) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *Schema) SetProperty(name string, schema Schema) *Schema
- func (s *Schema) Typed(tpe, format string) *Schema
- func (s *Schema) UniqueValues() *Schema
- func (s *Schema) UnmarshalJSON(data []byte) error
- func (s *Schema) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- func (s *Schema) WithAllOf(schemas ...Schema) *Schema
- func (s *Schema) WithDefault(defaultValue interface{}) *Schema
- func (s *Schema) WithDescription(description string) *Schema
- func (s *Schema) WithDiscriminator(discriminator string) *Schema
- func (s *Schema) WithEnum(values ...interface{}) *Schema
- func (s *Schema) WithExample(example interface{}) *Schema
- func (s *Schema) WithExternalDocs(description, url string) *Schema
- func (s *Schema) WithID(id 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) WithRequired(items ...string) *Schema
- func (s *Schema) WithTitle(title string) *Schema
- type SchemaOrArray
- func (s *SchemaOrArray) ContainsType(name string) bool
- func (s SchemaOrArray) Len() int
- func (s SchemaOrArray) MarshalJSON() ([]byte, error)
- func (s SchemaOrArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *SchemaOrArray) UnmarshalJSON(data []byte) error
- func (s *SchemaOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type SchemaOrBool
- type SchemaOrStringArray
- func (s SchemaOrStringArray) MarshalJSON() ([]byte, error)
- func (s SchemaOrStringArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error
- func (s *SchemaOrStringArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type SchemaProps
- type SchemaURL
- type SecurityDefinitions
- type SecurityScheme
- func (k *SecurityScheme) FromGnostic(g *openapi_v2.SecurityDefinitionsItem) error
- func (s SecurityScheme) MarshalJSON() ([]byte, error)
- func (s SecurityScheme) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *SecurityScheme) UnmarshalJSON(data []byte) error
- func (s *SecurityScheme) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type SecuritySchemeProps
- type SimpleSchema
- type StringOrArray
- type Swagger
- func (k *Swagger) FromGnostic(g *openapi_v2.Document) (ok bool, err error)
- func (s Swagger) MarshalJSON() ([]byte, error)
- func (s Swagger) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (s *Swagger) UnmarshalJSON(data []byte) error
- func (s *Swagger) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type SwaggerProps
- type SwaggerSchemaProps
- type Tag
- func (k *Tag) FromGnostic(g *openapi_v2.Tag) (ok bool, err error)
- func (t Tag) MarshalJSON() ([]byte, error)
- func (t Tag) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
- func (t *Tag) UnmarshalJSON(data []byte) error
- func (t *Tag) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
- type TagProps
- type VendorExtensible
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonValidations ¶
type CommonValidations struct { Maximum *float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum *float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength *int64 `json:"maxLength,omitempty"` MinLength *int64 `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems *int64 `json:"maxItems,omitempty"` MinItems *int64 `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf *float64 `json:"multipleOf,omitempty"` Enum []interface{} `json:"enum,omitempty"` }
CommonValidations describe common JSON-schema validations
func (*CommonValidations) FromGnostic ¶
func (k *CommonValidations) FromGnostic(g GnosticCommonValidations) error
type ContactInfo ¶
type ContactInfo struct { Name string `json:"name,omitempty"` URL string `json:"url,omitempty"` Email string `json:"email,omitempty"` }
ContactInfo contact information for the exposed API.
For more information: http://goo.gl/8us55a#contactObject
func (*ContactInfo) FromGnostic ¶
func (k *ContactInfo) FromGnostic(g *openapi_v2.Contact) (ok bool, err error)
type Definitions ¶
Definitions contains the models explicitly defined in this spec An object to hold data types that can be consumed and produced by operations. These data types can be primitives, arrays or models.
For more information: http://goo.gl/8us55a#definitionsObject
type Dependencies ¶
type Dependencies map[string]SchemaOrStringArray
Dependencies represent a dependencies property
type Extensions ¶
type Extensions map[string]interface{}
Extensions vendor specific extensions
func (Extensions) Add ¶
func (e Extensions) Add(key string, value interface{})
Add adds a value to these extensions
func (Extensions) GetBool ¶
func (e Extensions) GetBool(key string) (bool, bool)
GetBool gets a string value from the extensions
func (Extensions) GetObject ¶
func (e Extensions) GetObject(key string, out interface{}) error
GetObject gets the object value from the extensions. out must be a json serializable type; the json go struct tags of out are used to populate it.
func (Extensions) GetString ¶
func (e Extensions) GetString(key string) (string, bool)
GetString gets a string value from the extensions
func (Extensions) GetStringSlice ¶
func (e Extensions) GetStringSlice(key string) ([]string, bool)
GetStringSlice gets a string value from the extensions
type ExternalDocumentation ¶
type ExternalDocumentation struct { Description string `json:"description,omitempty"` URL string `json:"url,omitempty"` }
ExternalDocumentation allows referencing an external resource for extended documentation.
For more information: http://goo.gl/8us55a#externalDocumentationObject
func (*ExternalDocumentation) FromGnostic ¶
func (k *ExternalDocumentation) FromGnostic(g *openapi_v2.ExternalDocs) (ok bool, err error)
type GnosticCommonParamProps ¶
type GnosticCommonParamPropsBodyParameter ¶
type GnosticCommonParamPropsBodyParameter interface {
GetSchema() *openapi_v2.Schema
}
type GnosticCommonParamPropsFormData ¶
type GnosticCommonParamPropsFormData interface {
GetAllowEmptyValue() bool
}
type GnosticCommonValidations ¶
type GnosticCommonValidations interface { GetMaximum() float64 GetExclusiveMaximum() bool GetMinimum() float64 GetExclusiveMinimum() bool GetMaxLength() int64 GetMinLength() int64 GetPattern() string GetMaxItems() int64 GetMinItems() int64 GetUniqueItems() bool GetMultipleOf() float64 GetEnum() []*openapi_v2.Any }
Interfaces
type GnosticSimpleSchema ¶
type GnosticSimpleSchema interface { GetType() string GetFormat() string GetItems() *openapi_v2.PrimitivesItems GetCollectionFormat() string GetDefault() *openapi_v2.Any }
type Header ¶
type Header struct { CommonValidations SimpleSchema VendorExtensible HeaderProps }
Header describes a header for a response of the API
For more information: http://goo.gl/8us55a#headerObject
func (*Header) FromGnostic ¶
func (k *Header) FromGnostic(g *openapi_v2.Header) (err error)
func (Header) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (Header) MarshalNextJSON ¶
func (*Header) UnmarshalJSON ¶
UnmarshalJSON unmarshals this header from JSON
func (*Header) UnmarshalNextJSON ¶
type HeaderProps ¶
type HeaderProps struct {
Description string `json:"description,omitempty"`
}
HeaderProps describes a response header
func (*HeaderProps) FromGnostic ¶
func (k *HeaderProps) FromGnostic(g *openapi_v2.Header) error
type Info ¶
type Info struct { VendorExtensible InfoProps }
Info object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
For more information: http://goo.gl/8us55a#infoObject
func (*Info) FromGnostic ¶
func (k *Info) FromGnostic(g *openapi_v2.Info) (ok bool, err error)
func (Info) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (Info) MarshalNextJSON ¶
func (*Info) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
func (*Info) UnmarshalNextJSON ¶
type InfoProps ¶
type InfoProps struct { Description string `json:"description,omitempty"` Title string `json:"title,omitempty"` TermsOfService string `json:"termsOfService,omitempty"` Contact *ContactInfo `json:"contact,omitempty"` License *License `json:"license,omitempty"` Version string `json:"version,omitempty"` }
InfoProps the properties for an info definition
func (*InfoProps) FromGnostic ¶
func (k *InfoProps) FromGnostic(g *openapi_v2.Info) (ok bool, err error)
type Items ¶
type Items struct { Refable CommonValidations SimpleSchema VendorExtensible }
Items a limited subset of JSON-Schema's items object. It is used by parameter definitions that are not located in "body".
For more information: http://goo.gl/8us55a#items-object
func (*Items) FromGnostic ¶
func (k *Items) FromGnostic(g *openapi_v2.PrimitivesItems) error
func (Items) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (Items) MarshalNextJSON ¶
func (*Items) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Items) UnmarshalNextJSON ¶
type License ¶
License information for the exposed API.
For more information: http://goo.gl/8us55a#licenseObject
func (*License) FromGnostic ¶
func (k *License) FromGnostic(g *openapi_v2.License) (ok bool, err error)
type Operation ¶
type Operation struct { VendorExtensible OperationProps }
Operation describes a single API operation on a path.
For more information: http://goo.gl/8us55a#operationObject
func (*Operation) FromGnostic ¶
func (k *Operation) FromGnostic(g *openapi_v2.Operation) (ok bool, err error)
func (Operation) MarshalJSON ¶
MarshalJSON converts this items object to 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 { Description string `json:"description,omitempty"` Consumes []string `json:"consumes,omitempty"` Produces []string `json:"produces,omitempty"` Schemes []string `json:"schemes,omitempty"` Tags []string `json:"tags,omitempty"` Summary string `json:"summary,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` ID string `json:"operationId,omitempty"` Deprecated bool `json:"deprecated,omitempty"` Security []map[string][]string `json:"security,omitempty"` Parameters []Parameter `json:"parameters,omitempty"` Responses *Responses `json:"responses,omitempty"` }
OperationProps describes an operation
NOTES: - schemes, when present must be from [http, https, ws, wss]: see validate - Security is handled as a special case: see MarshalJSON function
func (*OperationProps) FromGnostic ¶
func (k *OperationProps) FromGnostic(g *openapi_v2.Operation) (ok bool, err error)
func (OperationProps) MarshalJSON ¶
func (op OperationProps) MarshalJSON() ([]byte, error)
MarshalJSON takes care of serializing operation properties to JSON
We use a custom marhaller here to handle a special cases related to the Security field. We need to preserve zero length slice while omitting the field when the value is nil/unset.
type ParamProps ¶
type ParamProps struct { Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` In string `json:"in,omitempty"` Required bool `json:"required,omitempty"` Schema *Schema `json:"schema,omitempty"` AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` }
ParamProps describes the specific attributes of an operation parameter
NOTE: - Schema is defined when "in" == "body": see validate - AllowEmptyValue is allowed where "in" == "query" || "formData"
func (*ParamProps) FromGnostic ¶
func (k *ParamProps) FromGnostic(g GnosticCommonParamProps) (ok bool, err error)
type Parameter ¶
type Parameter struct { Refable CommonValidations SimpleSchema VendorExtensible ParamProps }
Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn).
There are five possible parameter types. * Path - Used together with [Path Templating](#pathTemplating), 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. * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be
_one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
* Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or
`multipart/form-data` are used as the content type of the request (in Swagger's definition, the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same operation. Form parameters have a different format based on the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple parameters that are being transferred. * `multipart/form-data` - each parameter takes a section in the payload with an internal header. For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is `submit-name`. This type of form parameters is more commonly used for file transfers.
For more information: http://goo.gl/8us55a#parameterObject
func (*Parameter) FromGnostic ¶
func (k *Parameter) FromGnostic(g *openapi_v2.Parameter) (ok bool, err error)
func (*Parameter) FromGnosticParametersItem ¶
func (k *Parameter) FromGnosticParametersItem(g *openapi_v2.ParametersItem) (ok bool, err error)
PB types use a different structure than we do for "refable". For PB, there is a wrappign oneof type that could be a ref or the type
func (Parameter) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (Parameter) MarshalNextJSON ¶
func (*Parameter) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Parameter) UnmarshalNextJSON ¶
type PathItem ¶
type PathItem struct { Refable VendorExtensible PathItemProps }
PathItem describes the operations available on a single path. A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
For more information: http://goo.gl/8us55a#pathItemObject
func (*PathItem) FromGnostic ¶
func (k *PathItem) FromGnostic(g *openapi_v2.PathItem) (ok bool, err error)
func (PathItem) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (PathItem) MarshalNextJSON ¶
func (*PathItem) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*PathItem) UnmarshalNextJSON ¶
type PathItemProps ¶
type PathItemProps struct { Get *Operation `json:"get,omitempty"` Put *Operation `json:"put,omitempty"` Post *Operation `json:"post,omitempty"` Delete *Operation `json:"delete,omitempty"` Options *Operation `json:"options,omitempty"` Head *Operation `json:"head,omitempty"` Patch *Operation `json:"patch,omitempty"` Parameters []Parameter `json:"parameters,omitempty"` }
PathItemProps the path item specific properties
func (*PathItemProps) FromGnostic ¶
func (k *PathItemProps) FromGnostic(g *openapi_v2.PathItem) (ok bool, err error)
type Paths ¶
type Paths struct { VendorExtensible Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/" }
Paths holds the relative paths to the individual endpoints. The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order to construct the full URL. The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering).
For more information: http://goo.gl/8us55a#pathsObject
func (*Paths) FromGnostic ¶
func (k *Paths) FromGnostic(g *openapi_v2.Paths) (ok bool, err error)
func (Paths) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (Paths) MarshalNextJSON ¶
func (*Paths) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Paths) UnmarshalNextJSON ¶
type Ref ¶
type Ref struct {
jsonreference.Ref
}
Ref represents a json reference that is potentially resolved
func MustCreateRef ¶
MustCreateRef creates a ref object but panics when refURI is invalid. Use the NewRef method for a version that returns an error.
func NewRef ¶
NewRef creates a new instance of a ref object returns an error when the reference uri is an invalid uri
func (*Ref) FromGnostic ¶
func (*Ref) Inherits ¶
Inherits creates a new reference from a parent and a child If the child cannot inherit from the parent, an error is returned
func (*Ref) IsValidURI ¶
IsValidURI returns true when the url the ref points to can be found
func (Ref) MarshalJSON ¶
MarshalJSON marshals this ref into a JSON object
func (*Ref) UnmarshalJSON ¶
UnmarshalJSON unmarshals this ref from a JSON object
type Refable ¶
type Refable struct {
Ref Ref
}
Refable is a struct for things that accept a $ref property
func (*Refable) FromGnostic ¶
func (Refable) MarshalJSON ¶
MarshalJSON marshals the ref to json
func (*Refable) UnmarshalJSON ¶
UnmarshalJSON unmarshalss the ref from json
type Response ¶
type Response struct { Refable ResponseProps VendorExtensible }
Response describes a single response from an API Operation.
For more information: http://goo.gl/8us55a#responseObject
func ResponseRef ¶
ResponseRef creates a response as a json reference
func (*Response) FromGnostic ¶
func (k *Response) FromGnostic(g *openapi_v2.Response) (ok bool, err error)
func (*Response) FromGnosticResponseValue ¶
func (k *Response) FromGnosticResponseValue(g *openapi_v2.ResponseValue) (ok bool, err error)
func (Response) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (Response) MarshalNextJSON ¶
func (*Response) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Response) UnmarshalNextJSON ¶
type ResponseProps ¶
type ResponseProps struct { Description string `json:"description,omitempty"` Schema *Schema `json:"schema,omitempty"` Headers map[string]Header `json:"headers,omitempty"` Examples map[string]interface{} `json:"examples,omitempty"` }
ResponseProps properties specific to a response
func (*ResponseProps) FromGnostic ¶
func (k *ResponseProps) FromGnostic(g *openapi_v2.Response) (ok bool, err error)
type Responses ¶
type Responses struct { VendorExtensible ResponsesProps }
Responses is a container for the expected responses of an operation. The container maps a HTTP response code to the expected response. It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors.
The `default` can be used a default response object for all HTTP codes that are not covered individually by the specification.
The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
For more information: http://goo.gl/8us55a#responsesObject
func (*Responses) FromGnostic ¶
func (k *Responses) FromGnostic(g *openapi_v2.Responses) (ok bool, err error)
func (Responses) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (Responses) MarshalNextJSON ¶
func (*Responses) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Responses) UnmarshalNextJSON ¶
type ResponsesProps ¶
ResponsesProps describes all responses for an operation. It tells what is the default response and maps all responses with a HTTP status code.
func (*ResponsesProps) FromGnostic ¶
func (k *ResponsesProps) FromGnostic(g *openapi_v2.Responses) (ok bool, err error)
func (ResponsesProps) MarshalJSON ¶
func (r ResponsesProps) MarshalJSON() ([]byte, error)
MarshalJSON marshals responses as JSON
func (*ResponsesProps) UnmarshalJSON ¶
func (r *ResponsesProps) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals responses from JSON
type Schema ¶
type Schema struct { VendorExtensible SchemaProps SwaggerSchemaProps ExtraProps map[string]interface{} `json:"-"` }
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 based on the [JSON Schema Specification Draft 4](http://json-schema.org/) and uses a predefined subset of it. On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
For more information: http://goo.gl/8us55a#schemaObject
func ArrayProperty ¶
ArrayProperty creates an array property
func ComposedSchema ¶
ComposedSchema creates a schema with allOf
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 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) AsNullable ¶
AsNullable flags this schema as nullable.
func (*Schema) AsReadOnly ¶
AsReadOnly flags this schema as readonly
func (*Schema) AsWritable ¶
AsWritable flags this schema as writeable (not read-only)
func (*Schema) CollectionOf ¶
CollectionOf a fluent builder method for an array parameter
func (*Schema) FromGnostic ¶
func (k *Schema) FromGnostic(g *openapi_v2.Schema) (ok bool, err error)
func (*Schema) FromGnosticSchemaItem ¶
func (k *Schema) FromGnosticSchemaItem(g *openapi_v2.SchemaItem) (ok bool, err error)
func (Schema) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (Schema) MarshalNextJSON ¶
func (*Schema) SetProperty ¶
SetProperty sets a property on this schema
func (*Schema) UniqueValues ¶
UniqueValues dictates that this array can only have unique items
func (*Schema) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
func (*Schema) UnmarshalNextJSON ¶
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) WithDiscriminator ¶
WithDiscriminator sets the name of the discriminator field
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) 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) WithRequired ¶
WithRequired flags this parameter as required
type SchemaOrArray ¶
SchemaOrArray represents a value that can either be a Schema or an array of Schema. Mainly here for serialization purposes
func (*SchemaOrArray) ContainsType ¶
func (s *SchemaOrArray) ContainsType(name string) bool
ContainsType returns true when one of the schemas is of the specified type
func (SchemaOrArray) Len ¶
func (s SchemaOrArray) Len() int
Len returns the number of schemas in this property
func (SchemaOrArray) MarshalJSON ¶
func (s SchemaOrArray) MarshalJSON() ([]byte, error)
MarshalJSON converts this schema object or array into JSON structure
func (SchemaOrArray) MarshalNextJSON ¶
func (s SchemaOrArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
MarshalJSON converts this schema object or array into JSON structure
func (*SchemaOrArray) UnmarshalJSON ¶
func (s *SchemaOrArray) UnmarshalJSON(data []byte) error
UnmarshalJSON converts this schema object or array from a JSON structure
func (*SchemaOrArray) UnmarshalNextJSON ¶
func (s *SchemaOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type SchemaOrBool ¶
SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property
func (SchemaOrBool) MarshalJSON ¶
func (s SchemaOrBool) MarshalJSON() ([]byte, error)
MarshalJSON convert this object to JSON
func (SchemaOrBool) MarshalNextJSON ¶
func (s SchemaOrBool) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
MarshalJSON convert this object to JSON
func (*SchemaOrBool) UnmarshalJSON ¶
func (s *SchemaOrBool) UnmarshalJSON(data []byte) error
UnmarshalJSON converts this bool or schema object from a JSON structure
func (*SchemaOrBool) UnmarshalNextJSON ¶
func (s *SchemaOrBool) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type SchemaOrStringArray ¶
SchemaOrStringArray represents a schema or a string array
func (SchemaOrStringArray) MarshalJSON ¶
func (s SchemaOrStringArray) MarshalJSON() ([]byte, error)
MarshalJSON converts this schema object or array into JSON structure
func (SchemaOrStringArray) MarshalNextJSON ¶
func (s SchemaOrStringArray) MarshalNextJSON(opts jsonv2.MarshalOptions, enc *jsonv2.Encoder) error
MarshalJSON converts this schema object or array into JSON structure
func (*SchemaOrStringArray) UnmarshalJSON ¶
func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error
UnmarshalJSON converts this schema object or array from a JSON structure
func (*SchemaOrStringArray) UnmarshalNextJSON ¶
func (s *SchemaOrStringArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type SchemaProps ¶
type SchemaProps struct { ID string `json:"id,omitempty"` Ref Ref `json:"-"` Schema SchemaURL `json:"-"` Description string `json:"description,omitempty"` Type StringOrArray `json:"type,omitempty"` Nullable bool `json:"nullable,omitempty"` Format string `json:"format,omitempty"` Title string `json:"title,omitempty"` Default interface{} `json:"default,omitempty"` Maximum *float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum *float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength *int64 `json:"maxLength,omitempty"` MinLength *int64 `json:"minLength,omitempty"` Pattern string `json:"pattern,omitempty"` MaxItems *int64 `json:"maxItems,omitempty"` MinItems *int64 `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` MultipleOf *float64 `json:"multipleOf,omitempty"` Enum []interface{} `json:"enum,omitempty"` MaxProperties *int64 `json:"maxProperties,omitempty"` MinProperties *int64 `json:"minProperties,omitempty"` Required []string `json:"required,omitempty"` Items *SchemaOrArray `json:"items,omitempty"` AllOf []Schema `json:"allOf,omitempty"` OneOf []Schema `json:"oneOf,omitempty"` AnyOf []Schema `json:"anyOf,omitempty"` Not *Schema `json:"not,omitempty"` Properties map[string]Schema `json:"properties,omitempty"` AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"` PatternProperties map[string]Schema `json:"patternProperties,omitempty"` Dependencies Dependencies `json:"dependencies,omitempty"` AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"` Definitions Definitions `json:"definitions,omitempty"` }
SchemaProps describes a JSON schema (draft 4)
type SchemaURL ¶
type SchemaURL string
SchemaURL represents a schema url
func (SchemaURL) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (*SchemaURL) UnmarshalJSON ¶
UnmarshalJSON unmarshal this from JSON
type SecurityDefinitions ¶
type SecurityDefinitions map[string]*SecurityScheme
SecurityDefinitions a declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme.
For more information: http://goo.gl/8us55a#securityDefinitionsObject
func (SecurityDefinitions) FromGnostic ¶
func (k SecurityDefinitions) FromGnostic(g *openapi_v2.SecurityDefinitions) error
type SecurityScheme ¶
type SecurityScheme struct { VendorExtensible SecuritySchemeProps }
SecurityScheme allows the definition of a security scheme that can be used by the operations. Supported schemes are basic authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).
For more information: http://goo.gl/8us55a#securitySchemeObject
func (*SecurityScheme) FromGnostic ¶
func (k *SecurityScheme) FromGnostic(g *openapi_v2.SecurityDefinitionsItem) error
func (SecurityScheme) MarshalJSON ¶
func (s SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON marshal this to 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 marshal this from JSON
func (*SecurityScheme) UnmarshalNextJSON ¶
func (s *SecurityScheme) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type SecuritySchemeProps ¶
type SecuritySchemeProps struct { Description string `json:"description,omitempty"` Type string `json:"type"` Name string `json:"name,omitempty"` // api key In string `json:"in,omitempty"` // api key Flow string `json:"flow,omitempty"` // oauth2 AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2 TokenURL string `json:"tokenUrl,omitempty"` // oauth2 Scopes map[string]string `json:"scopes,omitempty"` // oauth2 }
SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section
func (*SecuritySchemeProps) FromGnostic ¶
func (k *SecuritySchemeProps) FromGnostic(g GnosticCommonSecurityDefinition) error
type SimpleSchema ¶
type SimpleSchema struct { Type string `json:"type,omitempty"` Nullable bool `json:"nullable,omitempty"` Format string `json:"format,omitempty"` Items *Items `json:"items,omitempty"` CollectionFormat string `json:"collectionFormat,omitempty"` Default interface{} `json:"default,omitempty"` Example interface{} `json:"example,omitempty"` }
SimpleSchema describe swagger simple schemas for parameters and headers
func (*SimpleSchema) FromGnostic ¶
func (k *SimpleSchema) FromGnostic(g GnosticSimpleSchema) error
type StringOrArray ¶
type StringOrArray []string
StringOrArray represents a value that can either be a string or an array of strings. Mainly here for serialization purposes
func (StringOrArray) Contains ¶
func (s StringOrArray) Contains(value string) bool
Contains returns true when the value is contained in the slice
func (StringOrArray) MarshalJSON ¶
func (s StringOrArray) MarshalJSON() ([]byte, error)
MarshalJSON converts this string or array to a JSON array or JSON string
func (*StringOrArray) UnmarshalJSON ¶
func (s *StringOrArray) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string
func (*StringOrArray) UnmarshalNextJSON ¶
func (s *StringOrArray) UnmarshalNextJSON(opts jsonv2.UnmarshalOptions, dec *jsonv2.Decoder) error
type Swagger ¶
type Swagger struct { VendorExtensible SwaggerProps }
Swagger this is the root document object for the API specification. It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
For more information: http://goo.gl/8us55a#swagger-object-
func (*Swagger) FromGnostic ¶
func (k *Swagger) FromGnostic(g *openapi_v2.Document) (ok bool, err error)
Converts a gnostic v2 Document to a kube-openapi Swagger Document
Caveats:
- gnostic v2 documents treats zero as unspecified for numerical fields of CommonValidations fields such as Maximum, Minimum, MaximumItems, etc. There will always be data loss if one of the values of these fields is set to zero.
Returns:
- `ok`: `false` if a value was present in the gnostic document which cannot be roundtripped into kube-openapi types. In these instances, `ok` is set to `false` and the value is skipped.
- `err`: an unexpected error occurred in the conversion from the gnostic type to kube-openapi type.
func (Swagger) MarshalJSON ¶
MarshalJSON marshals this swagger structure to json
func (Swagger) MarshalNextJSON ¶
MarshalJSON marshals this swagger structure to json
func (*Swagger) UnmarshalJSON ¶
UnmarshalJSON unmarshals a swagger spec from json
func (*Swagger) UnmarshalNextJSON ¶
type SwaggerProps ¶
type SwaggerProps struct { ID string `json:"id,omitempty"` Consumes []string `json:"consumes,omitempty"` Produces []string `json:"produces,omitempty"` Schemes []string `json:"schemes,omitempty"` Swagger string `json:"swagger,omitempty"` Info *Info `json:"info,omitempty"` Host string `json:"host,omitempty"` BasePath string `json:"basePath,omitempty"` Paths *Paths `json:"paths"` Definitions Definitions `json:"definitions,omitempty"` Parameters map[string]Parameter `json:"parameters,omitempty"` Responses map[string]Response `json:"responses,omitempty"` SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"` Security []map[string][]string `json:"security,omitempty"` Tags []Tag `json:"tags,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` }
SwaggerProps captures the top-level properties of an Api specification
NOTE: validation rules - the scheme, when present must be from [http, https, ws, wss] - BasePath must start with a leading "/" - Paths is required
func (*SwaggerProps) FromGnostic ¶
func (k *SwaggerProps) FromGnostic(g *openapi_v2.Document) (ok bool, err error)
type SwaggerSchemaProps ¶
type SwaggerSchemaProps struct { Discriminator string `json:"discriminator,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` Example interface{} `json:"example,omitempty"` }
SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4)
type Tag ¶
type Tag struct { VendorExtensible TagProps }
Tag allows adding meta data to a single tag that is used by the [Operation Object](http://goo.gl/8us55a#operationObject). It is not mandatory to have a Tag Object per tag used there.
For more information: http://goo.gl/8us55a#tagObject
func (*Tag) FromGnostic ¶
func (k *Tag) FromGnostic(g *openapi_v2.Tag) (ok bool, err error)
func (Tag) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (Tag) MarshalNextJSON ¶
func (*Tag) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
func (*Tag) UnmarshalNextJSON ¶
type TagProps ¶
type TagProps struct { Description string `json:"description,omitempty"` Name string `json:"name,omitempty"` ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` }
TagProps describe a tag entry in the top level tags section of a swagger spec
func (*TagProps) FromGnostic ¶
func (k *TagProps) FromGnostic(g *openapi_v2.Tag) (ok bool, err error)
type VendorExtensible ¶
type VendorExtensible struct {
Extensions Extensions
}
VendorExtensible composition block.
func (*VendorExtensible) AddExtension ¶
func (v *VendorExtensible) AddExtension(key string, value interface{})
AddExtension adds an extension to this extensible object
func (*VendorExtensible) FromGnostic ¶
func (k *VendorExtensible) FromGnostic(g []*openapi_v2.NamedAny) error
func (VendorExtensible) MarshalJSON ¶
func (v VendorExtensible) MarshalJSON() ([]byte, error)
MarshalJSON marshals the extensions to json
func (*VendorExtensible) UnmarshalJSON ¶
func (v *VendorExtensible) UnmarshalJSON(data []byte) error
UnmarshalJSON for this extensible object