Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildJsonschema ¶
BuildJsonschema reflects to Schema from a value using the default Reflector
Types ¶
type DefaultRender ¶
type Definitions ¶
type Reflector ¶
type Reflector struct {
// RequiredFromJSONSchemaTags will cause the Reflector to generate a schema
// that requires any key tagged with `jsonschema:required`, overriding the
// default of requiring any key *not* tagged with `json:,omitempty`.
RequiredFromJSONSchemaTags bool
// KeyNamer allows customizing of key names.
// The default is to use the key's name as is, or the json tag if present.
// If a json tag is present, KeyNamer will receive the tag's name as an argument, not the original key name.
KeyNamer func(string) string
}
A Reflector reflects values into a Schema.
type Schema ¶
type Schema struct {
Definitions Definitions `json:"$defs,omitempty"`
OneOf []*Schema `json:"oneOf,omitempty"`
Items *Schema `json:"items,omitempty"`
Properties *orderedmap.OrderedMap `json:"properties,omitempty"`
PatternProperties map[string]*Schema `json:"patternProperties,omitempty"`
Type string `json:"type,omitempty"`
Required []string `json:"required,omitempty"`
Format string `json:"format,omitempty"`
ContentEncoding string `json:"contentEncoding,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
}
func ReflectFromType ¶
ReflectFromType generates root schema using the default Reflector
Click to show internal directories.
Click to hide internal directories.