@speclynx/apidom-ns-json-schema-draft-7 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.
@@ -1,88 +1,58 @@
1
1
  import { AllOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
2
- import { AllOfVisitor as AllOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
3
2
  import { AllOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
4
3
  import { AlternatingVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
5
4
  import { AlternatingVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
6
5
  import { AnyOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
7
- import { AnyOfVisitor as AnyOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
8
6
  import { AnyOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
9
- import { ArrayElement } from '@speclynx/apidom-core';
10
- import { Attributes } from '@speclynx/apidom-core';
11
- import { BooleanElement } from '@speclynx/apidom-core';
7
+ import { ArrayElement } from '@speclynx/apidom-datamodel';
8
+ import { Attributes } from '@speclynx/apidom-datamodel';
9
+ import { BooleanElement } from '@speclynx/apidom-datamodel';
12
10
  import { DefinitionsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
13
- import { DefinitionsVisitor as DefinitionsVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
14
11
  import { DefinitionsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
15
12
  import { DependenciesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
16
- import { DependenciesVisitor as DependenciesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
17
13
  import { DependenciesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
18
- import { Element as Element_2 } from '@speclynx/apidom-core';
19
- import { ElementPredicate } from '@speclynx/apidom-core';
20
- import { EnumVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
14
+ import { Element as Element_2 } from '@speclynx/apidom-datamodel';
21
15
  import { FallbackVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
22
- import { FallbackVisitor as FallbackVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
23
16
  import { FallbackVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
24
17
  import { FixedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
25
18
  import { FixedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
26
- import { getNodeType } from '@speclynx/apidom-ns-json-schema-draft-6';
27
- import { isArrayElement } from '@speclynx/apidom-core';
28
- import { isBooleanElement } from '@speclynx/apidom-core';
29
- import { isElement } from '@speclynx/apidom-core';
30
19
  import { isJSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
31
20
  import { isJSONReferenceLikeElement } from '@speclynx/apidom-ns-json-schema-draft-6';
32
- import { isLinkElement } from '@speclynx/apidom-core';
33
- import { isMemberElement } from '@speclynx/apidom-core';
34
- import { isNullElement } from '@speclynx/apidom-core';
35
- import { isNumberElement } from '@speclynx/apidom-core';
36
- import { isObjectElement } from '@speclynx/apidom-core';
37
- import { isRefElement } from '@speclynx/apidom-core';
38
- import { isStringElement } from '@speclynx/apidom-core';
39
- import { ItemsVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
40
21
  import { ItemsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
41
- import { JSONReference$RefVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
42
22
  import { JSONReferenceElement } from '@speclynx/apidom-ns-json-schema-draft-6';
43
- import { JSONReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
44
23
  import { JSONSchemaDraft4ItemsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
45
24
  import { JSONSchemaElement as JSONSchemaElement_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
46
- import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
47
- import { JSONSchemaVisitor as JSONSchemaVisitor_3 } from '@speclynx/apidom-ns-json-schema-draft-6';
25
+ import { JSONSchemaVisitor as JSONSchemaVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
48
26
  import { JSONSchemaVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
49
27
  import { LinkDescriptionElement as LinkDescriptionElement_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
50
- import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
51
- import { LinkDescriptionVisitor as LinkDescriptionVisitor_3 } from '@speclynx/apidom-ns-json-schema-draft-6';
28
+ import { LinkDescriptionVisitor as LinkDescriptionVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
52
29
  import { LinkDescriptionVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
53
- import { LinksVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
54
30
  import { MapVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
55
31
  import { MapVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
56
32
  import { MediaElement } from '@speclynx/apidom-ns-json-schema-draft-6';
57
33
  import { MediaTypes } from '@speclynx/apidom-core';
58
- import { MediaVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
59
- import { Meta } from '@speclynx/apidom-core';
60
- import { Namespace } from 'minim';
61
- import { NamespacePluginOptions } from '@speclynx/apidom-core';
62
- import { ObjectElement } from '@speclynx/apidom-core';
34
+ import { Meta } from '@speclynx/apidom-datamodel';
35
+ import { Namespace } from '@speclynx/apidom-datamodel';
36
+ import { NamespacePlugin } from '@speclynx/apidom-datamodel';
37
+ import { ObjectElement } from '@speclynx/apidom-datamodel';
63
38
  import { OneOfVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
64
- import { OneOfVisitor as OneOfVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
65
39
  import { OneOfVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
66
40
  import { ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
67
41
  import { ParentSchemaAwareVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
42
+ import { Path } from '@speclynx/apidom-traverse';
68
43
  import { PatternedFieldsVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
69
44
  import { PatternedFieldsVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
70
45
  import { PatternPropertiesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
71
- import { PatternPropertiesVisitor as PatternPropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
72
46
  import { PatternPropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
73
47
  import { PropertiesVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
74
- import { PropertiesVisitor as PropertiesVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
75
48
  import { PropertiesVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
76
- import { RequiredVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
77
49
  import { SchemaOrReferenceVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
78
- import { SchemaOrReferenceVisitor as SchemaOrReferenceVisitor_2 } from '@speclynx/apidom-ns-json-schema-draft-4';
79
50
  import { SchemaOrReferenceVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
80
51
  import { specificationObj as specificationObj_2 } from '@speclynx/apidom-ns-json-schema-draft-6';
81
52
  import { SpecificationVisitor } from '@speclynx/apidom-ns-json-schema-draft-6';
82
53
  import { SpecificationVisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
83
54
  import { SpecPath } from '@speclynx/apidom-ns-json-schema-draft-6';
84
- import { StringElement } from '@speclynx/apidom-core';
85
- import { TypeVisitor } from '@speclynx/apidom-ns-json-schema-draft-4';
55
+ import { StringElement } from '@speclynx/apidom-datamodel';
86
56
  import { Visitor } from '@speclynx/apidom-ns-json-schema-draft-6';
87
57
  import { VisitorOptions } from '@speclynx/apidom-ns-json-schema-draft-6';
88
58
 
@@ -98,11 +68,6 @@ export { AnyOfVisitor }
98
68
 
99
69
  export { AnyOfVisitorOptions }
100
70
 
101
- /**
102
- * @public
103
- */
104
- export declare const createRefractor: (specPath: string[]) => (value: unknown, options?: {}) => Element_2;
105
-
106
71
  export { DefinitionsVisitor }
107
72
 
108
73
  export { DefinitionsVisitorOptions }
@@ -115,6 +80,15 @@ export { FallbackVisitor }
115
80
 
116
81
  export { FallbackVisitorOptions }
117
82
 
83
+ /**
84
+ * @public
85
+ */
86
+ export declare interface FixedField {
87
+ name: string;
88
+ alias?: string;
89
+ $visitor: unknown;
90
+ }
91
+
118
92
  export { FixedFieldsVisitor }
119
93
 
120
94
  export { FixedFieldsVisitorOptions }
@@ -124,14 +98,6 @@ export { FixedFieldsVisitorOptions }
124
98
  */
125
99
  export declare type Format = 'generic' | 'json' | 'yaml';
126
100
 
127
- export { getNodeType }
128
-
129
- export { isArrayElement }
130
-
131
- export { isBooleanElement }
132
-
133
- export { isElement }
134
-
135
101
  export { isJSONReferenceElement }
136
102
 
137
103
  export { isJSONReferenceLikeElement }
@@ -139,26 +105,12 @@ export { isJSONReferenceLikeElement }
139
105
  /**
140
106
  * @public
141
107
  */
142
- export declare const isJSONSchemaElement: ElementPredicate<JSONSchemaElement>;
108
+ export declare const isJSONSchemaElement: (element: unknown) => element is JSONSchemaElement;
143
109
 
144
110
  /**
145
111
  * @public
146
112
  */
147
- export declare const isLinkDescriptionElement: ElementPredicate<LinkDescriptionElement>;
148
-
149
- export { isLinkElement }
150
-
151
- export { isMemberElement }
152
-
153
- export { isNullElement }
154
-
155
- export { isNumberElement }
156
-
157
- export { isObjectElement }
158
-
159
- export { isRefElement }
160
-
161
- export { isStringElement }
113
+ export declare const isLinkDescriptionElement: (element: unknown) => element is LinkDescriptionElement;
162
114
 
163
115
  export { ItemsVisitorOptions }
164
116
 
@@ -169,9 +121,7 @@ export { JSONSchemaDraft4ItemsVisitor }
169
121
  /**
170
122
  * @public
171
123
  */
172
- declare const jsonSchemaDraft7: {
173
- namespace: (options: NamespacePluginOptions) => Namespace;
174
- };
124
+ declare const jsonSchemaDraft7: NamespacePlugin;
175
125
  export default jsonSchemaDraft7;
176
126
 
177
127
  /**
@@ -203,8 +153,8 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
203
153
  /**
204
154
  * Validation keywords for arrays
205
155
  */
206
- get items(): this | BooleanElement | JSONReferenceElement | ArrayElement | undefined;
207
- set items(items: this | BooleanElement | JSONReferenceElement | ArrayElement | undefined);
156
+ get itemsField(): this | BooleanElement | JSONReferenceElement | ArrayElement<this | BooleanElement | JSONReferenceElement> | undefined;
157
+ set itemsField(items: this | BooleanElement | JSONReferenceElement | ArrayElement<this | BooleanElement | JSONReferenceElement> | undefined);
208
158
  /**
209
159
  * Keywords for Applying Subschemas Conditionally
210
160
  *
@@ -233,7 +183,7 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
233
183
  get contentMediaType(): StringElement | undefined;
234
184
  set contentMediaType(contentMediaType: StringElement | undefined);
235
185
  get media(): MediaElement | undefined;
236
- set media(media: MediaElement | undefined);
186
+ set media(_media: MediaElement | undefined);
237
187
  /**
238
188
  * Schema annotations
239
189
  *
@@ -246,36 +196,14 @@ export declare class JSONSchemaElement extends JSONSchemaElement_2 {
246
196
  /**
247
197
  * @public
248
198
  */
249
- export declare class JSONSchemaVisitor extends JSONSchemaVisitor_3 {
250
- element: JSONSchemaElement;
199
+ export declare class JSONSchemaVisitor extends JSONSchemaVisitor_2 {
200
+ element: JSONSchemaElement | BooleanElement;
251
201
  constructor(options: JSONSchemaVisitorOptions);
252
202
  get defaultDialectIdentifier(): string;
253
203
  }
254
204
 
255
205
  export { JSONSchemaVisitorOptions }
256
206
 
257
- /**
258
- * @public
259
- */
260
- export declare const keyMap: {
261
- ObjectElement: string[];
262
- ArrayElement: string[];
263
- MemberElement: string[];
264
- StringElement: never[];
265
- BooleanElement: never[];
266
- NumberElement: never[];
267
- NullElement: never[];
268
- RefElement: never[];
269
- LinkElement: never[];
270
- Annotation: never[];
271
- Comment: never[];
272
- ParseResultElement: string[];
273
- SourceMap: string[];
274
- JSONSchemaDraft7Element: string[];
275
- JSONReferenceElement: string[];
276
- LinkDescriptionElement: string[];
277
- };
278
-
279
207
  /**
280
208
  * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
281
209
  * @public
@@ -341,7 +269,7 @@ export declare class LinkDescriptionElement extends LinkDescriptionElement_2 {
341
269
  /**
342
270
  * @public
343
271
  */
344
- export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_3 {
272
+ export declare class LinkDescriptionVisitor extends LinkDescriptionVisitor_2 {
345
273
  readonly element: LinkDescriptionElement;
346
274
  constructor(options: LinkDescriptionVisitorOptions);
347
275
  }
@@ -380,155 +308,44 @@ export { PropertiesVisitorOptions }
380
308
  /**
381
309
  * @public
382
310
  */
383
- export declare const refract: <T extends Element_2>(value: unknown, { specPath, plugins, specificationObj, }?: {
384
- specPath?: string[] | undefined;
385
- plugins?: never[] | undefined;
386
- specificationObj?: {
387
- visitors: {
388
- value: FallbackVisitor_2;
389
- JSONSchemaOrJSONReferenceVisitor: SchemaOrReferenceVisitor_2;
390
- document: {
391
- objects: {
392
- JSONSchema: {
393
- $visitor: JSONSchemaVisitor_2;
394
- fixedFields: {
395
- id: {
396
- $ref: string;
397
- };
398
- $schema: {
399
- $ref: string;
400
- };
401
- multipleOf: {
402
- $ref: string;
403
- };
404
- maximum: {
405
- $ref: string;
406
- };
407
- exclusiveMaximum: {
408
- $ref: string;
409
- };
410
- minimum: {
411
- $ref: string;
412
- };
413
- exclusiveMinimum: {
414
- $ref: string;
415
- };
416
- maxLength: {
417
- $ref: string;
418
- };
419
- minLength: {
420
- $ref: string;
421
- };
422
- pattern: {
423
- $ref: string;
424
- };
425
- additionalItems: SchemaOrReferenceVisitor_2;
426
- items: ItemsVisitor;
427
- maxItems: {
428
- $ref: string;
429
- };
430
- minItems: {
431
- $ref: string;
432
- };
433
- uniqueItems: {
434
- $ref: string;
435
- };
436
- maxProperties: {
437
- $ref: string;
438
- };
439
- minProperties: {
440
- $ref: string;
441
- };
442
- required: RequiredVisitor;
443
- properties: PropertiesVisitor_2;
444
- additionalProperties: SchemaOrReferenceVisitor_2;
445
- patternProperties: PatternPropertiesVisitor_2;
446
- dependencies: DependenciesVisitor_2;
447
- enum: EnumVisitor;
448
- type: TypeVisitor;
449
- allOf: AllOfVisitor_2;
450
- anyOf: AnyOfVisitor_2;
451
- oneOf: OneOfVisitor_2;
452
- not: SchemaOrReferenceVisitor_2;
453
- definitions: DefinitionsVisitor_2;
454
- title: {
455
- $ref: string;
456
- };
457
- description: {
458
- $ref: string;
459
- };
460
- default: {
461
- $ref: string;
462
- };
463
- format: {
464
- $ref: string;
465
- };
466
- base: {
467
- $ref: string;
468
- };
469
- links: LinksVisitor;
470
- media: {
471
- $ref: string;
472
- };
473
- readOnly: {
474
- $ref: string;
475
- };
476
- };
477
- };
478
- JSONReference: {
479
- $visitor: JSONReferenceVisitor;
480
- fixedFields: {
481
- $ref: JSONReference$RefVisitor;
482
- };
483
- };
484
- Media: {
485
- $visitor: MediaVisitor;
486
- fixedFields: {
487
- binaryEncoding: {
488
- $ref: string;
489
- };
490
- type: {
491
- $ref: string;
492
- };
493
- };
494
- };
495
- LinkDescription: {
496
- $visitor: LinkDescriptionVisitor_2;
497
- fixedFields: {
498
- href: {
499
- $ref: string;
500
- };
501
- rel: {
502
- $ref: string;
503
- };
504
- title: {
505
- $ref: string;
506
- };
507
- targetSchema: SchemaOrReferenceVisitor_2;
508
- mediaType: {
509
- $ref: string;
510
- };
511
- method: {
512
- $ref: string;
513
- };
514
- encType: {
515
- $ref: string;
516
- };
517
- schema: SchemaOrReferenceVisitor_2;
518
- };
519
- };
520
- };
521
- };
522
- };
523
- } | undefined;
524
- }) => T;
311
+ export declare const refract: <T extends Element_2>(value: unknown, { element, plugins, specificationObj, }?: RefractorOptions) => T;
312
+
313
+ /**
314
+ * Refracts a value into a JSONSchemaElement.
315
+ * @public
316
+ */
317
+ export declare const refractJSONSchema: <T extends Element_2 = JSONSchemaElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
318
+
319
+ /**
320
+ * Refracts a value into a LinkDescriptionElement.
321
+ * @public
322
+ */
323
+ export declare const refractLinkDescription: <T extends Element_2 = LinkDescriptionElement>(value: unknown, options?: Omit<RefractorOptions, "element">) => T;
324
+
325
+ /**
326
+ * @public
327
+ */
328
+ export declare interface RefractorOptions {
329
+ readonly element?: string;
330
+ readonly plugins?: RefractorPlugin[];
331
+ readonly specificationObj?: typeof specificationObj;
332
+ }
333
+
334
+ /**
335
+ * @public
336
+ */
337
+ export declare type RefractorPlugin = (toolbox: Toolbox) => {
338
+ visitor?: object;
339
+ pre?: () => void;
340
+ post?: () => void;
341
+ };
525
342
 
526
343
  /**
527
344
  * @public
528
345
  */
529
346
  export declare const refractorPluginReplaceEmptyElement: () => () => {
530
347
  visitor: {
531
- StringElement(element: StringElement, key: any, parent: any, path: any, ancestors: any[]): any;
348
+ StringElement(path: Path<StringElement>): void;
532
349
  };
533
350
  };
534
351
 
@@ -544,6 +361,14 @@ export { SpecificationVisitorOptions }
544
361
 
545
362
  export { SpecPath }
546
363
 
364
+ /**
365
+ * @public
366
+ */
367
+ export declare interface Toolbox {
368
+ predicates: Record<string, (...args: any[]) => boolean>;
369
+ namespace: Namespace;
370
+ }
371
+
547
372
  export { Visitor }
548
373
 
549
374
  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,16 +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 _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-6");
7
- exports.getNodeType = _apidomNsJsonSchemaDraft.getNodeType;
8
- /**
9
- * @public
10
- */
11
- const keyMap = exports.keyMap = {
12
- JSONSchemaDraft7Element: ['content'],
13
- JSONReferenceElement: ['content'],
14
- LinkDescriptionElement: ['content'],
15
- ..._apidomCore.keyMap
16
- };
@@ -1,12 +0,0 @@
1
- import { keyMap as keyMapBase } from '@speclynx/apidom-core';
2
- export { getNodeType } from '@speclynx/apidom-ns-json-schema-draft-6';
3
-
4
- /**
5
- * @public
6
- */
7
- export const keyMap = {
8
- JSONSchemaDraft7Element: ['content'],
9
- JSONReferenceElement: ['content'],
10
- LinkDescriptionElement: ['content'],
11
- ...keyMapBase
12
- };