Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
Description string `json:"description,omitempty"`
MinItems int `json:"minItems,omitempty"`
MaxItems int `json:"maxItems,omitempty"`
Items Schema `json:"items"`
}
Array is a JSON schema array.
func (Array) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type Boolean ¶
type Boolean struct {
Description string `json:"description,omitempty"`
}
Boolean is a JSON schema boolean.
func (Boolean) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type Const ¶
Const is a JSON schema const.
func (Const) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type Integer ¶
type Integer struct {
Description string `json:"description,omitempty"`
Minimum *int64 `json:"minimum,omitempty,omitzero"`
Maximum *int64 `json:"maximum,omitempty,omitzero"`
ExclusiveMinimum *int64 `json:"exclusiveMinimum,omitempty,omitzero"`
ExclusiveMaximum *int64 `json:"exclusiveMaximum,omitempty,omitzero"`
}
Integer is a JSON schema for an integer.
func (Integer) MarshalJSON ¶
type Map ¶
type Map struct {
Description string `json:"description,omitempty"`
AdditionalProperties Schema `json:"additionalProperties"`
}
Map is a JSON schema object that maps keys to values.
The additionalProperties field is a JSON schema that will be used to validate the values of the map.
func (Map) MarshalJSON ¶
type Null ¶
type Null struct {
Description string `json:"description,omitempty"`
}
Null is a JSON schema null.
func (Null) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type Number ¶
type Number struct {
Description string `json:"description,omitempty"`
Minimum *float64 `json:"minimum,omitempty,omitzero"`
Maximum *float64 `json:"maximum,omitempty,omitzero"`
ExclusiveMinimum *float64 `json:"exclusiveMinimum,omitempty,omitzero"`
ExclusiveMaximum *float64 `json:"exclusiveMaximum,omitempty,omitzero"`
}
Number is a JSON schema for a number.
func (Number) MarshalJSON ¶
type Object ¶
type Object struct {
Description string `json:"description,omitempty"`
Properties map[string]Schema `json:"properties"`
Required []string `json:"required,omitempty,omitzero"`
}
Object is a JSON schema object.
func FromStruct ¶
FromStruct generates a JSON schema Object from a struct type
func FromStructType ¶ added in v0.0.6
func (Object) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
type Schema ¶
type Schema interface {
SchemaValidator
json.Marshaler
}
type SchemaTag ¶
SchemaTag represents the struct tag for JSON schema configuration
func ParseSchemaTag ¶
ParseSchemaTag parses the jsonschema tag and returns SchemaTag
type SchemaValidator ¶
type SchemaValidator interface {
Validate(v json.RawMessage) error
// contains filtered or unexported methods
}