Documentation
¶
Index ¶
- Variables
- func Args(h *HRef) string
- func Params(l *Link) string
- func Parse(t *template.Template) (*template.Template, error)
- func Required(n string, def *Schema) bool
- func SortedKeys(m map[string]*Schema) (keys []string)
- func Values(n string, s *Schema, l *Link) string
- type HRef
- type Link
- type Reference
- type Schema
Constants ¶
This section is empty.
Variables ¶
View Source
var Helpers = template.FuncMap{ "AsComment": stringext.AsComment, "JSONTag": stringext.JSONTag, "Params": Params, "Args": Args, "Values": Values, "goType": goType, "GenerateValidator": generateValidator, "ToLowerFirst": stringext.ToLowerFirst, "ToUpperFirst": stringext.ToUpperFirst, "DepunctWithInitialUpper": stringext.DepunctWithInitialUpper, "DepunctWithInitialLower": stringext.DepunctWithInitialLower, }
View Source
var NewLinesRegex = regexp.MustCompile(`(?m:\s*$)`)
Functions ¶
func SortedKeys ¶
Types ¶
type HRef ¶
type HRef struct { Order []string Schemas map[string]*Schema // contains filtered or unexported fields }
HRef represents a Link href.
func (*HRef) MarshalJSON ¶
MarshalJSON returns *h as the JSON encoding of h.
func (*HRef) UnmarshalJSON ¶
UnmarshalJSON sets *h to a copy of data.
type Link ¶
type Link struct { Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` HRef *HRef `json:"href,omitempty"` Rel string `json:"rel,omitempty"` Method string `json:"method,omitempty"` Schema *Schema `json:"schema,omitempty"` }
Link represents a Link description.
func (*Link) Parameters ¶
Parameters returns function parameters names and types.
type Schema ¶
type Schema struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Version string `json:"version,omitempty"` Default interface{} `json:"default,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` Example interface{} `json:"example,omitempty"` Format string `json:"format,omitempty"` Type interface{} `json:"type,omitempty"` Ref *Reference `json:"$ref,omitempty"` Schema *Reference `json:"$schema,omitempty"` Definitions map[string]*Schema `json:"definitions,omitempty"` // Numbers MultipleOf float64 `json:"multipleOf,omitempty"` Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` // Strings MinLength int `json:"minLength,omitempty"` MaxLength int `json:"maxLength,omitempty"` Pattern string `json:"pattern,omitempty"` // Objects MinProperties int `json:"minProperties,omitempty"` MaxProperties int `json:"maxProperties,omitempty"` Required []string `json:"required,omitempty"` Properties map[string]*Schema `json:"properties,omitempty"` Dependencies map[string]interface{} `json:"dependencies,omitempty"` AdditionalProperties interface{} `json:"additionalProperties,omitempty"` PatternProperties map[string]*Schema `json:"patternProperties,omitempty"` // Arrays Items *Schema `json:"items,omitempty"` MinItems int `json:"minItems,omitempty"` MaxItems int `json:"maxItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` AdditionalItems interface{} `json:"additionalItems,omitempty"` // All Enum []string `json:"enum,omitempty"` // Schemas OneOf []Schema `json:"oneOf,omitempty"` AnyOf []Schema `json:"anyOf,omitempty"` AllOf []Schema `json:"allOf,omitempty"` Not *Schema `json:"not,omitempty"` // Links Links []Link `json:"links,omitempty"` }
Schema represents a JSON Schema.
func (*Schema) IsCustomType ¶
IsCustomType returns true if the schema declares a custom type.
Click to show internal directories.
Click to hide internal directories.