Documentation ¶
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type ContactInfo
- type Definitions
- type Dependencies
- type DocLoader
- type Document
- func (s *Document) AllDefinitions() (result []SchemaRef)
- func (s *Document) AllPaths() map[string]PathItem
- func (d *Document) BasePath() string
- func (s *Document) ConsumesFor(operation *Operation) []string
- func (d *Document) Expanded() (*Document, error)
- func (d *Document) Host() string
- func (s *Document) OperationFor(method, path string) (*Operation, bool)
- func (s *Document) OperationForName(operationID string) (string, string, *Operation, bool)
- func (s *Document) OperationIDs() []string
- func (s *Document) Operations() map[string]map[string]*Operation
- func (s *Document) ParametersFor(operationID string) []Parameter
- func (s *Document) ParamsFor(method, path string) map[string]Parameter
- func (d *Document) Pristine() *Document
- func (s *Document) ProducesFor(operation *Operation) []string
- func (d *Document) Raw() json.RawMessage
- func (d *Document) Reload() *Document
- func (s *Document) RequiredConsumes() []string
- func (s *Document) RequiredProduces() []string
- func (s *Document) RequiredSecuritySchemes() []string
- func (d *Document) Schema() *Schema
- func (s *Document) SchemasWithAllOf() (result []SchemaRef)
- func (s *Document) SecurityDefinitionsFor(operation *Operation) map[string]SecurityScheme
- func (s *Document) SecurityRequirementsFor(operation *Operation) []SecurityRequirement
- func (d *Document) Spec() *Swagger
- func (d *Document) Version() string
- type Extensions
- type ExternalDocumentation
- type Header
- type Info
- type Items
- func (i *Items) AllowDuplicates() *Items
- func (i *Items) CollectionOf(items *Items, format string) *Items
- func (s *Items) ItemsTypeName() string
- func (i Items) MarshalJSON() ([]byte, error)
- func (s *Items) TypeName() string
- func (i *Items) Typed(tpe, format string) *Items
- func (i *Items) UniqueValues() *Items
- func (i *Items) UnmarshalJSON(data []byte) error
- func (i *Items) WithDefault(defaultValue interface{}) *Items
- func (i *Items) WithEnum(values ...interface{}) *Items
- func (i *Items) WithMaxItems(size int64) *Items
- func (i *Items) WithMaxLength(max int64) *Items
- func (i *Items) WithMaximum(max float64, exclusive bool) *Items
- func (i *Items) WithMinItems(size int64) *Items
- func (i *Items) WithMinLength(min int64) *Items
- func (i *Items) WithMinimum(min float64, exclusive bool) *Items
- func (i *Items) WithMultipleOf(number float64) *Items
- func (i *Items) WithPattern(pattern string) *Items
- type License
- type Operation
- type Parameter
- func BodyParam(name string, schema *Schema) *Parameter
- func FileParam(name string) *Parameter
- func FormDataParam(name string) *Parameter
- func HeaderParam(name string) *Parameter
- func PathParam(name string) *Parameter
- func QueryParam(name string) *Parameter
- func SimpleArrayParam(name, tpe, fmt string) *Parameter
- func (v *Parameter) AddExtension(key string, value interface{})
- func (p *Parameter) AllowDuplicates() *Parameter
- func (p *Parameter) AsOptional() *Parameter
- func (p *Parameter) AsRequired() *Parameter
- func (p *Parameter) CollectionOf(items *Items, format string) *Parameter
- func (s *Parameter) ItemsTypeName() string
- func (p Parameter) JSONLookup(token string) (interface{}, error)
- func (p Parameter) MarshalJSON() ([]byte, error)
- func (s *Parameter) TypeName() string
- func (p *Parameter) Typed(tpe, format string) *Parameter
- func (p *Parameter) UniqueValues() *Parameter
- func (p *Parameter) UnmarshalJSON(data []byte) error
- func (p *Parameter) WithDefault(defaultValue interface{}) *Parameter
- func (p *Parameter) WithEnum(values ...interface{}) *Parameter
- func (p *Parameter) WithMaxItems(size int64) *Parameter
- func (p *Parameter) WithMaxLength(max int64) *Parameter
- func (p *Parameter) WithMaximum(max float64, exclusive bool) *Parameter
- func (p *Parameter) WithMinItems(size int64) *Parameter
- func (p *Parameter) WithMinLength(min int64) *Parameter
- func (p *Parameter) WithMinimum(min float64, exclusive bool) *Parameter
- func (p *Parameter) WithMultipleOf(number float64) *Parameter
- func (p *Parameter) WithPattern(pattern string) *Parameter
- type PathItem
- type Paths
- type Ref
- type ResolutionCache
- type Response
- type Responses
- type Schema
- func ArrayProperty(items *Schema) *Schema
- func BoolProperty() *Schema
- func BooleanProperty() *Schema
- func CharProperty() *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 JSONSchemaDraft04() (*Schema, error)
- func MapProperty(property *Schema) *Schema
- func MustLoadJSONSchemaDraft04() *Schema
- func MustLoadSwagger20Schema() *Schema
- func RefProperty(name string) *Schema
- func ResolveRef(root interface{}, ref *Ref) (*Schema, error)
- func StrFmtProperty(format string) *Schema
- func StringProperty() *Schema
- func Swagger20Schema() (*Schema, error)
- func (v *Schema) AddExtension(key string, value interface{})
- func (s *Schema) AddType(tpe, format string) *Schema
- func (s *Schema) AllowDuplicates() *Schema
- func (s *Schema) CollectionOf(items Schema) *Schema
- func (s Schema) JSONLookup(token string) (interface{}, error)
- func (s Schema) MarshalJSON() ([]byte, 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) WithAllOf(schemas ...Schema) *Schema
- func (s *Schema) WithDefault(defaultValue interface{}) *Schema
- func (s *Schema) WithEnum(values ...interface{}) *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
- type SchemaOrArray
- type SchemaOrBool
- type SchemaOrStringArray
- type SchemaRef
- type SchemaURL
- type SecurityDefinitions
- type SecurityRequirement
- type SecurityScheme
- func APIKeyAuth(fieldName, valueSource string) *SecurityScheme
- func BasicAuth() *SecurityScheme
- func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme
- func OAuth2Application(tokenURL string) *SecurityScheme
- func OAuth2Implicit(authorizationURL string) *SecurityScheme
- func OAuth2Password(tokenURL string) *SecurityScheme
- func (v *SecurityScheme) AddExtension(key string, value interface{})
- func (s *SecurityScheme) AddScope(scope, description string)
- func (s SecurityScheme) JSONLookup(token string) (interface{}, error)
- func (s SecurityScheme) MarshalJSON() ([]byte, error)
- func (s *SecurityScheme) UnmarshalJSON(data []byte) error
- type StringOrArray
- type Swagger
- type Tag
- type XMLObject
Constants ¶
const ( // SwaggerSchemaURL the url for the swagger 2.0 schema to validate specs SwaggerSchemaURL = "http://swagger.io/v2/schema.json#" // JSONSchemaURL the url for the json schema schema JSONSchemaURL = "http://json-schema.org/draft-04/schema#" )
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func ExpandSchema ¶
func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error
ExpandSchema expands the refs in the schema object
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
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
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 DocLoader ¶
type DocLoader func(string) (json.RawMessage, error)
DocLoader represents a doc loader type
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents a swagger spec document
func New ¶
func New(data json.RawMessage, version string) (*Document, error)
New creates a new shema document
func (*Document) AllDefinitions ¶
func (s *Document) AllDefinitions() (result []SchemaRef)
func (*Document) ConsumesFor ¶
ConsumesFor gets the mediatypes for the operation
func (*Document) Expanded ¶
Expanded expands the ref fields in the spec document and returns a new spec document
func (*Document) OperationFor ¶
func (*Document) OperationForName ¶
func (*Document) OperationIDs ¶
func (s *Document) OperationIDs() []string
func (*Document) Operations ¶
func (*Document) ParametersFor ¶
func (*Document) Pristine ¶ added in v0.2.0
Prisitine creates a new pristine document instance based on the input data
func (*Document) ProducesFor ¶
ProducesFor gets the mediatypes for the operation
func (*Document) Raw ¶
func (d *Document) Raw() json.RawMessage
Raw returns the raw swagger spec as json bytes
func (*Document) RequiredConsumes ¶
func (s *Document) RequiredConsumes() []string
func (*Document) RequiredProduces ¶
func (s *Document) RequiredProduces() []string
func (*Document) RequiredSecuritySchemes ¶
func (s *Document) RequiredSecuritySchemes() []string
func (*Document) SchemasWithAllOf ¶
func (s *Document) SchemasWithAllOf() (result []SchemaRef)
func (*Document) SecurityDefinitionsFor ¶
func (s *Document) SecurityDefinitionsFor(operation *Operation) map[string]SecurityScheme
SecurityDefinitionsFor gets the matching security definitions for a set of requirements
func (*Document) SecurityRequirementsFor ¶
func (s *Document) SecurityRequirementsFor(operation *Operation) []SecurityRequirement
SecurityRequirementsFor gets the security requirements for the operation
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
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
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header describes a header for a response of the API
For more information: http://goo.gl/8us55a#headerObject
func (*Header) CollectionOf ¶
CollectionOf a fluent builder method for an array item
func (*Header) ItemsTypeName ¶
func (s *Header) ItemsTypeName() string
func (Header) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (*Header) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
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) AddExtension ¶
func (v *Info) AddExtension(key string, value interface{})
func (Info) JSONLookup ¶
JSONLookup look up a value by the json property name
func (Info) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (*Info) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
type Items ¶
type Items struct {
// contains filtered or unexported fields
}
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) AllowDuplicates ¶
AllowDuplicates this array can have duplicates
func (*Items) CollectionOf ¶
CollectionOf a fluent builder method for an array item
func (*Items) ItemsTypeName ¶
func (s *Items) ItemsTypeName() string
func (Items) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Items) UniqueValues ¶
UniqueValues dictates that this array can only have unique items
func (*Items) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Items) WithDefault ¶
WithDefault sets the default value on this item
func (*Items) WithMaxItems ¶
WithMaxItems sets the max items
func (*Items) WithMaxLength ¶
WithMaxLength sets a max length value
func (*Items) WithMaximum ¶
WithMaximum sets a maximum number value
func (*Items) WithMinItems ¶
WithMinItems sets the min items
func (*Items) WithMinLength ¶
WithMinLength sets a min length value
func (*Items) WithMinimum ¶
WithMinimum sets a minimum number value
func (*Items) WithMultipleOf ¶
WithMultipleOf sets a multiple of value
func (*Items) WithPattern ¶
WithPattern sets a pattern value
type License ¶
License information for the exposed API.
For more information: http://goo.gl/8us55a#licenseObject
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
Operation describes a single API operation on a path.
For more information: http://goo.gl/8us55a#operationObject
func (*Operation) AddExtension ¶
func (v *Operation) AddExtension(key string, value interface{})
func (Operation) JSONLookup ¶
JSONLookup look up a value by the json property name
func (Operation) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Operation) SuccessResponse ¶
SuccessResponse gets a success response model
func (*Operation) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type Parameter ¶
type Parameter struct {
// contains filtered or unexported fields
}
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 FormDataParam ¶
FormDataParam creates a body parameter
func HeaderParam ¶
HeaderParam creates a header parameter, this is always required by default
func SimpleArrayParam ¶
SimpleArrayParam creates a param for a simple array (string, int, date etc)
func (*Parameter) AddExtension ¶
func (v *Parameter) AddExtension(key string, value interface{})
func (*Parameter) AllowDuplicates ¶
AllowDuplicates this array can have duplicates
func (*Parameter) AsOptional ¶
AsOptional flags this parameter as optional
func (*Parameter) AsRequired ¶
AsRequired flags this parameter as required
func (*Parameter) CollectionOf ¶
CollectionOf a fluent builder method for an array parameter
func (*Parameter) ItemsTypeName ¶
func (s *Parameter) ItemsTypeName() string
func (Parameter) JSONLookup ¶
JSONLookup look up a value by the json property name
func (Parameter) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Parameter) UniqueValues ¶
UniqueValues dictates that this array can only have unique items
func (*Parameter) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
func (*Parameter) WithDefault ¶
WithDefault sets the default value on this parameter
func (*Parameter) WithMaxItems ¶
WithMaxItems sets the max items
func (*Parameter) WithMaxLength ¶
WithMaxLength sets a max length value
func (*Parameter) WithMaximum ¶
WithMaximum sets a maximum number value
func (*Parameter) WithMinItems ¶
WithMinItems sets the min items
func (*Parameter) WithMinLength ¶
WithMinLength sets a min length value
func (*Parameter) WithMinimum ¶
WithMinimum sets a minimum number value
func (*Parameter) WithMultipleOf ¶
WithMultipleOf sets a multiple of value
func (*Parameter) WithPattern ¶
WithPattern sets a pattern value
type PathItem ¶
type PathItem struct {
// contains filtered or unexported fields
}
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) AddExtension ¶
func (v *PathItem) AddExtension(key string, value interface{})
func (PathItem) JSONLookup ¶
JSONLookup look up a value by the json property name
func (PathItem) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*PathItem) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type Paths ¶
type Paths struct { Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/" // contains filtered or unexported fields }
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) AddExtension ¶
func (v *Paths) AddExtension(key string, value interface{})
func (Paths) JSONLookup ¶
JSONLookup look up a value by the json property name
func (Paths) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Paths) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type Ref ¶
type Ref struct {
jsonreference.Ref
}
Ref represents a json reference that is potentially resolved
func NewRef ¶
NewRef creates a new instance of a ref object returns an error when the reference uri is an invalid uri
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) MarshalJSON ¶
MarshalJSON marshals this ref into a JSON object
func (*Ref) UnmarshalJSON ¶
UnmarshalJSON unmarshals this ref from a JSON object
type ResolutionCache ¶
ResolutionCache a cache for resolving urls
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response describes a single response from an API Operation.
For more information: http://goo.gl/8us55a#responseObject
func (Response) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Response) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type Responses ¶
type Responses struct {
// contains filtered or unexported fields
}
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) AddExtension ¶
func (v *Responses) AddExtension(key string, value interface{})
func (Responses) JSONLookup ¶
JSONLookup implements an interface to customize json pointer lookup
func (Responses) MarshalJSON ¶
MarshalJSON converts this items object to JSON
func (*Responses) UnmarshalJSON ¶
UnmarshalJSON hydrates this items instance with the data from JSON
type Schema ¶
type Schema struct { ExtraProps map[string]interface{} `json:"-"` // contains filtered or unexported fields }
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 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 JSONSchemaDraft04 ¶
JSONSchemaDraft04 loads the json schema document for json shema draft04
func MustLoadJSONSchemaDraft04 ¶
func MustLoadJSONSchemaDraft04() *Schema
MustLoadJSONSchemaDraft04 panics when Swagger20Schema returns an error
func MustLoadSwagger20Schema ¶
func MustLoadSwagger20Schema() *Schema
MustLoadSwagger20Schema panics when Swagger20Schema returns an error
func ResolveRef ¶
ResolveRef resolves a reference against a context root
func StrFmtProperty ¶
StrFmtProperty creates a property for the named string format
func Swagger20Schema ¶
Swagger20Schema loads the swagger 2.0 schema from the embedded assets
func (*Schema) AddExtension ¶
func (v *Schema) AddExtension(key string, value interface{})
func (*Schema) AllowDuplicates ¶
AllowDuplicates this array can have duplicates
func (*Schema) CollectionOf ¶
CollectionOf a fluent builder method for an array parameter
func (Schema) JSONLookup ¶
JSONLookup implements an interface to customize json pointer lookup
func (Schema) MarshalJSON ¶
MarshalJSON marshal this to JSON
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) WithDefault ¶
WithDefault sets the default value on this parameter
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) JSONLookup ¶
func (s SchemaOrArray) JSONLookup(token string) (interface{}, error)
JSONLookup implements an interface to customize json pointer lookup
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) UnmarshalJSON ¶
func (s *SchemaOrArray) UnmarshalJSON(data []byte) error
UnmarshalJSON converts this schema object or array from a JSON structure
type SchemaOrBool ¶
SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property
func (SchemaOrBool) JSONLookup ¶
func (s SchemaOrBool) JSONLookup(token string) (interface{}, error)
JSONLookup implements an interface to customize json pointer lookup
func (SchemaOrBool) MarshalJSON ¶
func (s SchemaOrBool) MarshalJSON() ([]byte, 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
type SchemaOrStringArray ¶
SchemaOrStringArray represents a schema or a string array
func (SchemaOrStringArray) JSONLookup ¶
func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error)
JSONLookup implements an interface to customize json pointer lookup
func (SchemaOrStringArray) MarshalJSON ¶
func (s SchemaOrStringArray) MarshalJSON() ([]byte, 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
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
type SecurityRequirement ¶
SecurityRequirement is a representation of a security requirement for an operation
type SecurityScheme ¶
type SecurityScheme struct {
// contains filtered or unexported fields
}
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 APIKeyAuth ¶
func APIKeyAuth(fieldName, valueSource string) *SecurityScheme
APIKeyAuth creates an api key auth security scheme
func OAuth2AccessToken ¶
func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme
OAuth2AccessToken creates an access token flow oauth2 security scheme
func OAuth2Application ¶
func OAuth2Application(tokenURL string) *SecurityScheme
OAuth2Application creates an application flow oauth2 security scheme
func OAuth2Implicit ¶
func OAuth2Implicit(authorizationURL string) *SecurityScheme
OAuth2Implicit creates an implicit flow oauth2 security scheme
func OAuth2Password ¶
func OAuth2Password(tokenURL string) *SecurityScheme
OAuth2Password creates a password flow oauth2 security scheme
func (*SecurityScheme) AddExtension ¶
func (v *SecurityScheme) AddExtension(key string, value interface{})
func (*SecurityScheme) AddScope ¶
func (s *SecurityScheme) AddScope(scope, description string)
AddScope adds a scope to this security scheme
func (SecurityScheme) JSONLookup ¶
func (s SecurityScheme) JSONLookup(token string) (interface{}, error)
JSONLookup implements an interface to customize json pointer lookup
func (SecurityScheme) MarshalJSON ¶
func (s SecurityScheme) MarshalJSON() ([]byte, error)
MarshalJSON marshal this to JSON
func (*SecurityScheme) UnmarshalJSON ¶
func (s *SecurityScheme) UnmarshalJSON(data []byte) error
UnmarshalJSON marshal this from JSON
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
type Swagger ¶
type Swagger struct {
// contains filtered or unexported fields
}
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) MarshalJSON ¶
MarshalJSON marshals this swagger structure to json
func (*Swagger) UnmarshalJSON ¶
UnmarshalJSON unmarshals a swagger spec from json
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
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 NewTag ¶
func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag
NewTag creates a new tag
func (*Tag) AddExtension ¶
func (v *Tag) AddExtension(key string, value interface{})
func (Tag) JSONLookup ¶
JSONLookup implements an interface to customize json pointer lookup
func (Tag) MarshalJSON ¶
MarshalJSON marshal this to JSON
func (*Tag) UnmarshalJSON ¶
UnmarshalJSON marshal this from JSON
type XMLObject ¶
type XMLObject struct { Name string `json:"name,omitempty"` Namespace string `json:"namespace,omitempty"` Prefix string `json:"prefix,omitempty"` Attribute bool `json:"attribute,omitempty"` Wrapped bool `json:"wrapped,omitempty"` }
XMLObject a metadata object that allows for more fine-tuned XML model definitions.
For more information: http://goo.gl/8us55a#xmlObject