-
Notifications
You must be signed in to change notification settings - Fork 33
/
schema.go
74 lines (61 loc) · 2.68 KB
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package schematic
// Schema represents a JSON 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"`
}
// Link represents a Link description.
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"`
TargetSchema *Schema `json:"targetSchema,omitempty"`
MediaType string `json:"mediaType,omitempty"`
EncType string `json:"encType,omitempty"`
}