Documentation ¶
Index ¶
- Constants
- Variables
- func NumberEquals(a, b float64) bool
- func NumberGreaterThan(v1, v2 float64) bool
- func NumberGreaterThanOrEqualsTo(v1, v2 float64) bool
- func NumberLessThan(v1, v2 float64) bool
- func NumberLessThanOrEqualsTo(v1, v2 float64) bool
- func NumberMultipleOf(v1, v2 float64) bool
- func Pointer[V any](v V) *V
- func Register(s Schema)
- func RegisterFormat(name string, format Format)
- func RegisterResolver(uri string, res Resolver)
- func UnregisterFormat(name string)
- func UpdateMetadata(s Schema, f func(meta MetadataAccessor) error) error
- func ValueOf[V any](v *V) (r V)
- type AllOf
- func (a *AllOf) AssignValue(imports map[string]string, valueName, resultName string) string
- func (a *AllOf) CompareValues(v1, v2 interface{}) int
- func (a *AllOf) Copy() Schema
- func (a *AllOf) DefaultValue() interface{}
- func (a *AllOf) GoString(imports map[string]string) string
- func (a *AllOf) GoType(imports map[string]string) string
- func (a *AllOf) StringValue(value interface{}) string
- func (a *AllOf) Type() Type
- func (a *AllOf) TypeString() string
- func (a *AllOf) UnmarshalJSON(j []byte) error
- func (a *AllOf) ValidateSchema(s Schema, compare bool) error
- func (a *AllOf) ValidateValue(value interface{}) (interface{}, error)
- type Array
- func (a *Array) AssignValue(imports map[string]string, valueName, resultName string) string
- func (a *Array) CompareValues(v1, v2 interface{}) int
- func (a *Array) Copy() Schema
- func (a *Array) DefaultValue() interface{}
- func (a *Array) GetItems() Schema
- func (a *Array) GoString(imports map[string]string) string
- func (a *Array) GoType(imports map[string]string) string
- func (a *Array) MarshalJSON() ([]byte, error)
- func (a *Array) StringValue(value interface{}) string
- func (a *Array) Type() Type
- func (a *Array) TypeString() string
- func (a *Array) UnmarshalJSON(j []byte) error
- func (a *Array) ValidateSchema(s Schema, compare bool) error
- func (a *Array) ValidateValue(value interface{}) (interface{}, error)
- type Boolean
- func (b *Boolean) AssignValue(imports map[string]string, valueName, resultName string) string
- func (b *Boolean) CompareValues(v1, v2 interface{}) int
- func (b *Boolean) Copy() Schema
- func (b *Boolean) DefaultValue() interface{}
- func (b *Boolean) GetNullable() bool
- func (b *Boolean) GoString(imports map[string]string) string
- func (b *Boolean) GoType(_ map[string]string) string
- func (b *Boolean) MarshalJSON() ([]byte, error)
- func (b *Boolean) SetNullable(nullable bool)
- func (b *Boolean) StringValue(value interface{}) string
- func (b *Boolean) Type() Type
- func (b *Boolean) TypeString() string
- func (b *Boolean) UnmarshalJSON(input []byte) error
- func (b *Boolean) ValidateSchema(b2 Schema, _ bool) error
- func (b *Boolean) ValidateValue(value interface{}) (interface{}, error)
- type ByteStream
- func (b *ByteStream) AssignValue(imports map[string]string, valueName, resultName string) string
- func (b *ByteStream) CompareValues(v1, v2 interface{}) int
- func (b *ByteStream) Copy() Schema
- func (b *ByteStream) DefaultValue() interface{}
- func (b *ByteStream) GoString(imports map[string]string) string
- func (b *ByteStream) GoType(imports map[string]string) string
- func (b *ByteStream) MarshalJSON() ([]byte, error)
- func (b *ByteStream) StringValue(value interface{}) string
- func (b *ByteStream) Type() Type
- func (b *ByteStream) TypeString() string
- func (b *ByteStream) ValidateSchema(s2 Schema, compare bool) error
- func (b *ByteStream) ValidateValue(value interface{}) (interface{}, error)
- type Directive
- type FieldError
- type Format
- type Function
- func (f *Function) AssignValue(_ map[string]string, _, _ string) string
- func (f *Function) CompareValues(_, _ interface{}) int
- func (f *Function) Copy() Schema
- func (f *Function) DefaultValue() interface{}
- func (f *Function) GetAdditionalParameters() *NamedSchema
- func (f *Function) GetParameters() Parameters
- func (f *Function) GetResult() Schema
- func (f *Function) GetResultTypeFrom() string
- func (f *Function) GoString(imports map[string]string) string
- func (f *Function) GoType(imports map[string]string) string
- func (f *Function) MarshalJSON() ([]byte, error)
- func (f *Function) StringValue(interface{}) string
- func (f *Function) Type() Type
- func (f *Function) TypeString() string
- func (f *Function) UnmarshalJSON(j []byte) error
- func (f *Function) ValidateSchema(s Schema, compare bool) error
- func (f *Function) ValidateValue(value interface{}) (interface{}, error)
- type Integer
- func (i *Integer) AssignValue(imports map[string]string, valueName, resultName string) string
- func (i *Integer) CompareValues(v1, v2 interface{}) int
- func (i *Integer) Copy() Schema
- func (i *Integer) DefaultValue() interface{}
- func (i *Integer) GetNullable() bool
- func (i *Integer) GoString(imports map[string]string) string
- func (i *Integer) GoType(_ map[string]string) string
- func (i *Integer) MarshalJSON() ([]byte, error)
- func (i *Integer) SetNullable(nullable bool)
- func (i *Integer) StringValue(value interface{}) string
- func (i *Integer) Type() Type
- func (i *Integer) TypeString() string
- func (i *Integer) UnmarshalJSON(input []byte) error
- func (i *Integer) ValidateSchema(i2 Schema, compare bool) error
- func (i *Integer) ValidateValue(value interface{}) (interface{}, error)
- type Map
- func (m *Map) AssignValue(imports map[string]string, valueName, resultName string) string
- func (m *Map) CompareValues(v1, v2 interface{}) int
- func (m *Map) Copy() Schema
- func (m *Map) DefaultValue() interface{}
- func (m *Map) GetAdditionalProperties() Schema
- func (m *Map) GoString(imports map[string]string) string
- func (m *Map) GoType(imports map[string]string) string
- func (m *Map) MarshalJSON() ([]byte, error)
- func (m *Map) StringValue(value interface{}) string
- func (m *Map) Type() Type
- func (m *Map) TypeString() string
- func (m *Map) UnmarshalJSON(j []byte) error
- func (m *Map) ValidateSchema(s Schema, compare bool) error
- func (m *Map) ValidateValue(value interface{}) (interface{}, error)
- type Metadata
- func (m *Metadata) GetAnnotation(name string) string
- func (m *Metadata) GetDeprecated() bool
- func (m *Metadata) GetDescription() string
- func (m Metadata) GetExamples() []interface{}
- func (m Metadata) GetID() string
- func (m *Metadata) GetReadOnly() bool
- func (m *Metadata) GetTitle() string
- func (m *Metadata) GetWriteOnly() bool
- func (m *Metadata) GoString(imports map[string]string) string
- func (m *Metadata) Merge(m2 Metadata)
- func (m *Metadata) SetAnnotation(name, value string)
- func (m *Metadata) SetDeprecated(deprecated bool)
- func (m *Metadata) SetDescription(description string)
- func (m *Metadata) SetExamples(examples []interface{})
- func (m *Metadata) SetID(id string)
- func (m *Metadata) SetReadOnly(readOnly bool)
- func (m *Metadata) SetTitle(title string)
- func (m *Metadata) SetWriteOnly(writeOnly bool)
- type MetadataAccessor
- type NamedSchema
- type NonEmptyString
- type Null
- func (n *Null) AssignValue(_ map[string]string, _, resultName string) string
- func (n *Null) CompareValues(v1, v2 interface{}) int
- func (n *Null) Copy() Schema
- func (n *Null) DefaultValue() interface{}
- func (n *Null) GoString(imports map[string]string) string
- func (n *Null) GoType(_ map[string]string) string
- func (n *Null) MarshalJSON() ([]byte, error)
- func (n *Null) StringValue(interface{}) string
- func (n *Null) Type() Type
- func (n *Null) TypeString() string
- func (n *Null) ValidateSchema(n2 Schema, _ bool) error
- func (n *Null) ValidateValue(v interface{}) (interface{}, error)
- type Nullable
- type Number
- func (n *Number) AssignValue(imports map[string]string, valueName, resultName string) string
- func (n *Number) CompareValues(v1, v2 interface{}) int
- func (n *Number) Copy() Schema
- func (n *Number) DefaultValue() interface{}
- func (n *Number) GetNullable() bool
- func (n *Number) GoString(imports map[string]string) string
- func (n *Number) GoType(_ map[string]string) string
- func (n *Number) MarshalJSON() ([]byte, error)
- func (n *Number) SetNullable(nullable bool)
- func (n *Number) StringValue(value interface{}) string
- func (n *Number) Type() Type
- func (n *Number) TypeString() string
- func (n *Number) UnmarshalJSON(input []byte) error
- func (n *Number) ValidateSchema(n2 Schema, _ bool) error
- func (n *Number) ValidateValue(value interface{}) (interface{}, error)
- type Object
- func (o *Object) AssignValue(_ map[string]string, _, _ string) string
- func (o *Object) CompareValues(v1, v2 interface{}) int
- func (o *Object) Copy() Schema
- func (o *Object) DefaultValue() interface{}
- func (o *Object) FieldName(parameterName string) string
- func (o *Object) GoString(imports map[string]string) string
- func (o *Object) GoType(imports map[string]string) string
- func (o *Object) IsPropertyRequired(jsonPropertyName string) bool
- func (o *Object) JSONPropertyName(parameterName string) string
- func (o *Object) MarshalJSON() ([]byte, error)
- func (o *Object) ParameterName(jsonPropertyName string) string
- func (o *Object) PropertyByParameterName(parameterName string) (Schema, bool)
- func (o *Object) StringValue(value interface{}) string
- func (o *Object) Type() Type
- func (o *Object) TypeString() string
- func (o *Object) UnmarshalJSON(j []byte) error
- func (o *Object) ValidateSchema(s Schema, compare bool) error
- func (o *Object) ValidateValue(value interface{}) (interface{}, error)
- type Parameters
- type Reference
- func (r *Reference) AssignValue(imports map[string]string, valueName, resultName string) string
- func (r *Reference) CompareValues(a, b interface{}) int
- func (r *Reference) Copy() Schema
- func (r *Reference) DefaultValue() interface{}
- func (r *Reference) GetNullable() bool
- func (r *Reference) GoString(imports map[string]string) string
- func (r *Reference) GoType(imports map[string]string) string
- func (r *Reference) SetNullable(nullable bool)
- func (r *Reference) StringValue(value interface{}) string
- func (r *Reference) Type() Type
- func (r *Reference) TypeString() string
- func (r *Reference) ValidateSchema(s Schema, compare bool) error
- func (r *Reference) ValidateValue(value interface{}) (interface{}, error)
- type Registry
- type Resolver
- type ResolverFunc
- type Schema
- func BooleanValue() Schema
- func ByteStreamValue() Schema
- func False() Schema
- func Get(uri string) (Schema, error)
- func GetCommonSchema(s1, s2 Schema) (Schema, error)
- func GetSchemaForValue(value interface{}) (Schema, error)
- func GetSchemaForValues(cnt int, s func(i int) (Schema, error)) (Schema, error)
- func IntegerValue() Schema
- func NullValue() Schema
- func NumberValue() Schema
- func ResolveFromFile(uri string) (Schema, error)
- func StringValue() Schema
- func UnmarshalJSON(b []byte) (Schema, error)
- func UntypedValue() Schema
- type SchemaUnmarshaler
- type String
- func (s *String) AssignValue(imports map[string]string, valueName, resultName string) string
- func (s *String) CompareValues(v1, v2 interface{}) int
- func (s *String) Copy() Schema
- func (s *String) DefaultValue() interface{}
- func (s *String) GetNullable() bool
- func (s *String) GoString(imports map[string]string) string
- func (s *String) GoType(imports map[string]string) string
- func (s *String) MarshalJSON() ([]byte, error)
- func (s *String) SetNullable(nullable bool)
- func (s *String) StringValue(value interface{}) string
- func (s *String) Type() Type
- func (s *String) TypeString() string
- func (s *String) UnmarshalJSON(input []byte) error
- func (s *String) ValidateSchema(s2 Schema, _ bool) error
- func (s *String) ValidateValue(value interface{}) (interface{}, error)
- type Type
- type UniqueNonEmptyStringList
- type Untyped
- func (u *Untyped) AssignValue(_ map[string]string, valueName, resultName string) string
- func (u *Untyped) CompareValues(v1, v2 interface{}) int
- func (u *Untyped) Copy() Schema
- func (u *Untyped) DefaultValue() interface{}
- func (u *Untyped) GoString(imports map[string]string) string
- func (u *Untyped) GoType(_ map[string]string) string
- func (u *Untyped) StringValue(value interface{}) string
- func (u *Untyped) Type() Type
- func (u *Untyped) TypeString() string
- func (u *Untyped) ValidateSchema(s Schema, compare bool) error
- func (u *Untyped) ValidateValue(v interface{}) (interface{}, error)
- type ValidationError
Constants ¶
View Source
const ( FormatBinary = "binary" FormatByte = "byte" // Alias to "binary" FormatDefault = "" FormatDate = "date" FormatDateTime = "date-time" FormatDurationRFC3339 = "duration" FormatDurationGo = "duration-go" FormatEmail = "email" FormatHostname = "hostname" FormatIDNEmail = "idn-email" FormatIDNHostname = "idn-hostname" FormatIP = "ip" FormatIPCIDR = "ip-cidr" FormatIPv4 = "ipv4" FormatIPv4CIDR = "ipv4-cidr" FormatIPv6 = "ipv6" FormatIPv6CIDR = "ipv6-cidr" FormatIRI = "iri" FormatIRIReference = "iri-reference" FormatRegex = "regex" FormatTime = "time" FormatURI = "uri" FormatURIReference = "uri-reference" FormatUUID = "uuid" )
View Source
const Epsilon = 0.000000001
Epsilon is used as a float64 comparison tolerance
View Source
const (
FormatConflowID = "conflow.ID"
)
View Source
const NameRegExpPattern = "[a-z][a-z0-9]*(?:_[a-z0-9]+)*"
NameRegExpPattern is the regular expression for a valid identifier
Variables ¶
View Source
var ErrMetadataReadOnly = errors.New("metadata is read-only")
View Source
var FieldNameRegexp = regexp.MustCompile("^[_a-zA-Z][_a-zA-Z0-9]*$")
View Source
var NameRegExp = regexp.MustCompile("^" + NameRegExpPattern + "$")
NameRegExp is a compiled regular expression object for a valid identifier
Functions ¶
func NumberEquals ¶
func NumberGreaterThan ¶
func NumberLessThan ¶
func NumberMultipleOf ¶
func RegisterFormat ¶
func RegisterResolver ¶
func UnregisterFormat ¶
func UnregisterFormat(name string)
func UpdateMetadata ¶
func UpdateMetadata(s Schema, f func(meta MetadataAccessor) error) error
Types ¶
type AllOf ¶
type AllOf struct { // @name "schema" // @required // @min_items 1 Schemas []Schema `json:"allOf"` // @ignore Schema `json:"-"` }
func (*AllOf) AssignValue ¶
func (*AllOf) CompareValues ¶
func (*AllOf) DefaultValue ¶
func (a *AllOf) DefaultValue() interface{}
func (*AllOf) StringValue ¶
func (*AllOf) TypeString ¶
func (*AllOf) UnmarshalJSON ¶
func (*AllOf) ValidateValue ¶
type Array ¶
type Array struct { Metadata Const []interface{} `json:"const,omitempty"` Default []interface{} `json:"default,omitempty"` Enum [][]interface{} `json:"enum,omitempty"` // @required Items Schema `json:"items,omitempty"` MinItems int64 `json:"minItems,omitempty"` MaxItems *int64 `json:"maxItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` }
func (*Array) AssignValue ¶
func (*Array) CompareValues ¶
func (*Array) DefaultValue ¶
func (a *Array) DefaultValue() interface{}
func (*Array) MarshalJSON ¶
func (*Array) StringValue ¶
func (*Array) TypeString ¶
func (*Array) UnmarshalJSON ¶
func (*Array) ValidateValue ¶
type Boolean ¶
type Boolean struct { Metadata Const *bool `json:"const,omitempty"` Default *bool `json:"default,omitempty"` Enum []bool `json:"enum,omitempty"` Nullable bool `json:"nullable,omitempty"` }
func (*Boolean) AssignValue ¶
func (*Boolean) CompareValues ¶
func (*Boolean) DefaultValue ¶
func (b *Boolean) DefaultValue() interface{}
func (*Boolean) GetNullable ¶
func (*Boolean) MarshalJSON ¶
func (*Boolean) SetNullable ¶
func (*Boolean) StringValue ¶
func (*Boolean) TypeString ¶
func (*Boolean) UnmarshalJSON ¶
func (*Boolean) ValidateValue ¶
type ByteStream ¶
type ByteStream struct {
Metadata
}
func (*ByteStream) AssignValue ¶
func (b *ByteStream) AssignValue(imports map[string]string, valueName, resultName string) string
func (*ByteStream) CompareValues ¶
func (b *ByteStream) CompareValues(v1, v2 interface{}) int
func (*ByteStream) Copy ¶
func (b *ByteStream) Copy() Schema
func (*ByteStream) DefaultValue ¶
func (b *ByteStream) DefaultValue() interface{}
func (*ByteStream) MarshalJSON ¶
func (b *ByteStream) MarshalJSON() ([]byte, error)
func (*ByteStream) StringValue ¶
func (b *ByteStream) StringValue(value interface{}) string
func (*ByteStream) Type ¶
func (b *ByteStream) Type() Type
func (*ByteStream) TypeString ¶
func (b *ByteStream) TypeString() string
func (*ByteStream) ValidateSchema ¶
func (b *ByteStream) ValidateSchema(s2 Schema, compare bool) error
func (*ByteStream) ValidateValue ¶
func (b *ByteStream) ValidateValue(value interface{}) (interface{}, error)
type FieldError ¶
func NewFieldError ¶
func NewFieldError(field string, err error) FieldError
func NewFieldErrorf ¶
func NewFieldErrorf(field, format string, a ...interface{}) FieldError
func (FieldError) Error ¶
func (f FieldError) Error() string
type Format ¶
type Function ¶
type Function struct { Metadata AdditionalParameters *NamedSchema `json:"additionalParameters,omitempty"` Parameters Parameters `json:"parameters,omitempty"` Result Schema `json:"result,omitempty"` ResultTypeFrom string `json:"resultTypeFrom,omitempty"` }
func (*Function) AssignValue ¶
func (*Function) CompareValues ¶
func (*Function) DefaultValue ¶
func (f *Function) DefaultValue() interface{}
func (*Function) GetAdditionalParameters ¶
func (f *Function) GetAdditionalParameters() *NamedSchema
func (*Function) GetParameters ¶
func (f *Function) GetParameters() Parameters
func (*Function) GetResultTypeFrom ¶
func (*Function) MarshalJSON ¶
func (*Function) StringValue ¶
func (*Function) TypeString ¶
func (*Function) UnmarshalJSON ¶
func (*Function) ValidateValue ¶
type Integer ¶
type Integer struct { Metadata Const *int64 `json:"const,omitempty"` Default *int64 `json:"default,omitempty"` Enum []int64 `json:"enum,omitempty"` ExclusiveMinimum *int64 `json:"exclusiveMinimum,omitempty"` ExclusiveMaximum *int64 `json:"exclusiveMaximum,omitempty"` // @enum ["int32", "int64"] Format string `json:"format,omitempty"` Maximum *int64 `json:"maximum,omitempty"` Minimum *int64 `json:"minimum,omitempty"` Nullable bool `json:"nullable,omitempty"` MultipleOf *int64 `json:"multipleOf,omitempty"` }
func (*Integer) AssignValue ¶
func (*Integer) CompareValues ¶
func (*Integer) DefaultValue ¶
func (i *Integer) DefaultValue() interface{}
func (*Integer) GetNullable ¶
func (*Integer) MarshalJSON ¶
func (*Integer) SetNullable ¶
func (*Integer) StringValue ¶
func (*Integer) TypeString ¶
func (*Integer) UnmarshalJSON ¶
func (*Integer) ValidateValue ¶
type Map ¶
type Map struct { Metadata // @required AdditionalProperties Schema `json:"additionalProperties,omitempty"` Const map[string]interface{} `json:"const,omitempty"` Default map[string]interface{} `json:"default,omitempty"` Enum []map[string]interface{} `json:"enum,omitempty"` MinProperties int64 `json:"minProperties,omitempty"` MaxProperties *int64 `json:"maxProperties,omitempty"` }
func (*Map) AssignValue ¶
func (*Map) CompareValues ¶
func (*Map) DefaultValue ¶
func (m *Map) DefaultValue() interface{}
func (*Map) GetAdditionalProperties ¶
func (*Map) MarshalJSON ¶
func (*Map) StringValue ¶
func (*Map) TypeString ¶
func (*Map) UnmarshalJSON ¶
func (*Map) ValidateValue ¶
type Metadata ¶
type Metadata struct { Annotations map[string]string `json:"annotations,omitempty"` Deprecated bool `json:"deprecated,omitempty"` Description string `json:"description,omitempty"` Examples []interface{} `json:"examples,omitempty"` ID string `json:"$id,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` Title string `json:"title,omitempty"` WriteOnly bool `json:"writeOnly,omitempty"` }
Metadata contains common metadata for schemas
func (*Metadata) GetAnnotation ¶
func (*Metadata) GetDeprecated ¶
func (*Metadata) GetDescription ¶
func (Metadata) GetExamples ¶
func (m Metadata) GetExamples() []interface{}
func (*Metadata) GetReadOnly ¶
func (*Metadata) GetWriteOnly ¶
func (*Metadata) SetAnnotation ¶
func (*Metadata) SetDeprecated ¶
func (*Metadata) SetDescription ¶
func (*Metadata) SetExamples ¶
func (m *Metadata) SetExamples(examples []interface{})
func (*Metadata) SetReadOnly ¶
func (*Metadata) SetWriteOnly ¶
type MetadataAccessor ¶
type NamedSchema ¶
type Null ¶
type Null struct {
Metadata
}
func (*Null) AssignValue ¶
func (*Null) CompareValues ¶
func (*Null) DefaultValue ¶
func (n *Null) DefaultValue() interface{}
func (*Null) MarshalJSON ¶
func (*Null) StringValue ¶
func (*Null) TypeString ¶
func (*Null) ValidateValue ¶
type Number ¶
type Number struct { Metadata Const *float64 `json:"const,omitempty"` Default *float64 `json:"default,omitempty"` Enum []float64 `json:"enum,omitempty"` ExclusiveMinimum *float64 `json:"exclusiveMinimum,omitempty"` ExclusiveMaximum *float64 `json:"exclusiveMaximum,omitempty"` Maximum *float64 `json:"maximum,omitempty"` Minimum *float64 `json:"minimum,omitempty"` MultipleOf *float64 `json:"multipleOf,omitempty"` Nullable bool `json:"nullable,omitempty"` }
func (*Number) AssignValue ¶
func (*Number) CompareValues ¶
func (*Number) DefaultValue ¶
func (n *Number) DefaultValue() interface{}
func (*Number) GetNullable ¶
func (*Number) MarshalJSON ¶
func (*Number) SetNullable ¶
func (*Number) StringValue ¶
func (*Number) TypeString ¶
func (*Number) UnmarshalJSON ¶
func (*Number) ValidateValue ¶
type Object ¶
type Object struct { Metadata Const map[string]interface{} `json:"const,omitempty"` Default map[string]interface{} `json:"default,omitempty"` DependentRequired map[string][]string `json:"dependentRequired,omitempty"` Enum []map[string]interface{} `json:"enum,omitempty"` // FieldNames will contain the json property name -> field name mapping, if they are different // @ignore FieldNames map[string]string `json:"fieldNames,omitempty"` // ParameterNames will contain the json property name -> parameter name mapping, if they are different // @ignore ParameterNames map[string]string `json:"parameterNames,omitempty"` // JSONPropertyNames will contain the parameter name -> json property name mapping, if they are different // @ignore JSONPropertyNames map[string]string `json:"-"` MinProperties int64 `json:"minProperties,omitempty"` MaxProperties *int64 `json:"maxProperties,omitempty"` // @name "property" Properties map[string]Schema `json:"properties,omitempty"` // Required will contain the required parameter names Required []string `json:"required,omitempty"` }
func (*Object) CompareValues ¶
func (*Object) DefaultValue ¶
func (o *Object) DefaultValue() interface{}
func (*Object) IsPropertyRequired ¶
func (*Object) JSONPropertyName ¶
JSONPropertyName returns the JSON property name for the given parameter name
func (*Object) MarshalJSON ¶
func (*Object) ParameterName ¶
ParameterName returns the parameter name for the given JSON property name
func (*Object) PropertyByParameterName ¶
func (*Object) StringValue ¶
func (*Object) TypeString ¶
func (*Object) UnmarshalJSON ¶
func (*Object) ValidateValue ¶
type Parameters ¶
type Parameters []NamedSchema
func (Parameters) MarshalJSON ¶
func (p Parameters) MarshalJSON() ([]byte, error)
func (*Parameters) UnmarshalJSON ¶
func (p *Parameters) UnmarshalJSON(j []byte) error
type Reference ¶
type Reference struct { Metadata Nullable bool `json:"nullable,omitempty"` // @value // @required Ref string `json:"$ref"` // contains filtered or unexported fields }
func (*Reference) AssignValue ¶
func (*Reference) CompareValues ¶
func (*Reference) DefaultValue ¶
func (r *Reference) DefaultValue() interface{}
func (*Reference) GetNullable ¶
func (*Reference) SetNullable ¶
func (*Reference) StringValue ¶
func (*Reference) TypeString ¶
func (*Reference) ValidateValue ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func (*Registry) RegisterResolver ¶
func (*Registry) RegisterSchema ¶
type ResolverFunc ¶
func (ResolverFunc) ResolveSchema ¶
func (f ResolverFunc) ResolveSchema(uri string) (Schema, error)
type Schema ¶
type Schema interface { AssignValue(imports map[string]string, valueName, resultName string) string CompareValues(a, b interface{}) int Copy() Schema DefaultValue() interface{} GetAnnotation(string) string GetDeprecated() bool GetDescription() string GetExamples() []interface{} GetID() string GetReadOnly() bool GetTitle() string GetWriteOnly() bool GoString(imports map[string]string) string GoType(imports map[string]string) string StringValue(interface{}) string Type() Type TypeString() string ValidateValue(interface{}) (interface{}, error) ValidateSchema(s Schema, compare bool) error }
func BooleanValue ¶
func BooleanValue() Schema
func ByteStreamValue ¶
func ByteStreamValue() Schema
func GetCommonSchema ¶
func GetSchemaForValue ¶
func GetSchemaForValues ¶
func IntegerValue ¶
func IntegerValue() Schema
func NumberValue ¶
func NumberValue() Schema
func ResolveFromFile ¶
func StringValue ¶
func StringValue() Schema
func UnmarshalJSON ¶
func UntypedValue ¶
func UntypedValue() Schema
type SchemaUnmarshaler ¶
type SchemaUnmarshaler struct {
Schema Schema
}
func (*SchemaUnmarshaler) UnmarshalJSON ¶
func (s *SchemaUnmarshaler) UnmarshalJSON(j []byte) error
type String ¶
type String struct { Metadata Const *string `json:"const,omitempty"` Default *string `json:"default,omitempty"` Enum []string `json:"enum,omitempty"` Format string `json:"format,omitempty"` MinLength int64 `json:"minLength,omitempty"` MaxLength *int64 `json:"maxLength,omitempty"` Nullable bool `json:"nullable,omitempty"` Pattern *regexp.Regexp `json:"pattern,omitempty"` }
func (*String) AssignValue ¶
func (*String) CompareValues ¶
func (*String) DefaultValue ¶
func (s *String) DefaultValue() interface{}
func (*String) GetNullable ¶
func (*String) MarshalJSON ¶
func (*String) SetNullable ¶
func (*String) StringValue ¶
func (*String) TypeString ¶
func (*String) UnmarshalJSON ¶
func (*String) ValidateValue ¶
type Type ¶
type Type string
const ( TypeUntyped Type = "" TypeArray Type = "array" TypeByteStream Type = "byte_stream" TypeBoolean Type = "boolean" TypeFalse Type = "false" TypeFunction Type = "function" TypeInteger Type = "integer" TypeMap Type = "map" TypeNull Type = "null" TypeNumber Type = "number" TypeObject Type = "object" TypeReference Type = "reference" TypeString Type = "string" )
type UniqueNonEmptyStringList ¶
type UniqueNonEmptyStringList = []NonEmptyString
@min_items 1 @unique_items
type Untyped ¶
func (*Untyped) AssignValue ¶
func (*Untyped) CompareValues ¶
func (*Untyped) DefaultValue ¶
func (u *Untyped) DefaultValue() interface{}
func (*Untyped) StringValue ¶
func (*Untyped) TypeString ¶
func (*Untyped) ValidateValue ¶
type ValidationError ¶
type ValidationError struct {
Errors []error `json:"errors"`
}
func (*ValidationError) AddError ¶
func (v *ValidationError) AddError(field string, err error)
func (*ValidationError) AddErrorf ¶
func (v *ValidationError) AddErrorf(field, format string, a ...interface{})
func (ValidationError) ErrOrNil ¶
func (v ValidationError) ErrOrNil() error
func (ValidationError) Error ¶
func (v ValidationError) Error() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.