...
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 package gojsonschema
28
29 import (
30 "github.com/xeipuuv/gojsonreference"
31 "math/big"
32 "regexp"
33 )
34
35
36 const (
37 KEY_SCHEMA = "$schema"
38 KEY_ID = "id"
39 KEY_ID_NEW = "$id"
40 KEY_REF = "$ref"
41 KEY_TITLE = "title"
42 KEY_DESCRIPTION = "description"
43 KEY_TYPE = "type"
44 KEY_ITEMS = "items"
45 KEY_ADDITIONAL_ITEMS = "additionalItems"
46 KEY_PROPERTIES = "properties"
47 KEY_PATTERN_PROPERTIES = "patternProperties"
48 KEY_ADDITIONAL_PROPERTIES = "additionalProperties"
49 KEY_PROPERTY_NAMES = "propertyNames"
50 KEY_DEFINITIONS = "definitions"
51 KEY_MULTIPLE_OF = "multipleOf"
52 KEY_MINIMUM = "minimum"
53 KEY_MAXIMUM = "maximum"
54 KEY_EXCLUSIVE_MINIMUM = "exclusiveMinimum"
55 KEY_EXCLUSIVE_MAXIMUM = "exclusiveMaximum"
56 KEY_MIN_LENGTH = "minLength"
57 KEY_MAX_LENGTH = "maxLength"
58 KEY_PATTERN = "pattern"
59 KEY_FORMAT = "format"
60 KEY_MIN_PROPERTIES = "minProperties"
61 KEY_MAX_PROPERTIES = "maxProperties"
62 KEY_DEPENDENCIES = "dependencies"
63 KEY_REQUIRED = "required"
64 KEY_MIN_ITEMS = "minItems"
65 KEY_MAX_ITEMS = "maxItems"
66 KEY_UNIQUE_ITEMS = "uniqueItems"
67 KEY_CONTAINS = "contains"
68 KEY_CONST = "const"
69 KEY_ENUM = "enum"
70 KEY_ONE_OF = "oneOf"
71 KEY_ANY_OF = "anyOf"
72 KEY_ALL_OF = "allOf"
73 KEY_NOT = "not"
74 KEY_IF = "if"
75 KEY_THEN = "then"
76 KEY_ELSE = "else"
77 )
78
79 type subSchema struct {
80 draft *Draft
81
82
83 id *gojsonreference.JsonReference
84 title *string
85 description *string
86
87 property string
88
89
90 pass *bool
91
92
93 types jsonSchemaType
94
95
96 ref *gojsonreference.JsonReference
97
98 refSchema *subSchema
99
100
101 parent *subSchema
102 itemsChildren []*subSchema
103 itemsChildrenIsSingleSchema bool
104 propertiesChildren []*subSchema
105
106
107 multipleOf *big.Rat
108 maximum *big.Rat
109 exclusiveMaximum *big.Rat
110 minimum *big.Rat
111 exclusiveMinimum *big.Rat
112
113
114 minLength *int
115 maxLength *int
116 pattern *regexp.Regexp
117 format string
118
119
120 minProperties *int
121 maxProperties *int
122 required []string
123
124 dependencies map[string]interface{}
125 additionalProperties interface{}
126 patternProperties map[string]*subSchema
127 propertyNames *subSchema
128
129
130 minItems *int
131 maxItems *int
132 uniqueItems bool
133 contains *subSchema
134
135 additionalItems interface{}
136
137
138 _const *string
139 enum []string
140
141
142 oneOf []*subSchema
143 anyOf []*subSchema
144 allOf []*subSchema
145 not *subSchema
146 _if *subSchema
147 _then *subSchema
148 _else *subSchema
149 }
150
View as plain text