1 | import { ObjectElement } from '@swagger-api/apidom-core';
|
---|
2 | class JSONSchema extends ObjectElement {
|
---|
3 | constructor(content, meta, attributes) {
|
---|
4 | super(content, meta, attributes);
|
---|
5 | this.element = 'JSONSchemaDraft4';
|
---|
6 | }
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Core vocabulary
|
---|
10 | *
|
---|
11 | * URI: https://tools.ietf.org/html/draft-wright-json-schema-00
|
---|
12 | */
|
---|
13 |
|
---|
14 | get idProp() {
|
---|
15 | return this.get('id');
|
---|
16 | }
|
---|
17 | set idProp(idProp) {
|
---|
18 | this.set('id', idProp);
|
---|
19 | }
|
---|
20 | get $schema() {
|
---|
21 | return this.get('$schema');
|
---|
22 | }
|
---|
23 | set $schema($schema) {
|
---|
24 | this.set('$schema', $schema);
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Validation vocabulary
|
---|
29 | *
|
---|
30 | * URI: https://tools.ietf.org/html/draft-wright-json-schema-validation-00
|
---|
31 | */
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Validation keywords for numeric instances (number and integer)
|
---|
35 | */
|
---|
36 |
|
---|
37 | get multipleOf() {
|
---|
38 | return this.get('multipleOf');
|
---|
39 | }
|
---|
40 | set multipleOf(multipleOf) {
|
---|
41 | this.set('multipleOf', multipleOf);
|
---|
42 | }
|
---|
43 | get maximum() {
|
---|
44 | return this.get('maximum');
|
---|
45 | }
|
---|
46 | set maximum(maximum) {
|
---|
47 | this.set('maximum', maximum);
|
---|
48 | }
|
---|
49 | get exclusiveMaximum() {
|
---|
50 | return this.get('exclusiveMaximum');
|
---|
51 | }
|
---|
52 | set exclusiveMaximum(exclusiveMaximum) {
|
---|
53 | this.set('exclusiveMaximum', exclusiveMaximum);
|
---|
54 | }
|
---|
55 | get minimum() {
|
---|
56 | return this.get('minimum');
|
---|
57 | }
|
---|
58 | set minimum(minimum) {
|
---|
59 | this.set('minimum', minimum);
|
---|
60 | }
|
---|
61 | get exclusiveMinimum() {
|
---|
62 | return this.get('exclusiveMinimum');
|
---|
63 | }
|
---|
64 | set exclusiveMinimum(exclusiveMinimum) {
|
---|
65 | this.set('exclusiveMinimum', exclusiveMinimum);
|
---|
66 | }
|
---|
67 |
|
---|
68 | /**
|
---|
69 | * Validation keywords for strings
|
---|
70 | */
|
---|
71 |
|
---|
72 | get maxLength() {
|
---|
73 | return this.get('maxLength');
|
---|
74 | }
|
---|
75 | set maxLength(maxLength) {
|
---|
76 | this.set('maxLength', maxLength);
|
---|
77 | }
|
---|
78 | get minLength() {
|
---|
79 | return this.get('minLength');
|
---|
80 | }
|
---|
81 | set minLength(minLength) {
|
---|
82 | this.set('minLength', minLength);
|
---|
83 | }
|
---|
84 | get pattern() {
|
---|
85 | return this.get('pattern');
|
---|
86 | }
|
---|
87 | set pattern(pattern) {
|
---|
88 | this.set('pattern', pattern);
|
---|
89 | }
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Validation keywords for arrays
|
---|
93 | */
|
---|
94 |
|
---|
95 | get additionalItems() {
|
---|
96 | return this.get('additionalItems');
|
---|
97 | }
|
---|
98 | set additionalItems(additionalItems) {
|
---|
99 | this.set('additionalItems', additionalItems);
|
---|
100 | }
|
---|
101 | get items() {
|
---|
102 | return this.get('items');
|
---|
103 | }
|
---|
104 | set items(items) {
|
---|
105 | this.set('items', items);
|
---|
106 | }
|
---|
107 | get maxItems() {
|
---|
108 | return this.get('maxItems');
|
---|
109 | }
|
---|
110 | set maxItems(maxItems) {
|
---|
111 | this.set('maxItems', maxItems);
|
---|
112 | }
|
---|
113 | get minItems() {
|
---|
114 | return this.get('minItems');
|
---|
115 | }
|
---|
116 | set minItems(minItems) {
|
---|
117 | this.set('minItems', minItems);
|
---|
118 | }
|
---|
119 | get uniqueItems() {
|
---|
120 | return this.get('uniqueItems');
|
---|
121 | }
|
---|
122 | set uniqueItems(uniqueItems) {
|
---|
123 | this.set('uniqueItems', uniqueItems);
|
---|
124 | }
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Validation keywords for objects
|
---|
128 | */
|
---|
129 |
|
---|
130 | get maxProperties() {
|
---|
131 | return this.get('maxProperties');
|
---|
132 | }
|
---|
133 | set maxProperties(maxProperties) {
|
---|
134 | this.set('maxProperties', maxProperties);
|
---|
135 | }
|
---|
136 | get minProperties() {
|
---|
137 | return this.get('minProperties');
|
---|
138 | }
|
---|
139 | set minProperties(minProperties) {
|
---|
140 | this.set('minProperties', minProperties);
|
---|
141 | }
|
---|
142 | get required() {
|
---|
143 | return this.get('required');
|
---|
144 | }
|
---|
145 | set required(required) {
|
---|
146 | this.set('required', required);
|
---|
147 | }
|
---|
148 | get properties() {
|
---|
149 | return this.get('properties');
|
---|
150 | }
|
---|
151 | set properties(properties) {
|
---|
152 | this.set('properties', properties);
|
---|
153 | }
|
---|
154 | get additionalProperties() {
|
---|
155 | return this.get('additionalProperties');
|
---|
156 | }
|
---|
157 | set additionalProperties(additionalProperties) {
|
---|
158 | this.set('additionalProperties', additionalProperties);
|
---|
159 | }
|
---|
160 | get patternProperties() {
|
---|
161 | return this.get('patternProperties');
|
---|
162 | }
|
---|
163 | set patternProperties(patternProperties) {
|
---|
164 | this.set('patternProperties', patternProperties);
|
---|
165 | }
|
---|
166 | get dependencies() {
|
---|
167 | return this.get('dependencies');
|
---|
168 | }
|
---|
169 | set dependencies(dependencies) {
|
---|
170 | this.set('dependencies', dependencies);
|
---|
171 | }
|
---|
172 |
|
---|
173 | /**
|
---|
174 | * Validation keywords for any instance type
|
---|
175 | */
|
---|
176 |
|
---|
177 | get enum() {
|
---|
178 | return this.get('enum');
|
---|
179 | }
|
---|
180 | set enum(enumValue) {
|
---|
181 | this.set('enum', enumValue);
|
---|
182 | }
|
---|
183 | get type() {
|
---|
184 | return this.get('type');
|
---|
185 | }
|
---|
186 | set type(type) {
|
---|
187 | this.set('type', type);
|
---|
188 | }
|
---|
189 | get allOf() {
|
---|
190 | return this.get('allOf');
|
---|
191 | }
|
---|
192 | set allOf(allOf) {
|
---|
193 | this.set('allOf', allOf);
|
---|
194 | }
|
---|
195 | get anyOf() {
|
---|
196 | return this.get('anyOf');
|
---|
197 | }
|
---|
198 | set anyOf(anyOf) {
|
---|
199 | this.set('anyOf', anyOf);
|
---|
200 | }
|
---|
201 | get oneOf() {
|
---|
202 | return this.get('oneOf');
|
---|
203 | }
|
---|
204 | set oneOf(oneOf) {
|
---|
205 | this.set('oneOf', oneOf);
|
---|
206 | }
|
---|
207 | get not() {
|
---|
208 | return this.get('not');
|
---|
209 | }
|
---|
210 | set not(not) {
|
---|
211 | this.set('not', not);
|
---|
212 | }
|
---|
213 | get definitions() {
|
---|
214 | return this.get('definitions');
|
---|
215 | }
|
---|
216 | set definitions(definitions) {
|
---|
217 | this.set('definitions', definitions);
|
---|
218 | }
|
---|
219 |
|
---|
220 | /**
|
---|
221 | * Metadata keywords
|
---|
222 | *
|
---|
223 | * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-6
|
---|
224 | */
|
---|
225 |
|
---|
226 | get title() {
|
---|
227 | return this.get('title');
|
---|
228 | }
|
---|
229 | set title(title) {
|
---|
230 | this.set('title', title);
|
---|
231 | }
|
---|
232 | get description() {
|
---|
233 | return this.get('description');
|
---|
234 | }
|
---|
235 | set description(description) {
|
---|
236 | this.set('description', description);
|
---|
237 | }
|
---|
238 | get default() {
|
---|
239 | return this.get('default');
|
---|
240 | }
|
---|
241 | set default(defaultValue) {
|
---|
242 | this.set('default', defaultValue);
|
---|
243 | }
|
---|
244 |
|
---|
245 | /**
|
---|
246 | * Semantic validation with "format"
|
---|
247 | *
|
---|
248 | * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00#section-7
|
---|
249 | */
|
---|
250 |
|
---|
251 | get format() {
|
---|
252 | return this.get('format');
|
---|
253 | }
|
---|
254 | set format(format) {
|
---|
255 | this.set('format', format);
|
---|
256 | }
|
---|
257 |
|
---|
258 | /**
|
---|
259 | * JSON Hyper-Schema
|
---|
260 | *
|
---|
261 | * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-00
|
---|
262 | */
|
---|
263 |
|
---|
264 | get base() {
|
---|
265 | return this.get('base');
|
---|
266 | }
|
---|
267 | set base(base) {
|
---|
268 | this.set('base', base);
|
---|
269 | }
|
---|
270 | get links() {
|
---|
271 | return this.get('links');
|
---|
272 | }
|
---|
273 | set links(links) {
|
---|
274 | this.set('links', links);
|
---|
275 | }
|
---|
276 | get media() {
|
---|
277 | return this.get('media');
|
---|
278 | }
|
---|
279 | set media(media) {
|
---|
280 | this.set('media', media);
|
---|
281 | }
|
---|
282 | get readOnly() {
|
---|
283 | return this.get('readOnly');
|
---|
284 | }
|
---|
285 | set readOnly(readOnly) {
|
---|
286 | this.set('readOnly', readOnly);
|
---|
287 | }
|
---|
288 | }
|
---|
289 | export default JSONSchema; |
---|