Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineErrors ¶
func ItemNameFromArray ¶
func ItemNameFromArray(array arrayType) string
ItemNameFromArray computes the supposed item name of an array
*by removing the plural 's' of the array name
func ValidateInterface ¶
func ValidateInterface(i interfaceType) error
func ValidateStruct ¶
func ValidateStruct(s structType) error
Types ¶
type BasicString ¶
type BasicString string
type Reflector ¶
type Reflector struct {
// Use package paths as well as type names, to avoid conflicts.
// Without this setting, if two packages contain a type with the same name,
// and both are present in a schema, they will conflict and overwrite in
// the definition map and produce bad output. This is particularly
// noticeable when using DoNotReference.
FullyQualifyTypeNames bool
}
A Reflector reflects values into a Schema.
type Schema ¶
type Schema struct {
*Type
Definitions Definitions
}
Schema is the root schema.
func ReflectFromType ¶
ReflectFromType generates root schema using the default Reflector
type Type ¶
type Type struct {
//Contained in all types
Ref string `json:"$ref,omitempty"`
Type string `json:"type,omitempty"`
Definitions Definitions `json:"definitions,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Properties *orderedmap.OrderedMap `json:"children,omitempty"`
Classes []string `json:"classes,omitempty"`
Extras map[string]interface{} `json:"-"`
//exclusive for structs
Required []string `json:"required,omitempty"`
InteractionText string `json:"interactionText,omitempty"`
//exclusive for enums
Enum []string `json:"enum,omitempty"`
//exclusive for strings
Pattern string `json:"pattern,omitempty"`
//exclusive for ints, strings, arrays
Max int64 `json:"max,omitempty"`
Min int64 `json:"min,omitempty"`
}
Type represents a JSON Schema object type.
func (*Type) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.

