Versions in this module Expand all Collapse all v0 v0.0.2 Mar 19, 2020 v0.0.1 Mar 19, 2020 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 DefineStringFormat(name string, pattern string) + func Float64Ptr(value float64) *float64 + func Int64Ptr(value int64) *int64 + func NewExample(value interface{}) *interface + 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) Validate(c context.Context) error + func (value *Components) MarshalJSON() ([]byte, error) + func (value *Components) UnmarshalJSON(data []byte) 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]*ContentType + func NewContent() Content + func NewContentWithJSONSchema(schema *Schema) Content + func NewContentWithJSONSchemaRef(schema *SchemaRef) Content + func (content Content) Validate(c context.Context) error + func (ct Content) Get(mime string) *ContentType + type ContentType struct + Description string + Examples []ExampleRef + Schema *SchemaRef + func NewContentType() *ContentType + func (contentType *ContentType) WithExample(value interface{}) *ContentType + func (contentType *ContentType) WithSchema(schema *Schema) *ContentType + func (contentType *ContentType) WithSchemaRef(schema *SchemaRef) *ContentType + func (ct *ContentType) Validate(c context.Context) error + func (value *ContentType) MarshalJSON() ([]byte, error) + func (value *ContentType) UnmarshalJSON(data []byte) error + type ExampleRef struct + Ref string + Value *interface{} + 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 OAuthFlow struct + AuthorizationURL string + RefreshURL string + Scopes map[string]string + TokenURL string + func (flow *OAuthFlow) Validate(c context.Context) error + func (value *OAuthFlow) MarshalJSON() ([]byte, error) + func (value *OAuthFlow) UnmarshalJSON(data []byte) error + type OAuthFlows struct + AuthorizationCode *OAuthFlow + ClientCredentials *OAuthFlow + Implicit *OAuthFlow + Password *OAuthFlow + func (flows *OAuthFlows) Validate(c context.Context) error + func (value *OAuthFlows) MarshalJSON() ([]byte, error) + func (value *OAuthFlows) UnmarshalJSON(data []byte) 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) ValidateOperation(c context.Context, pathItem *PathItem, method string) error + func (value *Operation) MarshalJSON() ([]byte, error) + func (value *Operation) UnmarshalJSON(data []byte) error + type Parameter struct + AllowEmptyValue bool + AllowReserved bool + Deprecated bool + Description string + Example interface{} + Examples []interface{} + 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) 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 + func (value *Parameter) MarshalJSON() ([]byte, error) + func (value *Parameter) UnmarshalJSON(data []byte) error + 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 (all Parameters) GetByInAndName(in string, name string) *Parameter + func (all Parameters) Validate(c context.Context) error + type PathItem struct + 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) Operations() map[string]*Operation + func (pathItem *PathItem) SetOperation(method string, operation *Operation) + func (pathItem *PathItem) Validate(c context.Context) error + func (value *PathItem) MarshalJSON() ([]byte, error) + func (value *PathItem) UnmarshalJSON(data []byte) 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) GetContentType(mediaType string) *ContentType + 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 + func (value *RequestBody) MarshalJSON() ([]byte, error) + func (value *RequestBody) UnmarshalJSON(data []byte) error + 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) 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 + func (value *Response) MarshalJSON() ([]byte, error) + func (value *Response) UnmarshalJSON(data []byte) error + 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 (all Responses) Validate(c context.Context) error + func (responses Responses) Default() *ResponseRef + func (responses Responses) Get(status int) *ResponseRef + type Schema struct + AdditionalProperties *SchemaRef + AdditionalPropertiesAllowed bool + AllOf []*SchemaRef + AnyOf []*SchemaRef + Default interface{} + Description string + Discriminator string + Enum []interface{} + Example interface{} + Examples []interface{} + ExclusiveMax *float64 + ExclusiveMin *float64 + ExternalDocs interface{} + Format string + Items *SchemaRef + Max *float64 + MaxItems *int64 + MaxLength *int64 + Min *float64 + MinItems int64 + MinLength int64 + Multiple int64 + Not *SchemaRef + Nullable bool + OneOf []*SchemaRef + Pattern string + PatternProperties string + Properties map[string]*SchemaRef + ReadOnly bool + Required []string + Type string + Types []string + 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 NewObjectSchema() *Schema + func NewOneOfSchema(schemas ...*Schema) *Schema + func NewSchema() *Schema + func NewStringSchema() *Schema + 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) TypesContains(value string) bool + 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 float64) *Schema + func (schema *Schema) WithExclusiveMin(value float64) *Schema + func (schema *Schema) WithFormat(value string) *Schema + func (schema *Schema) WithItems(value *Schema) *Schema + func (schema *Schema) WithLength(n int64) *Schema + func (schema *Schema) WithLengthDecodedBase64(n int64) *Schema + func (schema *Schema) WithMax(value float64) *Schema + func (schema *Schema) WithMaxItems(n int64) *Schema + func (schema *Schema) WithMaxLength(n int64) *Schema + func (schema *Schema) WithMaxLengthDecodedBase64(n int64) *Schema + func (schema *Schema) WithMin(value float64) *Schema + func (schema *Schema) WithMinItems(n int64) *Schema + func (schema *Schema) WithMinLength(n int64) *Schema + func (schema *Schema) WithMinLengthDecodedBase64(n int64) *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 (value *Schema) MarshalJSON() ([]byte, error) + func (value *Schema) NewRef() *SchemaRef + func (value *Schema) UnmarshalJSON(data []byte) error + type SchemaError struct + 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 + Flow *OAuthFlows + In string + Name string + Scheme string + Type string + func NewCSRFSecurityScheme() *SecurityScheme + func NewJWTSecurityScheme() *SecurityScheme + func NewSecurityScheme() *SecurityScheme + func (securityScheme *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 + func (value *SecurityScheme) MarshalJSON() ([]byte, error) + func (value *SecurityScheme) UnmarshalJSON(data []byte) error + 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) 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) Validate(c context.Context) error + func (value *Swagger) MarshalJSON() ([]byte, error) + func (value *Swagger) UnmarshalJSON(data []byte) error + type SwaggerLoader struct + Context context.Context + IsExternalRefsAllowed bool + LoadSwaggerFromURIFunc func(loader *SwaggerLoader, url *url.URL) (*Swagger, error) + func NewSwaggerLoader() *SwaggerLoader + func (resolver *SwaggerLoader) ResolveRefsIn(swagger *Swagger) error + 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) + type Tag struct + Description string + ExternalDocs *ExternalDocs + Name string + type Tags []*Tag + func (tags Tags) Get(name string) *Tag