Versions in this module Expand all Collapse all v0 v0.1.0 Sep 29, 2018 Changes in this version + const ParameterInCookie + const ParameterInHeader + const ParameterInPath + const ParameterInQuery + var ErrSchemaInputInf = errors.New("Inf is not allowed") + var ErrSchemaInputNaN = errors.New("NaN is not allowed") + var SchemaErrorDetailsDisabled = false + var SchemaStringFormats = make(map[string]*regexp.Regexp, 8) + func BoolPtr(value bool) *bool + func DefineStringFormat(name string, pattern string) + func Float64Ptr(value float64) *float64 + func Int64Ptr(value int64) *int64 + func Uint64Ptr(value uint64) *uint64 + func ValidateIdentifier(value string) error + type Callback map[string]*PathItem + func (value Callback) Validate(c context.Context) error + type CallbackRef struct + Ref string + Value *Callback + func (value *CallbackRef) MarshalJSON() ([]byte, error) + func (value *CallbackRef) UnmarshalJSON(data []byte) error + func (value *CallbackRef) Validate(c context.Context) error + type Components struct + Callbacks map[string]*CallbackRef + Examples map[string]*ExampleRef + Headers map[string]*HeaderRef + Links map[string]*LinkRef + Parameters map[string]*ParameterRef + RequestBodies map[string]*RequestBodyRef + Responses map[string]*ResponseRef + Schemas map[string]*SchemaRef + SecuritySchemes map[string]*SecuritySchemeRef + Tags Tags + func NewComponents() Components + func (components *Components) MarshalJSON() ([]byte, error) + func (components *Components) UnmarshalJSON(data []byte) error + func (components *Components) Validate(c context.Context) (err error) + type Contact struct + Email string + Name string + URL string + func (value *Contact) MarshalJSON() ([]byte, error) + func (value *Contact) UnmarshalJSON(data []byte) error + type Content map[string]*MediaType + func NewContent() Content + func NewContentWithJSONSchema(schema *Schema) Content + func NewContentWithJSONSchemaRef(schema *SchemaRef) Content + func (content Content) Get(mime string) *MediaType + func (content Content) Validate(c context.Context) error + type Encoding struct + AllowReserved bool + ContentType string + Explode bool + Headers map[string]*HeaderRef + Style string + func NewEncoding() *Encoding + func (encoding *Encoding) MarshalJSON() ([]byte, error) + func (encoding *Encoding) UnmarshalJSON(data []byte) error + func (encoding *Encoding) Validate(c context.Context) error + func (encoding *Encoding) WithHeader(name string, header *Header) *Encoding + func (encoding *Encoding) WithHeaderRef(name string, ref *HeaderRef) *Encoding + type Example struct + Description string + ExternalValue string + Summary string + Value interface{} + func NewExample(value interface{}) *Example + func (example *Example) MarshalJSON() ([]byte, error) + func (example *Example) UnmarshalJSON(data []byte) error + type ExampleRef struct + Ref string + Value *Example + func (value *ExampleRef) MarshalJSON() ([]byte, error) + func (value *ExampleRef) UnmarshalJSON(data []byte) error + func (value *ExampleRef) Validate(c context.Context) error + type ExtensionProps struct + Extensions map[string]interface{} + func (props *ExtensionProps) DecodeWith(decoder *jsoninfo.ObjectDecoder, value interface{}) error + func (props *ExtensionProps) EncodeWith(encoder *jsoninfo.ObjectEncoder, value interface{}) error + type ExternalDocs struct + Description string + URL string + type Header struct + Description string + Schema *SchemaRef + func (value *Header) Validate(c context.Context) error + type HeaderRef struct + Ref string + Value *Header + func (value *HeaderRef) MarshalJSON() ([]byte, error) + func (value *HeaderRef) UnmarshalJSON(data []byte) error + func (value *HeaderRef) Validate(c context.Context) error + type Info struct + Contact *Contact + Description string + License *License + TermsOfService string + Title string + Version string + func (value *Info) MarshalJSON() ([]byte, error) + func (value *Info) UnmarshalJSON(data []byte) error + type License struct + Name string + URL string + func (value *License) MarshalJSON() ([]byte, error) + func (value *License) UnmarshalJSON(data []byte) error + type Link struct + Description string + Headers map[string]*Schema + Href string + OperationID string + Parameters map[string]interface{} + func (value *Link) MarshalJSON() ([]byte, error) + func (value *Link) UnmarshalJSON(data []byte) error + func (value *Link) Validate(c context.Context) error + type LinkRef struct + Ref string + Value *Link + func (value *LinkRef) MarshalJSON() ([]byte, error) + func (value *LinkRef) UnmarshalJSON(data []byte) error + func (value *LinkRef) Validate(c context.Context) error + type MediaType struct + Encoding map[string]*Encoding + Example interface{} + Examples map[string]*ExampleRef + Schema *SchemaRef + func NewMediaType() *MediaType + func (mediaType *MediaType) MarshalJSON() ([]byte, error) + func (mediaType *MediaType) UnmarshalJSON(data []byte) error + func (mediaType *MediaType) Validate(c context.Context) error + func (mediaType *MediaType) WithEncoding(name string, enc *Encoding) *MediaType + func (mediaType *MediaType) WithExample(name string, value interface{}) *MediaType + func (mediaType *MediaType) WithSchema(schema *Schema) *MediaType + func (mediaType *MediaType) WithSchemaRef(schema *SchemaRef) *MediaType + type OAuthFlow struct + AuthorizationURL string + RefreshURL string + Scopes map[string]string + TokenURL string + func (flow *OAuthFlow) MarshalJSON() ([]byte, error) + func (flow *OAuthFlow) UnmarshalJSON(data []byte) error + func (flow *OAuthFlow) Validate(c context.Context, typ oAuthFlowType) error + type OAuthFlows struct + AuthorizationCode *OAuthFlow + ClientCredentials *OAuthFlow + Implicit *OAuthFlow + Password *OAuthFlow + func (flows *OAuthFlows) MarshalJSON() ([]byte, error) + func (flows *OAuthFlows) UnmarshalJSON(data []byte) error + func (flows *OAuthFlows) Validate(c context.Context) error + type Operation struct + Callbacks map[string]*CallbackRef + Deprecated bool + Description string + OperationID string + Parameters Parameters + RequestBody *RequestBodyRef + Responses Responses + Security *SecurityRequirements + Servers *Servers + Summary string + Tags []string + func NewOperation() *Operation + func (operation *Operation) AddParameter(p *Parameter) + func (operation *Operation) AddResponse(status int, response *Response) + func (operation *Operation) MarshalJSON() ([]byte, error) + func (operation *Operation) UnmarshalJSON(data []byte) error + func (operation *Operation) Validate(c context.Context) error + type Parameter struct + AllowEmptyValue bool + AllowReserved bool + Content Content + Deprecated bool + Description string + Example interface{} + Examples map[string]*ExampleRef + In string + Name string + Required bool + Schema *SchemaRef + Style string + func NewCookieParameter(name string) *Parameter + func NewHeaderParameter(name string) *Parameter + func NewPathParameter(name string) *Parameter + func NewQueryParameter(name string) *Parameter + func (parameter *Parameter) MarshalJSON() ([]byte, error) + func (parameter *Parameter) UnmarshalJSON(data []byte) error + func (parameter *Parameter) Validate(c context.Context) error + func (parameter *Parameter) WithDescription(value string) *Parameter + func (parameter *Parameter) WithRequired(value bool) *Parameter + func (parameter *Parameter) WithSchema(value *Schema) *Parameter + type ParameterRef struct + Ref string + Value *Parameter + func (value *ParameterRef) MarshalJSON() ([]byte, error) + func (value *ParameterRef) UnmarshalJSON(data []byte) error + func (value *ParameterRef) Validate(c context.Context) error + type Parameters []*ParameterRef + func NewParameters() Parameters + func (parameters Parameters) GetByInAndName(in string, name string) *Parameter + func (parameters Parameters) Validate(c context.Context) error + type PathItem struct + Connect *Operation + Delete *Operation + Description string + Get *Operation + Head *Operation + Options *Operation + Parameters Parameters + Patch *Operation + Post *Operation + Put *Operation + Servers Servers + Summary string + Trace *Operation + func (pathItem *PathItem) GetOperation(method string) *Operation + func (pathItem *PathItem) MarshalJSON() ([]byte, error) + func (pathItem *PathItem) Operations() map[string]*Operation + func (pathItem *PathItem) SetOperation(method string, operation *Operation) + func (pathItem *PathItem) UnmarshalJSON(data []byte) error + func (pathItem *PathItem) Validate(c context.Context) error + type Paths map[string]*PathItem + func (paths Paths) Find(key string) *PathItem + func (paths Paths) Validate(c context.Context) error + type RequestBody struct + Content Content + Description string + Required bool + func NewRequestBody() *RequestBody + func (requestBody *RequestBody) GetMediaType(mediaType string) *MediaType + func (requestBody *RequestBody) MarshalJSON() ([]byte, error) + func (requestBody *RequestBody) UnmarshalJSON(data []byte) error + func (requestBody *RequestBody) Validate(c context.Context) error + func (requestBody *RequestBody) WithContent(content Content) *RequestBody + func (requestBody *RequestBody) WithDescription(value string) *RequestBody + func (requestBody *RequestBody) WithJSONSchema(value *Schema) *RequestBody + func (requestBody *RequestBody) WithJSONSchemaRef(value *SchemaRef) *RequestBody + func (requestBody *RequestBody) WithRequired(value bool) *RequestBody + type RequestBodyRef struct + Ref string + Value *RequestBody + func (value *RequestBodyRef) MarshalJSON() ([]byte, error) + func (value *RequestBodyRef) UnmarshalJSON(data []byte) error + func (value *RequestBodyRef) Validate(c context.Context) error + type Response struct + Content Content + Description string + Headers map[string]*Schema + Links map[string]*LinkRef + func NewResponse() *Response + func (response *Response) MarshalJSON() ([]byte, error) + func (response *Response) UnmarshalJSON(data []byte) error + func (response *Response) Validate(c context.Context) error + func (response *Response) WithContent(content Content) *Response + func (response *Response) WithDescription(value string) *Response + func (response *Response) WithJSONSchema(schema *Schema) *Response + func (response *Response) WithJSONSchemaRef(schema *SchemaRef) *Response + type ResponseRef struct + Ref string + Value *Response + func (value *ResponseRef) MarshalJSON() ([]byte, error) + func (value *ResponseRef) UnmarshalJSON(data []byte) error + func (value *ResponseRef) Validate(c context.Context) error + type Responses map[string]*ResponseRef + func NewResponses() Responses + func (responses Responses) Default() *ResponseRef + func (responses Responses) Get(status int) *ResponseRef + func (responses Responses) Validate(c context.Context) error + type Schema struct + AdditionalProperties *SchemaRef + AdditionalPropertiesAllowed *bool + AllOf []*SchemaRef + AnyOf []*SchemaRef + Default interface{} + Description string + Discriminator string + Enum []interface{} + Example interface{} + ExclusiveMax bool + ExclusiveMin bool + ExternalDocs interface{} + Format string + Items *SchemaRef + Max *float64 + MaxItems *uint64 + MaxLength *uint64 + MaxProps *uint64 + Min *float64 + MinItems uint64 + MinLength uint64 + MinProps uint64 + MultipleOf *float64 + Not *SchemaRef + Nullable bool + OneOf []*SchemaRef + Pattern string + PatternProperties string + Properties map[string]*SchemaRef + ReadOnly bool + Required []string + Type string + UniqueItems bool + WriteOnly bool + XML interface{} + func NewAllOfSchema(schemas ...*Schema) *Schema + func NewAnyOfSchema(schemas ...*Schema) *Schema + func NewArraySchema() *Schema + func NewBoolSchema() *Schema + func NewBytesSchema() *Schema + func NewDateTimeSchema() *Schema + func NewFloat64Schema() *Schema + func NewInt32Schema() *Schema + func NewInt64Schema() *Schema + func NewIntegerSchema() *Schema + func NewObjectSchema() *Schema + func NewOneOfSchema(schemas ...*Schema) *Schema + func NewSchema() *Schema + func NewStringSchema() *Schema + func (schema *Schema) IsEmpty() bool + func (schema *Schema) IsMatching(value interface{}) bool + func (schema *Schema) IsMatchingJSONArray(value []interface{}) bool + func (schema *Schema) IsMatchingJSONBoolean(value bool) bool + func (schema *Schema) IsMatchingJSONNumber(value float64) bool + func (schema *Schema) IsMatchingJSONObject(value map[string]interface{}) bool + func (schema *Schema) IsMatchingJSONString(value string) bool + func (schema *Schema) MarshalJSON() ([]byte, error) + func (schema *Schema) NewRef() *SchemaRef + func (schema *Schema) UnmarshalJSON(data []byte) error + func (schema *Schema) Validate(c context.Context) error + func (schema *Schema) VisitJSON(value interface{}) error + func (schema *Schema) VisitJSONArray(value []interface{}) error + func (schema *Schema) VisitJSONBoolean(value bool) error + func (schema *Schema) VisitJSONNumber(value float64) error + func (schema *Schema) VisitJSONObject(value map[string]interface{}) error + func (schema *Schema) VisitJSONString(value string) error + func (schema *Schema) WithAdditionalProperties(v *Schema) *Schema + func (schema *Schema) WithAnyAdditionalProperties() *Schema + func (schema *Schema) WithEnum(values ...interface{}) *Schema + func (schema *Schema) WithExclusiveMax(value bool) *Schema + func (schema *Schema) WithExclusiveMin(value bool) *Schema + func (schema *Schema) WithFormat(value string) *Schema + func (schema *Schema) WithItems(value *Schema) *Schema + func (schema *Schema) WithLength(i int64) *Schema + func (schema *Schema) WithLengthDecodedBase64(i int64) *Schema + func (schema *Schema) WithMax(value float64) *Schema + func (schema *Schema) WithMaxItems(i int64) *Schema + func (schema *Schema) WithMaxLength(i int64) *Schema + func (schema *Schema) WithMaxLengthDecodedBase64(i int64) *Schema + func (schema *Schema) WithMaxProperties(i int64) *Schema + func (schema *Schema) WithMin(value float64) *Schema + func (schema *Schema) WithMinItems(i int64) *Schema + func (schema *Schema) WithMinLength(i int64) *Schema + func (schema *Schema) WithMinLengthDecodedBase64(i int64) *Schema + func (schema *Schema) WithMinProperties(i int64) *Schema + func (schema *Schema) WithNullable() *Schema + func (schema *Schema) WithPattern(pattern string) *Schema + func (schema *Schema) WithProperties(properties map[string]*Schema) *Schema + func (schema *Schema) WithProperty(name string, propertySchema *Schema) *Schema + func (schema *Schema) WithPropertyRef(name string, ref *SchemaRef) *Schema + func (schema *Schema) WithUniqueItems(unique bool) *Schema + type SchemaError struct + Origin error + Reason string + Schema *Schema + SchemaField string + Value interface{} + func (err *SchemaError) Error() string + func (err *SchemaError) JSONPointer() []string + type SchemaRef struct + Ref string + Value *Schema + func NewSchemaRef(ref string, value *Schema) *SchemaRef + func (value *SchemaRef) MarshalJSON() ([]byte, error) + func (value *SchemaRef) UnmarshalJSON(data []byte) error + func (value *SchemaRef) Validate(c context.Context) error + type SecurityRequirement map[string][]string + func NewSecurityRequirement() SecurityRequirement + func (security SecurityRequirement) Authenticate(provider string, scopes ...string) SecurityRequirement + func (security SecurityRequirement) Validate(c context.Context) error + type SecurityRequirements []SecurityRequirement + func NewSecurityRequirements() *SecurityRequirements + func (srs *SecurityRequirements) With(securityRequirement SecurityRequirement) *SecurityRequirements + func (srs SecurityRequirements) Validate(c context.Context) error + type SecurityScheme struct + BearerFormat string + Description string + Flows *OAuthFlows + In string + Name string + Scheme string + Type string + func NewCSRFSecurityScheme() *SecurityScheme + func NewJWTSecurityScheme() *SecurityScheme + func NewSecurityScheme() *SecurityScheme + func (ss *SecurityScheme) MarshalJSON() ([]byte, error) + func (ss *SecurityScheme) UnmarshalJSON(data []byte) error + func (ss *SecurityScheme) Validate(c context.Context) error + func (ss *SecurityScheme) WithBearerFormat(value string) *SecurityScheme + func (ss *SecurityScheme) WithDescription(value string) *SecurityScheme + func (ss *SecurityScheme) WithIn(value string) *SecurityScheme + func (ss *SecurityScheme) WithName(value string) *SecurityScheme + func (ss *SecurityScheme) WithScheme(value string) *SecurityScheme + func (ss *SecurityScheme) WithType(value string) *SecurityScheme + type SecuritySchemeRef struct + Ref string + Value *SecurityScheme + func (value *SecuritySchemeRef) MarshalJSON() ([]byte, error) + func (value *SecuritySchemeRef) UnmarshalJSON(data []byte) error + func (value *SecuritySchemeRef) Validate(c context.Context) error + type Server struct + Description string + URL string + Variables map[string]*ServerVariable + func (server *Server) Validate(c context.Context) (err error) + func (server Server) MatchRawURL(input string) ([]string, string, bool) + func (server Server) ParameterNames() ([]string, error) + type ServerVariable struct + Default interface{} + Description string + Enum []interface{} + func (serverVariable *ServerVariable) Validate(c context.Context) error + type Servers []*Server + func (servers Servers) MatchURL(parsedURL *url.URL) (*Server, []string, string) + func (servers Servers) Validate(c context.Context) error + type Swagger struct + Components Components + ExternalDocs *ExternalDocs + Info Info + OpenAPI string + Paths Paths + Security SecurityRequirements + Servers Servers + func (swagger *Swagger) AddOperation(path string, method string, operation *Operation) + func (swagger *Swagger) AddServer(server *Server) + func (swagger *Swagger) MarshalJSON() ([]byte, error) + func (swagger *Swagger) UnmarshalJSON(data []byte) error + func (swagger *Swagger) Validate(c context.Context) error + type SwaggerLoader struct + Context context.Context + IsExternalRefsAllowed bool + LoadSwaggerFromURIFunc func(loader *SwaggerLoader, url *url.URL) (*Swagger, error) + func NewSwaggerLoader() *SwaggerLoader + func (swaggerLoader *SwaggerLoader) LoadSwaggerFromData(data []byte) (*Swagger, error) + func (swaggerLoader *SwaggerLoader) LoadSwaggerFromFile(path string) (*Swagger, error) + func (swaggerLoader *SwaggerLoader) LoadSwaggerFromURI(location *url.URL) (*Swagger, error) + func (swaggerLoader *SwaggerLoader) LoadSwaggerFromYAMLData(data []byte) (*Swagger, error) + func (swaggerLoader *SwaggerLoader) ResolveRefsIn(swagger *Swagger) (err error) + type Tag struct + Description string + ExternalDocs *ExternalDocs + Name string + type Tags []*Tag + func (tags Tags) Get(name string) *Tag