@speclynx/apidom-ns-json-schema-2020-12 1.12.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,83 +5,57 @@ import { $refVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
5
5
  import { $vocabularyVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
6
6
  import { $vocabularyVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
7
7
  import { AllOfVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
8
- import { AllOfVisitor as AllOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
9
8
  import { AllOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
10
9
  import { AlternatingVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
11
10
  import { AlternatingVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
12
11
  import { AnyOfVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
13
- import { AnyOfVisitor as AnyOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
14
12
  import { AnyOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
15
- import { ArrayElement } from '@speclynx/apidom-core';
16
- import { Attributes } from '@speclynx/apidom-core';
17
- import { BooleanElement } from '@speclynx/apidom-core';
18
- import { Class } from 'ts-mixer/dist/types/types.js';
19
- import { DefinitionsVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
20
- import { DependenciesVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
13
+ import { ArrayElement } from '@speclynx/apidom-datamodel';
14
+ import { Attributes } from '@speclynx/apidom-datamodel';
15
+ import { BaseSchemaArrayVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
16
+ import { BaseSchemaArrayVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
17
+ import { BaseSchemaMapVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
18
+ import { BaseSchemaMapVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
19
+ import { BooleanElement } from '@speclynx/apidom-datamodel';
21
20
  import { DependentRequiredVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
22
21
  import { DependentRequiredVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
23
22
  import { DependentSchemasVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
24
23
  import { DependentSchemasVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
25
- import { Element as Element_2 } from '@speclynx/apidom-core';
26
- import { ElementPredicate } from '@speclynx/apidom-core';
27
- import { EnumVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
24
+ import { Element as Element_2 } from '@speclynx/apidom-datamodel';
28
25
  import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
29
- import { FallbackVisitor as FallbackVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
30
26
  import { FallbackVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
31
27
  import { FixedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
32
28
  import { FixedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
33
- import { isArrayElement } from '@speclynx/apidom-core';
34
- import { isBooleanElement } from '@speclynx/apidom-core';
35
- import { isElement } from '@speclynx/apidom-core';
36
- import { isLinkElement } from '@speclynx/apidom-core';
37
- import { isMemberElement } from '@speclynx/apidom-core';
38
- import { isNullElement } from '@speclynx/apidom-core';
39
- import { isNumberElement } from '@speclynx/apidom-core';
40
- import { isObjectElement } from '@speclynx/apidom-core';
41
- import { isRefElement } from '@speclynx/apidom-core';
42
- import { isStringElement } from '@speclynx/apidom-core';
43
29
  import { ItemsVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
44
- import { ItemsVisitor as ItemsVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
45
30
  import { ItemsVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
46
- import { JSONReference$RefVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
47
- import { JSONReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
48
31
  import { JSONSchemaElement as JSONSchemaElement_2 } from '@speclynx/apidom-ns-json-schema-2019-09';
49
- import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
50
- import { JSONSchemaVisitor as JSONSchemaVisitor_3 } from '@speclynx/apidom-ns-json-schema-2019-09';
32
+ import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-2019-09';
51
33
  import { JSONSchemaVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
52
34
  import { LinkDescriptionElement as LinkDescriptionElement_2 } from '@speclynx/apidom-ns-json-schema-2019-09';
53
- import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
54
- import { LinkDescriptionVisitor as LinkDescriptionVisitor_3 } from '@speclynx/apidom-ns-json-schema-2019-09';
35
+ import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-2019-09';
55
36
  import { LinkDescriptionVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
56
- import { LinksVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
57
37
  import { MapVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
58
38
  import { MapVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
59
39
  import { MediaTypes } from '@speclynx/apidom-core';
60
- import { MediaVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
61
- import { Meta } from '@speclynx/apidom-core';
62
- import { Namespace } from 'minim';
63
- import { NamespacePluginOptions } from '@speclynx/apidom-core';
40
+ import { Meta } from '@speclynx/apidom-datamodel';
41
+ import { Namespace } from '@speclynx/apidom-datamodel';
42
+ import { NamespacePlugin } from '@speclynx/apidom-datamodel';
64
43
  import { OneOfVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
65
- import { OneOfVisitor as OneOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
66
44
  import { OneOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
67
45
  import { ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
68
46
  import { ParentSchemaAwareVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
47
+ import { Path } from '@speclynx/apidom-traverse';
69
48
  import { PatternedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
70
49
  import { PatternedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
71
50
  import { PatternPropertiesVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
72
- import { PatternPropertiesVisitor as PatternPropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
73
51
  import { PatternPropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
74
52
  import { PropertiesVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
75
- import { PropertiesVisitor as PropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
76
53
  import { PropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
77
- import { RequiredVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
78
- import { SchemaOrReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
79
54
  import { specificationObj as specificationObj_2 } from '@speclynx/apidom-ns-json-schema-2019-09';
80
55
  import { SpecificationVisitor } from '@speclynx/apidom-ns-json-schema-2019-09';
81
56
  import { SpecificationVisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
82
57
  import { SpecPath } from '@speclynx/apidom-ns-json-schema-2019-09';
83
- import { StringElement } from '@speclynx/apidom-core';
84
- import { TypeVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
58
+ import { StringElement } from '@speclynx/apidom-datamodel';
85
59
  import { Visitor } from '@speclynx/apidom-ns-json-schema-2019-09';
86
60
  import { VisitorOptions } from '@speclynx/apidom-ns-json-schema-2019-09';
87
61
 
@@ -109,10 +83,13 @@ export { AnyOfVisitor }
109
83
 
110
84
  export { AnyOfVisitorOptions }
111
85
 
112
- /**
113
- * @public
114
- */
115
- export declare const createRefractor: (specPath: string[]) => (value: unknown, options?: {}) => Element_2;
86
+ export { BaseSchemaArrayVisitor }
87
+
88
+ export { BaseSchemaArrayVisitorOptions }
89
+
90
+ export { BaseSchemaMapVisitor }
91
+
92
+ export { BaseSchemaMapVisitorOptions }
116
93
 
117
94
  export { DependentRequiredVisitor }
118
95
 
@@ -126,6 +103,15 @@ export { FallbackVisitor }
126
103
 
127
104
  export { FallbackVisitorOptions }
128
105
 
106
+ /**
107
+ * @public
108
+ */
109
+ export declare interface FixedField {
110
+ name: string;
111
+ alias?: string;
112
+ $visitor: unknown;
113
+ }
114
+
129
115
  export { FixedFieldsVisitor }
130
116
 
131
117
  export { FixedFieldsVisitorOptions }
@@ -135,35 +121,15 @@ export { FixedFieldsVisitorOptions }
135
121
  */
136
122
  export declare type Format = 'generic' | 'json' | 'yaml';
137
123
 
138
- export { isArrayElement }
139
-
140
- export { isBooleanElement }
141
-
142
- export { isElement }
143
-
144
124
  /**
145
125
  * @public
146
126
  */
147
- export declare const isJSONSchemaElement: ElementPredicate<JSONSchemaElement>;
127
+ export declare const isJSONSchemaElement: (element: unknown) => element is JSONSchemaElement;
148
128
 
149
129
  /**
150
130
  * @public
151
131
  */
152
- export declare const isLinkDescriptionElement: ElementPredicate<LinkDescriptionElement>;
153
-
154
- export { isLinkElement }
155
-
156
- export { isMemberElement }
157
-
158
- export { isNullElement }
159
-
160
- export { isNumberElement }
161
-
162
- export { isObjectElement }
163
-
164
- export { isRefElement }
165
-
166
- export { isStringElement }
132
+ export declare const isLinkDescriptionElement: (element: unknown) => element is LinkDescriptionElement;
167
133
 
168
134
  export { ItemsVisitor }
169
135
 
@@ -172,9 +138,7 @@ export { ItemsVisitorOptions }
172
138
  /**
173
139
  * @public
174
140
  */
175
- declare const jsonSchema202012: {
176
- namespace: (options: NamespacePluginOptions) => Namespace;
177
- };
141
+ declare const jsonSchema202012: NamespacePlugin;
178
142
  export default jsonSchema202012;
179
143
 
180
144
  /**
@@ -190,6 +154,7 @@ export declare class JSONSchema202012MediaTypes extends MediaTypes<string> {
190
154
  * @public
191
155
  */
192
156
  export declare class JSONSchemaElement extends JSONSchemaElement_2 {
157
+ static fixedFields: FixedField[];
193
158
  constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes);
194
159
  /**
195
160
  * Core vocabulary
@@ -216,7 +181,7 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
216
181
  /**
217
182
  * @public
218
183
  */
219
- export declare class JSONSchemaVisitor extends JSONSchemaVisitor_3 {
184
+ export declare class JSONSchemaVisitor extends JSONSchemaVisitor_2 {
220
185
  element: JSONSchemaElement;
221
186
  constructor(options: JSONSchemaVisitorOptions);
222
187
  get defaultDialectIdentifier(): string;
@@ -229,6 +194,7 @@ export { JSONSchemaVisitorOptions }
229
194
  * @public
230
195
  */
231
196
  export declare class LinkDescriptionElement extends LinkDescriptionElement_2 {
197
+ static fixedFields: FixedField[];
232
198
  /**
233
199
  * Link Target Attributes.
234
200
  *
@@ -252,7 +218,7 @@ export declare class LinkDescriptionElement extends LinkDescriptionElement_2 {
252
218
  /**
253
219
  * @public
254
220
  */
255
- export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_3 {
221
+ export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_2 {
256
222
  readonly element: LinkDescriptionElement;
257
223
  constructor(options: LinkDescriptionVisitorOptions);
258
224
  }
@@ -287,19 +253,16 @@ export { PatternPropertiesVisitorOptions }
287
253
  /**
288
254
  * @public
289
255
  */
290
- export declare class PrefixItemsVisitor extends PrefixItemsVisitor_base {
256
+ export declare class PrefixItemsVisitor extends BaseSchemaArrayVisitor {
291
257
  readonly element: ArrayElement;
292
258
  constructor(options: PrefixItemsVisitorOptions);
293
- ArrayElement(arrayElement: ArrayElement): {};
259
+ ArrayElement(path: Path<ArrayElement>): void;
294
260
  }
295
261
 
296
- declare const PrefixItemsVisitor_base: Class<any[], SpecificationVisitor & ParentSchemaAwareVisitor & FallbackVisitor, typeof SpecificationVisitor & typeof ParentSchemaAwareVisitor & typeof FallbackVisitor>;
297
-
298
262
  /**
299
263
  * @public
300
264
  */
301
- export declare interface PrefixItemsVisitorOptions extends SpecificationVisitorOptions, ParentSchemaAwareVisitorOptions, FallbackVisitorOptions {
302
- }
265
+ export declare type PrefixItemsVisitorOptions = BaseSchemaArrayVisitorOptions;
303
266
 
304
267
  export { PropertiesVisitor }
305
268
 
@@ -308,155 +271,44 @@ export { PropertiesVisitorOptions }
308
271
  /**
309
272
  * @public
310
273
  */
311
- export declare const refract: <T extends Element_2>(value: unknown, { specPath, plugins, specificationObj, }?: {
312
- specPath?: string[] | undefined;
313
- plugins?: never[] | undefined;
314
- specificationObj?: {
315
- visitors: {
316
- value: FallbackVisitor_2;
317
- JSONSchemaOrJSONReferenceVisitor: SchemaOrReferenceVisitor;
318
- document: {
319
- objects: {
320
- JSONSchema: {
321
- $visitor: JSONSchemaVisitor_2;
322
- fixedFields: {
323
- id: {
324
- $ref: string;
325
- };
326
- $schema: {
327
- $ref: string;
328
- };
329
- multipleOf: {
330
- $ref: string;
331
- };
332
- maximum: {
333
- $ref: string;
334
- };
335
- exclusiveMaximum: {
336
- $ref: string;
337
- };
338
- minimum: {
339
- $ref: string;
340
- };
341
- exclusiveMinimum: {
342
- $ref: string;
343
- };
344
- maxLength: {
345
- $ref: string;
346
- };
347
- minLength: {
348
- $ref: string;
349
- };
350
- pattern: {
351
- $ref: string;
352
- };
353
- additionalItems: SchemaOrReferenceVisitor;
354
- items: ItemsVisitor_2;
355
- maxItems: {
356
- $ref: string;
357
- };
358
- minItems: {
359
- $ref: string;
360
- };
361
- uniqueItems: {
362
- $ref: string;
363
- };
364
- maxProperties: {
365
- $ref: string;
366
- };
367
- minProperties: {
368
- $ref: string;
369
- };
370
- required: RequiredVisitor;
371
- properties: PropertiesVisitor_2;
372
- additionalProperties: SchemaOrReferenceVisitor;
373
- patternProperties: PatternPropertiesVisitor_2;
374
- dependencies: DependenciesVisitor;
375
- enum: EnumVisitor;
376
- type: TypeVisitor;
377
- allOf: AllOfVisitor_2;
378
- anyOf: AnyOfVisitor_2;
379
- oneOf: OneOfVisitor_2;
380
- not: SchemaOrReferenceVisitor;
381
- definitions: DefinitionsVisitor;
382
- title: {
383
- $ref: string;
384
- };
385
- description: {
386
- $ref: string;
387
- };
388
- default: {
389
- $ref: string;
390
- };
391
- format: {
392
- $ref: string;
393
- };
394
- base: {
395
- $ref: string;
396
- };
397
- links: LinksVisitor;
398
- media: {
399
- $ref: string;
400
- };
401
- readOnly: {
402
- $ref: string;
403
- };
404
- };
405
- };
406
- JSONReference: {
407
- $visitor: JSONReferenceVisitor;
408
- fixedFields: {
409
- $ref: JSONReference$RefVisitor;
410
- };
411
- };
412
- Media: {
413
- $visitor: MediaVisitor;
414
- fixedFields: {
415
- binaryEncoding: {
416
- $ref: string;
417
- };
418
- type: {
419
- $ref: string;
420
- };
421
- };
422
- };
423
- LinkDescription: {
424
- $visitor: LinkDescriptionVisitor_2;
425
- fixedFields: {
426
- href: {
427
- $ref: string;
428
- };
429
- rel: {
430
- $ref: string;
431
- };
432
- title: {
433
- $ref: string;
434
- };
435
- targetSchema: SchemaOrReferenceVisitor;
436
- mediaType: {
437
- $ref: string;
438
- };
439
- method: {
440
- $ref: string;
441
- };
442
- encType: {
443
- $ref: string;
444
- };
445
- schema: SchemaOrReferenceVisitor;
446
- };
447
- };
448
- };
449
- };
450
- };
451
- } | undefined;
452
- }) => T;
274
+ export declare const refract: <T extends Element_2>(value: unknown, { element, plugins, specificationObj, }?: RefractorOptions) => T;
275
+
276
+ /**
277
+ * Refracts a value into a JSONSchemaElement.
278
+ * @public
279
+ */
280
+ export declare const refractJSONSchema: <T extends Element_2 = JSONSchemaElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
281
+
282
+ /**
283
+ * Refracts a value into a LinkDescriptionElement.
284
+ * @public
285
+ */
286
+ export declare const refractLinkDescription: <T extends Element_2 = LinkDescriptionElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
287
+
288
+ /**
289
+ * @public
290
+ */
291
+ export declare interface RefractorOptions {
292
+ readonly element?: string;
293
+ readonly plugins?: RefractorPlugin[];
294
+ readonly specificationObj?: typeof specificationObj;
295
+ }
296
+
297
+ /**
298
+ * @public
299
+ */
300
+ export declare type RefractorPlugin = (toolbox: Toolbox) => {
301
+ visitor?: object;
302
+ pre?: () => void;
303
+ post?: () => void;
304
+ };
453
305
 
454
306
  /**
455
307
  * @public
456
308
  */
457
309
  export declare const refractorPluginReplaceEmptyElement: () => () => {
458
310
  visitor: {
459
- StringElement(element: StringElement, key: any, parent: any, path: any, ancestors: any[]): any;
311
+ StringElement(path: Path<StringElement>): void;
460
312
  };
461
313
  };
462
314
 
@@ -468,6 +320,14 @@ export { SpecificationVisitorOptions }
468
320
 
469
321
  export { SpecPath }
470
322
 
323
+ /**
324
+ * @public
325
+ */
326
+ export declare interface Toolbox {
327
+ predicates: Record<string, (...args: any[]) => boolean>;
328
+ namespace: Namespace;
329
+ }
330
+
471
331
  export { Visitor }
472
332
 
473
333
  export { VisitorOptions }
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
- exports.__esModule = true;
5
- var _JSONSchema = _interopRequireDefault(require("../elements/JSONSchema.cjs"));
6
- exports.JSONSchemaElement = _JSONSchema.default;
7
- var _LinkDescription = _interopRequireDefault(require("../elements/LinkDescription.cjs"));
8
- exports.LinkDescriptionElement = _LinkDescription.default;
9
- var _index = require("./index.cjs");
10
- // register refractors specific to element types
11
-
12
- _JSONSchema.default.refract = (0, _index.createRefractor)(['visitors', 'document', 'objects', 'JSONSchema', '$visitor']);
13
- _LinkDescription.default.refract = (0, _index.createRefractor)(['visitors', 'document', 'objects', 'LinkDescription', '$visitor']);
@@ -1,6 +0,0 @@
1
- import JSONSchemaElement from "../elements/JSONSchema.mjs";
2
- import LinkDescriptionElement from "../elements/LinkDescription.mjs";
3
- import { createRefractor } from "./index.mjs"; // register refractors specific to element types
4
- JSONSchemaElement.refract = createRefractor(['visitors', 'document', 'objects', 'JSONSchema', '$visitor']);
5
- LinkDescriptionElement.refract = createRefractor(['visitors', 'document', 'objects', 'LinkDescription', '$visitor']);
6
- export { JSONSchemaElement, LinkDescriptionElement };
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- exports.__esModule = true;
4
- exports.keyMap = exports.getNodeType = void 0;
5
- var _apidomCore = require("@speclynx/apidom-core");
6
- var _apidomNsJsonSchema = require("@speclynx/apidom-ns-json-schema-2019-09");
7
- exports.getNodeType = _apidomNsJsonSchema.getNodeType;
8
- /**
9
- * @public
10
- */
11
- const keyMap = exports.keyMap = {
12
- JSONSchema202012Element: ['content'],
13
- LinkDescriptionElement: ['content'],
14
- ..._apidomCore.keyMap
15
- };
@@ -1,10 +0,0 @@
1
- import { keyMap as keyMapBase } from '@speclynx/apidom-core';
2
- export { getNodeType } from '@speclynx/apidom-ns-json-schema-2019-09';
3
- /**
4
- * @public
5
- */
6
- export const keyMap = {
7
- JSONSchema202012Element: ['content'],
8
- LinkDescriptionElement: ['content'],
9
- ...keyMapBase
10
- };