@@ -58,101 +58,96 @@ func init() {
58
58
59
59
const numPhases = 5
60
60
61
- var constraints = []* constraint {
62
- todo ("$anchor" , vfrom (VersionDraft2019_09 )),
63
- p2d ("$comment" , constraintComment , vfrom (VersionDraft7 )),
64
- p2 ("$defs" , constraintAddDefinitions ),
65
- todo ("$dynamicAnchor" , vfrom (VersionDraft2020_12 )),
66
- todo ("$dynamicRef" , vfrom (VersionDraft2020_12 )),
67
- p1d ("$id" , constraintID , vfrom (VersionDraft6 )),
68
- todo ("$recursiveAnchor" , vbetween (VersionDraft2019_09 , VersionDraft2020_12 )),
69
- todo ("$recursiveRef" , vbetween (VersionDraft2019_09 , VersionDraft2020_12 )),
70
- p2 ("$ref" , constraintRef ),
71
- p0 ("$schema" , constraintSchema ),
72
- todo ("$vocabulary" , vfrom (VersionDraft2019_09 )),
73
- p2d ("additionalItems" , constraintAdditionalItems , vto (VersionDraft2019_09 )),
74
- p4 ("additionalProperties" , constraintAdditionalProperties ),
75
- p3 ("allOf" , constraintAllOf ),
76
- p3 ("anyOf" , constraintAnyOf ),
77
- p2d ("const" , constraintConst , vfrom (VersionDraft6 )),
78
- p2d ("contains" , constraintContains , vfrom (VersionDraft6 )),
79
- p2d ("contentEncoding" , constraintContentEncoding , vfrom (VersionDraft7 )),
80
- p2d ("contentMediaType" , constraintContentMediaType , vfrom (VersionDraft7 )),
81
- todo ("contentSchema" , vfrom (VersionDraft2019_09 )),
82
- p2 ("default" , constraintDefault ),
83
- p2 ("definitions" , constraintAddDefinitions ),
84
- p2 ("dependencies" , constraintDependencies ),
85
- todo ("dependentRequired" , vfrom (VersionDraft2019_09 )),
86
- todo ("dependentSchemas" , vfrom (VersionDraft2019_09 )),
87
- p2 ("deprecated" , constraintDeprecated ),
88
- p2 ("description" , constraintDescription ),
89
- todo ("else" , vfrom (VersionDraft7 )),
90
- p2 ("enum" , constraintEnum ),
91
- p2d ("examples" , constraintExamples , vfrom (VersionDraft6 )),
92
- p2 ("exclusiveMaximum" , constraintExclusiveMaximum ),
93
- p2 ("exclusiveMinimum" , constraintExclusiveMinimum ),
94
- todo ("format" , allVersions ),
95
- p1d ("id" , constraintID , vto (VersionDraft4 )),
96
- todo ("if" , vfrom (VersionDraft7 )),
97
- p2 ("items" , constraintItems ),
98
- p1d ("maxContains" , constraintMaxContains , vfrom (VersionDraft2019_09 )),
99
- p2 ("maxItems" , constraintMaxItems ),
100
- p2 ("maxLength" , constraintMaxLength ),
101
- p2 ("maxProperties" , constraintMaxProperties ),
102
- p3 ("maximum" , constraintMaximum ),
103
- p1d ("minContains" , constraintMinContains , vfrom (VersionDraft2019_09 )),
104
- p2 ("minItems" , constraintMinItems ),
105
- p2 ("minLength" , constraintMinLength ),
106
- todo ("minProperties" , allVersions ),
107
- p3 ("minimum" , constraintMinimum ),
108
- p2 ("multipleOf" , constraintMultipleOf ),
109
- p3 ("not" , constraintNot ),
110
- p2 ("nullable" , constraintNullable ),
111
- p3 ("oneOf" , constraintOneOf ),
112
- p2 ("pattern" , constraintPattern ),
113
- p3 ("patternProperties" , constraintPatternProperties ),
114
- todo ("prefixItems" , vfrom (VersionDraft2020_12 )),
115
- p2 ("properties" , constraintProperties ),
116
- p2d ("propertyNames" , constraintPropertyNames , vfrom (VersionDraft6 )),
117
- todo ("readOnly" , vfrom (VersionDraft7 )),
118
- p3 ("required" , constraintRequired ),
119
- todo ("then" , vfrom (VersionDraft7 )),
120
- p2 ("title" , constraintTitle ),
121
- p2 ("type" , constraintType ),
122
- todo ("unevaluatedItems" , vfrom (VersionDraft2019_09 )),
123
- todo ("unevaluatedProperties" , vfrom (VersionDraft2019_09 )),
124
- p2 ("uniqueItems" , constraintUniqueItems ),
125
- todo ("writeOnly" , vfrom (VersionDraft7 )),
126
- }
127
-
128
- func todo (name string , versions versionSet ) * constraint {
129
- return & constraint {key : name , phase : 1 , versions : versions , fn : constraintTODO }
130
- }
131
-
132
- func p0 (name string , f constraintFunc ) * constraint {
133
- return & constraint {key : name , phase : 0 , versions : allVersions , fn : f }
134
- }
61
+ // Note: OpenAPI is excluded from version sets by default, as it does not fit in
62
+ // the linear progression of the rest of the JSON Schema versions.
135
63
136
- func p1 (name string , f constraintFunc ) * constraint {
137
- return & constraint {key : name , phase : 1 , versions : allVersions , fn : f }
64
+ var constraints = []* constraint {
65
+ p1 ("$anchor" , constraintTODO , vfrom (VersionDraft2019_09 )),
66
+ p2 ("$comment" , constraintComment , vfrom (VersionDraft7 )),
67
+ p2 ("$defs" , constraintAddDefinitions , allVersions ),
68
+ p1 ("$dynamicAnchor" , constraintTODO , vfrom (VersionDraft2020_12 )),
69
+ p1 ("$dynamicRef" , constraintTODO , vfrom (VersionDraft2020_12 )),
70
+ p1 ("$id" , constraintID , vfrom (VersionDraft6 )),
71
+ p1 ("$recursiveAnchor" , constraintTODO , vbetween (VersionDraft2019_09 , VersionDraft2020_12 )),
72
+ p1 ("$recursiveRef" , constraintTODO , vbetween (VersionDraft2019_09 , VersionDraft2020_12 )),
73
+ p2 ("$ref" , constraintRef , allVersions | openAPI ),
74
+ p0 ("$schema" , constraintSchema , allVersions ),
75
+ p1 ("$vocabulary" , constraintTODO , vfrom (VersionDraft2019_09 )),
76
+ p2 ("additionalItems" , constraintAdditionalItems , vto (VersionDraft2019_09 )),
77
+ p4 ("additionalProperties" , constraintAdditionalProperties , allVersions | openAPI ),
78
+ p3 ("allOf" , constraintAllOf , allVersions | openAPI ),
79
+ p3 ("anyOf" , constraintAnyOf , allVersions | openAPI ),
80
+ p2 ("const" , constraintConst , vfrom (VersionDraft6 )),
81
+ p2 ("contains" , constraintContains , vfrom (VersionDraft6 )),
82
+ p2 ("contentEncoding" , constraintContentEncoding , vfrom (VersionDraft7 )),
83
+ p2 ("contentMediaType" , constraintContentMediaType , vfrom (VersionDraft7 )),
84
+ p1 ("contentSchema" , constraintTODO , vfrom (VersionDraft2019_09 )),
85
+ p2 ("default" , constraintDefault , allVersions | openAPI ),
86
+ p2 ("definitions" , constraintAddDefinitions , allVersions ),
87
+ p2 ("dependencies" , constraintDependencies , allVersions ),
88
+ p1 ("dependentRequired" , constraintTODO , vfrom (VersionDraft2019_09 )),
89
+ p1 ("dependentSchemas" , constraintTODO , vfrom (VersionDraft2019_09 )),
90
+ p2 ("deprecated" , constraintDeprecated , vfrom (VersionDraft2019_09 )| openAPI ),
91
+ p2 ("description" , constraintDescription , allVersions | openAPI ),
92
+ p1 ("discriminator" , constraintTODO , vset (VersionOpenAPI )),
93
+ p1 ("else" , constraintTODO , vfrom (VersionDraft7 )),
94
+ p2 ("enum" , constraintEnum , allVersions | openAPI ),
95
+ p1 ("example" , constraintTODO , vset (VersionOpenAPI )),
96
+ p2 ("examples" , constraintExamples , vfrom (VersionDraft6 )),
97
+ p2 ("exclusiveMaximum" , constraintExclusiveMaximum , allVersions | openAPI ),
98
+ p2 ("exclusiveMinimum" , constraintExclusiveMinimum , allVersions | openAPI ),
99
+ p1 ("externalDocs" , constraintTODO , vset (VersionOpenAPI )),
100
+ p1 ("format" , constraintTODO , allVersions | openAPI ),
101
+ p1 ("id" , constraintID , vto (VersionDraft4 )),
102
+ p1 ("if" , constraintTODO , vfrom (VersionDraft7 )),
103
+ p2 ("items" , constraintItems , allVersions | openAPI ),
104
+ p1 ("maxContains" , constraintMaxContains , vfrom (VersionDraft2019_09 )),
105
+ p2 ("maxItems" , constraintMaxItems , allVersions | openAPI ),
106
+ p2 ("maxLength" , constraintMaxLength , allVersions | openAPI ),
107
+ p2 ("maxProperties" , constraintMaxProperties , allVersions | openAPI ),
108
+ p3 ("maximum" , constraintMaximum , allVersions | openAPI ),
109
+ p1 ("minContains" , constraintMinContains , vfrom (VersionDraft2019_09 )),
110
+ p2 ("minItems" , constraintMinItems , allVersions | openAPI ),
111
+ p2 ("minLength" , constraintMinLength , allVersions | openAPI ),
112
+ p1 ("minProperties" , constraintTODO , allVersions | openAPI ),
113
+ p3 ("minimum" , constraintMinimum , allVersions | openAPI ),
114
+ p2 ("multipleOf" , constraintMultipleOf , allVersions | openAPI ),
115
+ p3 ("not" , constraintNot , allVersions | openAPI ),
116
+ p2 ("nullable" , constraintNullable , vset (VersionOpenAPI )),
117
+ p3 ("oneOf" , constraintOneOf , allVersions | openAPI ),
118
+ p2 ("pattern" , constraintPattern , allVersions | openAPI ),
119
+ p3 ("patternProperties" , constraintPatternProperties , allVersions ),
120
+ p1 ("prefixItems" , constraintTODO , vfrom (VersionDraft2020_12 )),
121
+ p2 ("properties" , constraintProperties , allVersions | openAPI ),
122
+ p2 ("propertyNames" , constraintPropertyNames , vfrom (VersionDraft6 )),
123
+ p1 ("readOnly" , constraintTODO , vfrom (VersionDraft7 )| openAPI ),
124
+ p3 ("required" , constraintRequired , allVersions | openAPI ),
125
+ p1 ("then" , constraintTODO , vfrom (VersionDraft7 )),
126
+ p2 ("title" , constraintTitle , allVersions | openAPI ),
127
+ p2 ("type" , constraintType , allVersions | openAPI ),
128
+ p1 ("unevaluatedItems" , constraintTODO , vfrom (VersionDraft2019_09 )),
129
+ p1 ("unevaluatedProperties" , constraintTODO , vfrom (VersionDraft2019_09 )),
130
+ p2 ("uniqueItems" , constraintUniqueItems , allVersions | openAPI ),
131
+ p1 ("writeOnly" , constraintTODO , vfrom (VersionDraft7 )| openAPI ),
132
+ p1 ("xml" , constraintTODO , vset (VersionOpenAPI )),
138
133
}
139
134
140
- func p2 (name string , f constraintFunc ) * constraint {
141
- return & constraint {key : name , phase : 2 , versions : allVersions , fn : f }
135
+ func p0 (name string , f constraintFunc , versions versionSet ) * constraint {
136
+ return & constraint {key : name , phase : 0 , versions : versions , fn : f }
142
137
}
143
138
144
- func p3 (name string , f constraintFunc ) * constraint {
145
- return & constraint {key : name , phase : 3 , versions : allVersions , fn : f }
139
+ func p1 (name string , f constraintFunc , versions versionSet ) * constraint {
140
+ return & constraint {key : name , phase : 1 , versions : versions , fn : f }
146
141
}
147
142
148
- func p4 (name string , f constraintFunc ) * constraint {
149
- return & constraint {key : name , phase : 4 , versions : allVersions , fn : f }
143
+ func p2 (name string , f constraintFunc , versions versionSet ) * constraint {
144
+ return & constraint {key : name , phase : 2 , versions : versions , fn : f }
150
145
}
151
146
152
- func p1d (name string , f constraintFunc , versions versionSet ) * constraint {
153
- return & constraint {key : name , phase : 1 , versions : versions , fn : f }
147
+ func p3 (name string , f constraintFunc , versions versionSet ) * constraint {
148
+ return & constraint {key : name , phase : 3 , versions : versions , fn : f }
154
149
}
155
150
156
- func p2d (name string , f constraintFunc , versions versionSet ) * constraint {
157
- return & constraint {key : name , phase : 2 , versions : versions , fn : f }
151
+ func p4 (name string , f constraintFunc , versions versionSet ) * constraint {
152
+ return & constraint {key : name , phase : 4 , versions : versions , fn : f }
158
153
}
0 commit comments