Versions in this module Expand all Collapse all v0 v0.19.10 Aug 12, 2020 Changes in this version + const JSONSchemaURL + const SwaggerSchemaURL + var Debug = os.Getenv("SWAGGER_DEBUG") != "" + var PathLoader func(string) (json.RawMessage, error) + func Asset(name string) ([]byte, error) + func AssetDigest(name string) ([sha256.Size]byte, error) + func AssetDir(name string) ([]string, error) + func AssetInfo(name string) (os.FileInfo, error) + func AssetNames() []string + func AssetString(name string) (string, error) + func Digests() (map[string][sha256.Size]byte, error) + func ExpandParameter(parameter *Parameter, basePath string) error + func ExpandParameterWithRoot(parameter *Parameter, root interface{}, cache ResolutionCache) error + func ExpandResponse(response *Response, basePath string) error + func ExpandResponseWithRoot(response *Response, root interface{}, cache ResolutionCache) error + func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error + func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *ExpandOptions) error + func ExpandSpec(spec *Swagger, options *ExpandOptions) error + func MustAsset(name string) []byte + func MustAssetString(name string) string + func RestoreAsset(dir, name string) error + func RestoreAssets(dir, name string) error + type CommonValidations struct + Enum []interface{} + ExclusiveMaximum bool + ExclusiveMinimum bool + MaxItems *int64 + MaxLength *int64 + Maximum *float64 + MinItems *int64 + MinLength *int64 + Minimum *float64 + MultipleOf *float64 + Pattern string + UniqueItems bool + type ContactInfo struct + func (c *ContactInfo) UnmarshalJSON(data []byte) error + func (c ContactInfo) MarshalJSON() ([]byte, error) + type ContactInfoProps struct + Email string + Name string + URL string + type Definitions map[string]Schema + type Dependencies map[string]SchemaOrStringArray + type ExpandOptions struct + AbsoluteCircularRef bool + ContinueOnError bool + RelativeBase string + SkipSchemas bool + type Extensions map[string]interface + func (e Extensions) Add(key string, value interface{}) + func (e Extensions) GetBool(key string) (bool, bool) + func (e Extensions) GetString(key string) (string, bool) + func (e Extensions) GetStringSlice(key string) ([]string, bool) + type ExternalDocumentation struct + Description string + URL string + type Header struct + func ResponseHeader() *Header + func (h *Header) AllowDuplicates() *Header + func (h *Header) CollectionOf(items *Items, format string) *Header + func (h *Header) Typed(tpe, format string) *Header + func (h *Header) UniqueValues() *Header + func (h *Header) UnmarshalJSON(data []byte) error + func (h *Header) WithDefault(defaultValue interface{}) *Header + func (h *Header) WithDescription(description string) *Header + func (h *Header) WithEnum(values ...interface{}) *Header + func (h *Header) WithMaxItems(size int64) *Header + func (h *Header) WithMaxLength(max int64) *Header + func (h *Header) WithMaximum(max float64, exclusive bool) *Header + func (h *Header) WithMinItems(size int64) *Header + func (h *Header) WithMinLength(min int64) *Header + func (h *Header) WithMinimum(min float64, exclusive bool) *Header + func (h *Header) WithMultipleOf(number float64) *Header + func (h *Header) WithPattern(pattern string) *Header + func (h Header) JSONLookup(token string) (interface{}, error) + func (h Header) MarshalJSON() ([]byte, error) + type HeaderProps struct + Description string + type Info struct + func (i *Info) UnmarshalJSON(data []byte) error + func (i Info) JSONLookup(token string) (interface{}, error) + func (i Info) MarshalJSON() ([]byte, error) + type InfoProps struct + Contact *ContactInfo + Description string + License *License + TermsOfService string + Title string + Version string + type Items struct + func NewItems() *Items + func ResolveItems(root interface{}, ref Ref, opts *ExpandOptions) (*Items, error) + func (i *Items) AllowDuplicates() *Items + func (i *Items) AsNullable() *Items + func (i *Items) CollectionOf(items *Items, format string) *Items + 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 + func (i Items) JSONLookup(token string) (interface{}, error) + func (i Items) MarshalJSON() ([]byte, error) + type License struct + func (l *License) UnmarshalJSON(data []byte) error + func (l License) MarshalJSON() ([]byte, error) + type LicenseProps struct + Name string + URL string + type Operation struct + func NewOperation(id string) *Operation + func (o *Operation) AddParam(param *Parameter) *Operation + func (o *Operation) Deprecate() *Operation + func (o *Operation) GobDecode(b []byte) error + func (o *Operation) RemoveParam(name, in string) *Operation + func (o *Operation) RespondsWith(code int, response *Response) *Operation + func (o *Operation) SecuredWith(name string, scopes ...string) *Operation + func (o *Operation) SuccessResponse() (*Response, int, bool) + func (o *Operation) Undeprecate() *Operation + func (o *Operation) UnmarshalJSON(data []byte) error + func (o *Operation) WithConsumes(mediaTypes ...string) *Operation + func (o *Operation) WithDefaultResponse(response *Response) *Operation + func (o *Operation) WithDescription(description string) *Operation + func (o *Operation) WithExternalDocs(description, url string) *Operation + func (o *Operation) WithID(id string) *Operation + func (o *Operation) WithProduces(mediaTypes ...string) *Operation + func (o *Operation) WithSummary(summary string) *Operation + func (o *Operation) WithTags(tags ...string) *Operation + func (o Operation) GobEncode() ([]byte, error) + func (o Operation) JSONLookup(token string) (interface{}, error) + func (o Operation) MarshalJSON() ([]byte, error) + type OperationProps struct + Consumes []string + Deprecated bool + Description string + ExternalDocs *ExternalDocumentation + ID string + Parameters []Parameter + Produces []string + Responses *Responses + Schemes []string + Security []map[string][]string + Summary string + Tags []string + func (op *OperationProps) GobDecode(b []byte) error + func (op OperationProps) GobEncode() ([]byte, error) + func (op OperationProps) MarshalJSON() ([]byte, error) + type OrderSchemaItem struct + Name string + type OrderSchemaItems []OrderSchemaItem + func (items OrderSchemaItems) Len() int + func (items OrderSchemaItems) Less(i, j int) (ret bool) + func (items OrderSchemaItems) MarshalJSON() ([]byte, error) + func (items OrderSchemaItems) Swap(i, j int) + type ParamProps struct + AllowEmptyValue bool + Description string + In string + Name string + Required bool + Schema *Schema + type Parameter struct + func BodyParam(name string, schema *Schema) *Parameter + func FileParam(name string) *Parameter + func FormDataParam(name string) *Parameter + func HeaderParam(name string) *Parameter + func ParamRef(uri string) *Parameter + func PathParam(name string) *Parameter + func QueryParam(name string) *Parameter + func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) + func ResolveParameterWithBase(root interface{}, ref Ref, opts *ExpandOptions) (*Parameter, error) + func SimpleArrayParam(name, tpe, fmt string) *Parameter + func (p *Parameter) AllowDuplicates() *Parameter + func (p *Parameter) AllowsEmptyValues() *Parameter + func (p *Parameter) AsOptional() *Parameter + func (p *Parameter) AsRequired() *Parameter + func (p *Parameter) CollectionOf(items *Items, format string) *Parameter + func (p *Parameter) Named(name string) *Parameter + func (p *Parameter) NoEmptyValues() *Parameter + 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) WithDescription(description string) *Parameter + func (p *Parameter) WithEnum(values ...interface{}) *Parameter + func (p *Parameter) WithLocation(in string) *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 + func (p Parameter) JSONLookup(token string) (interface{}, error) + func (p Parameter) MarshalJSON() ([]byte, error) + type PathItem struct + func ResolvePathItem(root interface{}, ref Ref, opts *ExpandOptions) (*PathItem, error) + func (p *PathItem) UnmarshalJSON(data []byte) error + func (p PathItem) JSONLookup(token string) (interface{}, error) + func (p PathItem) MarshalJSON() ([]byte, error) + type PathItemProps struct + Delete *Operation + Get *Operation + Head *Operation + Options *Operation + Parameters []Parameter + Patch *Operation + Post *Operation + Put *Operation + type Paths struct + Paths map[string]PathItem + func (p *Paths) UnmarshalJSON(data []byte) error + func (p Paths) JSONLookup(token string) (interface{}, error) + func (p Paths) MarshalJSON() ([]byte, error) + type Ref struct + func MustCreateRef(refURI string) Ref + func NewRef(refURI string) (Ref, error) + func (r *Ref) GobDecode(b []byte) error + func (r *Ref) Inherits(child Ref) (*Ref, error) + func (r *Ref) IsValidURI(basepaths ...string) bool + func (r *Ref) RemoteURI() string + func (r *Ref) UnmarshalJSON(d []byte) error + func (r Ref) GobEncode() ([]byte, error) + func (r Ref) MarshalJSON() ([]byte, error) + type Refable struct + Ref Ref + func (r *Refable) UnmarshalJSON(d []byte) error + func (r Refable) MarshalJSON() ([]byte, error) + type ResolutionCache interface + Get func(string) (interface{}, bool) + Set func(string, interface{}) + type Response struct + func NewResponse() *Response + func ResolveResponse(root interface{}, ref Ref) (*Response, error) + func ResolveResponseWithBase(root interface{}, ref Ref, opts *ExpandOptions) (*Response, error) + func ResponseRef(url string) *Response + func (r *Response) AddExample(mediaType string, example interface{}) *Response + func (r *Response) AddHeader(name string, header *Header) *Response + func (r *Response) RemoveHeader(name string) *Response + func (r *Response) UnmarshalJSON(data []byte) error + func (r *Response) WithDescription(description string) *Response + func (r *Response) WithSchema(schema *Schema) *Response + func (r Response) JSONLookup(token string) (interface{}, error) + func (r Response) MarshalJSON() ([]byte, error) + type ResponseProps struct + Description string + Examples map[string]interface{} + Headers map[string]Header + Schema *Schema + type Responses struct + func (r *Responses) UnmarshalJSON(data []byte) error + func (r Responses) JSONLookup(token string) (interface{}, error) + func (r Responses) MarshalJSON() ([]byte, error) + type ResponsesProps struct + Default *Response + StatusCodeResponses map[int]Response + func (r *ResponsesProps) UnmarshalJSON(data []byte) error + func (r ResponsesProps) MarshalJSON() ([]byte, error) + type Schema struct + ExtraProps map[string]interface{} + 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 JSONSchemaDraft04() (*Schema, error) + func MapProperty(property *Schema) *Schema + func MustLoadJSONSchemaDraft04() *Schema + func MustLoadSwagger20Schema() *Schema + func RefProperty(name string) *Schema + func RefSchema(name string) *Schema + func ResolveRef(root interface{}, ref *Ref) (*Schema, error) + func ResolveRefWithBase(root interface{}, ref *Ref, opts *ExpandOptions) (*Schema, error) + func StrFmtProperty(format string) *Schema + func StringProperty() *Schema + func Swagger20Schema() (*Schema, error) + 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) AsUnwrappedXML() *Schema + func (s *Schema) AsWrappedXML() *Schema + func (s *Schema) AsWritable() *Schema + func (s *Schema) AsXMLAttribute() *Schema + func (s *Schema) AsXMLElement() *Schema + func (s *Schema) CollectionOf(items Schema) *Schema + 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) 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 + func (s *Schema) WithXMLName(name string) *Schema + func (s *Schema) WithXMLNamespace(namespace string) *Schema + func (s *Schema) WithXMLPrefix(prefix string) *Schema + func (s Schema) JSONLookup(token string) (interface{}, error) + func (s Schema) MarshalJSON() ([]byte, error) + type SchemaOrArray struct + Schema *Schema + Schemas []Schema + func (s *SchemaOrArray) ContainsType(name string) bool + func (s *SchemaOrArray) UnmarshalJSON(data []byte) error + func (s SchemaOrArray) JSONLookup(token string) (interface{}, error) + func (s SchemaOrArray) Len() int + func (s SchemaOrArray) MarshalJSON() ([]byte, error) + type SchemaOrBool struct + Allows bool + Schema *Schema + func (s *SchemaOrBool) UnmarshalJSON(data []byte) error + func (s SchemaOrBool) JSONLookup(token string) (interface{}, error) + func (s SchemaOrBool) MarshalJSON() ([]byte, error) + type SchemaOrStringArray struct + Property []string + Schema *Schema + func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error + func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error) + func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) + type SchemaProperties map[string]Schema + func (properties SchemaProperties) MarshalJSON() ([]byte, error) + type SchemaProps struct + AdditionalItems *SchemaOrBool + AdditionalProperties *SchemaOrBool + AllOf []Schema + AnyOf []Schema + Default interface{} + Definitions Definitions + Dependencies Dependencies + Description string + Enum []interface{} + ExclusiveMaximum bool + ExclusiveMinimum bool + Format string + ID string + Items *SchemaOrArray + MaxItems *int64 + MaxLength *int64 + MaxProperties *int64 + Maximum *float64 + MinItems *int64 + MinLength *int64 + MinProperties *int64 + Minimum *float64 + MultipleOf *float64 + Not *Schema + Nullable bool + OneOf []Schema + Pattern string + PatternProperties SchemaProperties + Properties SchemaProperties + Ref Ref + Required []string + Schema SchemaURL + Title string + Type StringOrArray + UniqueItems bool + type SchemaURL string + func (r *SchemaURL) UnmarshalJSON(data []byte) error + func (r SchemaURL) MarshalJSON() ([]byte, error) + type SecurityDefinitions map[string]*SecurityScheme + type SecurityScheme struct + 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 (s *SecurityScheme) UnmarshalJSON(data []byte) error + func (s SecurityScheme) JSONLookup(token string) (interface{}, error) + func (s SecurityScheme) MarshalJSON() ([]byte, error) + type SecuritySchemeProps struct + AuthorizationURL string + Description string + Flow string + In string + Name string + Scopes map[string]string + TokenURL string + Type string + func (s *SecuritySchemeProps) AddScope(scope, description string) + type SimpleSchema struct + CollectionFormat string + Default interface{} + Example interface{} + Format string + Items *Items + Nullable bool + Type string + func (s *SimpleSchema) ItemsTypeName() string + func (s *SimpleSchema) TypeName() string + type StringOrArray []string + func (s *StringOrArray) UnmarshalJSON(data []byte) error + func (s StringOrArray) Contains(value string) bool + func (s StringOrArray) MarshalJSON() ([]byte, error) + type Swagger struct + func (s *Swagger) GobDecode(b []byte) error + func (s *Swagger) UnmarshalJSON(data []byte) error + func (s Swagger) GobEncode() ([]byte, error) + func (s Swagger) JSONLookup(token string) (interface{}, error) + func (s Swagger) MarshalJSON() ([]byte, error) + type SwaggerProps struct + BasePath string + Consumes []string + Definitions Definitions + ExternalDocs *ExternalDocumentation + Host string + ID string + Info *Info + Parameters map[string]Parameter + Paths *Paths + Produces []string + Responses map[string]Response + Schemes []string + Security []map[string][]string + SecurityDefinitions SecurityDefinitions + Swagger string + Tags []Tag + func (o *SwaggerProps) GobDecode(b []byte) error + func (o SwaggerProps) GobEncode() ([]byte, error) + type SwaggerSchemaProps struct + Discriminator string + Example interface{} + ExternalDocs *ExternalDocumentation + ReadOnly bool + XML *XMLObject + type Tag struct + func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag + func (t *Tag) UnmarshalJSON(data []byte) error + func (t Tag) JSONLookup(token string) (interface{}, error) + func (t Tag) MarshalJSON() ([]byte, error) + type TagProps struct + Description string + ExternalDocs *ExternalDocumentation + Name string + type VendorExtensible struct + Extensions Extensions + func (v *VendorExtensible) AddExtension(key string, value interface{}) + func (v *VendorExtensible) UnmarshalJSON(data []byte) error + func (v VendorExtensible) MarshalJSON() ([]byte, error) + type XMLObject struct + Attribute bool + Name string + Namespace string + Prefix string + Wrapped bool + func (x *XMLObject) AsAttribute() *XMLObject + func (x *XMLObject) AsElement() *XMLObject + func (x *XMLObject) AsUnwrapped() *XMLObject + func (x *XMLObject) AsWrapped() *XMLObject + func (x *XMLObject) WithName(name string) *XMLObject + func (x *XMLObject) WithNamespace(namespace string) *XMLObject + func (x *XMLObject) WithPrefix(prefix string) *XMLObject