@speclynx/apidom-ns-json-schema-2019-09 1.12.1 → 2.0.1
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.
- package/CHANGELOG.md +25 -0
- package/NOTICE +16 -7
- package/README.md +25 -26
- package/dist/apidom-ns-json-schema-2019-09.browser.js +1 -1
- package/package.json +11 -9
- package/src/elements/JSONSchema.cjs +7 -7
- package/src/elements/JSONSchema.mjs +7 -8
- package/src/elements/LinkDescription.cjs +5 -0
- package/src/elements/LinkDescription.mjs +5 -0
- package/src/index.cjs +11 -19
- package/src/index.mjs +4 -5
- package/src/predicates.cjs +9 -16
- package/src/predicates.mjs +5 -15
- package/src/refractor/index.cjs +38 -18
- package/src/refractor/index.mjs +33 -16
- package/src/refractor/inspect.cjs +43 -0
- package/src/refractor/inspect.mjs +37 -0
- package/src/refractor/plugins/replace-empty-element.cjs +34 -28
- package/src/refractor/plugins/replace-empty-element.mjs +14 -8
- package/src/refractor/specification.cjs +5 -2
- package/src/refractor/specification.mjs +5 -2
- package/src/refractor/toolbox.cjs +8 -3
- package/src/refractor/toolbox.mjs +6 -2
- package/src/refractor/visitors/json-schema/$defsVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/$defsVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/$refVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/$refVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/$vocabularyVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/$vocabularyVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/AllOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/AllOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/AnyOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/AnyOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/DependentRequiredVisitor.cjs +2 -3
- package/src/refractor/visitors/json-schema/DependentRequiredVisitor.mjs +2 -3
- package/src/refractor/visitors/json-schema/DependentSchemasVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/DependentSchemasVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +13 -13
- package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +12 -14
- package/src/refractor/visitors/json-schema/OneOfVisitor.cjs +7 -7
- package/src/refractor/visitors/json-schema/OneOfVisitor.mjs +6 -8
- package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/PatternPropertiesVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/PropertiesVisitor.cjs +4 -5
- package/src/refractor/visitors/json-schema/PropertiesVisitor.mjs +3 -6
- package/src/refractor/visitors/json-schema/bases.cjs +23 -0
- package/src/refractor/visitors/json-schema/bases.mjs +20 -0
- package/src/refractor/visitors/json-schema/index.cjs +6 -6
- package/src/refractor/visitors/json-schema/index.mjs +5 -5
- package/types/apidom-ns-json-schema-2019-09.d.ts +141 -307
- package/src/refractor/registration.cjs +0 -13
- package/src/refractor/registration.mjs +0 -6
- package/src/traversal/visitor.cjs +0 -15
- package/src/traversal/visitor.mjs +0 -11
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var _tsMixer = require("ts-mixer");
|
|
6
5
|
var _ramda = require("ramda");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
|
+
var _bases = require("./bases.cjs");
|
|
9
8
|
/**
|
|
10
9
|
* @public
|
|
11
10
|
*/
|
|
@@ -13,10 +12,10 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
13
12
|
/**
|
|
14
13
|
* @public
|
|
15
14
|
*/
|
|
16
|
-
class DependentSchemasVisitor extends
|
|
15
|
+
class DependentSchemasVisitor extends _bases.BaseSchemaMapVisitor {
|
|
17
16
|
constructor(options) {
|
|
18
17
|
super(options);
|
|
19
|
-
this.element = new
|
|
18
|
+
this.element = new _apidomDatamodel.ObjectElement();
|
|
20
19
|
this.element.classes.push('json-schema-dependentSchemas');
|
|
21
20
|
this.specPath = (0, _ramda.always)(['document', 'objects', 'JSONSchema']);
|
|
22
21
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Mixin } from 'ts-mixer';
|
|
2
1
|
import { always } from 'ramda';
|
|
3
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { BaseSchemaMapVisitor } from "./bases.mjs";
|
|
6
4
|
/**
|
|
7
5
|
* @public
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
8
|
* @public
|
|
12
9
|
*/
|
|
13
|
-
class DependentSchemasVisitor extends
|
|
10
|
+
class DependentSchemasVisitor extends BaseSchemaMapVisitor {
|
|
14
11
|
constructor(options) {
|
|
15
12
|
super(options);
|
|
16
13
|
this.element = new ObjectElement();
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
5
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
|
+
var _bases = require("./bases.cjs");
|
|
8
7
|
/**
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
@@ -12,24 +11,25 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
12
11
|
/**
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
15
|
-
class ItemsVisitor extends
|
|
16
|
-
ObjectElement(
|
|
17
|
-
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'],
|
|
18
|
-
|
|
14
|
+
class ItemsVisitor extends _bases.BaseSchemaArrayVisitor {
|
|
15
|
+
ObjectElement(path) {
|
|
16
|
+
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], path.node);
|
|
17
|
+
path.stop();
|
|
19
18
|
}
|
|
20
|
-
ArrayElement(
|
|
21
|
-
|
|
19
|
+
ArrayElement(path) {
|
|
20
|
+
const arrayElement = path.node;
|
|
21
|
+
this.element = new _apidomDatamodel.ArrayElement();
|
|
22
22
|
this.element.classes.push('json-schema-items');
|
|
23
23
|
arrayElement.forEach(item => {
|
|
24
24
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
25
25
|
this.element.push(element);
|
|
26
26
|
});
|
|
27
27
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
28
|
-
|
|
28
|
+
path.stop();
|
|
29
29
|
}
|
|
30
|
-
BooleanElement(
|
|
31
|
-
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'],
|
|
32
|
-
|
|
30
|
+
BooleanElement(path) {
|
|
31
|
+
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], path.node);
|
|
32
|
+
path.stop();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
var _default = exports.default = ItemsVisitor;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SpecificationVisitor, FallbackVisitor, ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
4
|
-
|
|
1
|
+
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { BaseSchemaArrayVisitor } from "./bases.mjs";
|
|
5
3
|
/**
|
|
6
4
|
* @public
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* @public
|
|
11
8
|
*/
|
|
12
|
-
class ItemsVisitor extends
|
|
13
|
-
ObjectElement(
|
|
14
|
-
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'],
|
|
15
|
-
|
|
9
|
+
class ItemsVisitor extends BaseSchemaArrayVisitor {
|
|
10
|
+
ObjectElement(path) {
|
|
11
|
+
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], path.node);
|
|
12
|
+
path.stop();
|
|
16
13
|
}
|
|
17
|
-
ArrayElement(
|
|
14
|
+
ArrayElement(path) {
|
|
15
|
+
const arrayElement = path.node;
|
|
18
16
|
this.element = new ArrayElement();
|
|
19
17
|
this.element.classes.push('json-schema-items');
|
|
20
18
|
arrayElement.forEach(item => {
|
|
@@ -22,11 +20,11 @@ class ItemsVisitor extends Mixin(SpecificationVisitor, ParentSchemaAwareVisitor,
|
|
|
22
20
|
this.element.push(element);
|
|
23
21
|
});
|
|
24
22
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
25
|
-
|
|
23
|
+
path.stop();
|
|
26
24
|
}
|
|
27
|
-
BooleanElement(
|
|
28
|
-
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'],
|
|
29
|
-
|
|
25
|
+
BooleanElement(path) {
|
|
26
|
+
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], path.node);
|
|
27
|
+
path.stop();
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
export default ItemsVisitor;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
5
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
6
|
+
var _bases = require("./bases.cjs");
|
|
8
7
|
/**
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
@@ -12,19 +11,20 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
12
11
|
/**
|
|
13
12
|
* @public
|
|
14
13
|
*/
|
|
15
|
-
class OneOfVisitor extends
|
|
14
|
+
class OneOfVisitor extends _bases.BaseSchemaArrayVisitor {
|
|
16
15
|
constructor(options) {
|
|
17
16
|
super(options);
|
|
18
|
-
this.element = new
|
|
17
|
+
this.element = new _apidomDatamodel.ArrayElement();
|
|
19
18
|
this.element.classes.push('json-schema-oneOf');
|
|
20
19
|
}
|
|
21
|
-
ArrayElement(
|
|
20
|
+
ArrayElement(path) {
|
|
21
|
+
const arrayElement = path.node;
|
|
22
22
|
arrayElement.forEach(item => {
|
|
23
23
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
24
24
|
this.element.push(element);
|
|
25
25
|
});
|
|
26
26
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
27
|
-
|
|
27
|
+
path.stop();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
var _default = exports.default = OneOfVisitor;
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { FallbackVisitor, SpecificationVisitor, ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
4
|
-
|
|
1
|
+
import { ArrayElement } from '@speclynx/apidom-datamodel';
|
|
2
|
+
import { BaseSchemaArrayVisitor } from "./bases.mjs";
|
|
5
3
|
/**
|
|
6
4
|
* @public
|
|
7
5
|
*/
|
|
8
|
-
|
|
9
6
|
/**
|
|
10
7
|
* @public
|
|
11
8
|
*/
|
|
12
|
-
class OneOfVisitor extends
|
|
9
|
+
class OneOfVisitor extends BaseSchemaArrayVisitor {
|
|
13
10
|
constructor(options) {
|
|
14
11
|
super(options);
|
|
15
12
|
this.element = new ArrayElement();
|
|
16
13
|
this.element.classes.push('json-schema-oneOf');
|
|
17
14
|
}
|
|
18
|
-
ArrayElement(
|
|
15
|
+
ArrayElement(path) {
|
|
16
|
+
const arrayElement = path.node;
|
|
19
17
|
arrayElement.forEach(item => {
|
|
20
18
|
const element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], item);
|
|
21
19
|
this.element.push(element);
|
|
22
20
|
});
|
|
23
21
|
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
24
|
-
|
|
22
|
+
path.stop();
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
export default OneOfVisitor;
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var _tsMixer = require("ts-mixer");
|
|
6
5
|
var _ramda = require("ramda");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
|
+
var _bases = require("./bases.cjs");
|
|
9
8
|
/**
|
|
10
9
|
* @public
|
|
11
10
|
*/
|
|
@@ -13,10 +12,10 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
13
12
|
/**
|
|
14
13
|
* @public
|
|
15
14
|
*/
|
|
16
|
-
class PatternPropertiesVisitor extends
|
|
15
|
+
class PatternPropertiesVisitor extends _bases.BaseSchemaMapVisitor {
|
|
17
16
|
constructor(options) {
|
|
18
17
|
super(options);
|
|
19
|
-
this.element = new
|
|
18
|
+
this.element = new _apidomDatamodel.ObjectElement();
|
|
20
19
|
this.element.classes.push('json-schema-patternProperties');
|
|
21
20
|
this.specPath = (0, _ramda.always)(['document', 'objects', 'JSONSchema']);
|
|
22
21
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Mixin } from 'ts-mixer';
|
|
2
1
|
import { always } from 'ramda';
|
|
3
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { BaseSchemaMapVisitor } from "./bases.mjs";
|
|
6
4
|
/**
|
|
7
5
|
* @public
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
8
|
* @public
|
|
12
9
|
*/
|
|
13
|
-
class PatternPropertiesVisitor extends
|
|
10
|
+
class PatternPropertiesVisitor extends BaseSchemaMapVisitor {
|
|
14
11
|
constructor(options) {
|
|
15
12
|
super(options);
|
|
16
13
|
this.element = new ObjectElement();
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var _tsMixer = require("ts-mixer");
|
|
6
5
|
var _ramda = require("ramda");
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
|
+
var _bases = require("./bases.cjs");
|
|
9
8
|
/**
|
|
10
9
|
* @public
|
|
11
10
|
*/
|
|
@@ -13,10 +12,10 @@ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7"
|
|
|
13
12
|
/**
|
|
14
13
|
* @public
|
|
15
14
|
*/
|
|
16
|
-
class PropertiesVisitor extends
|
|
15
|
+
class PropertiesVisitor extends _bases.BaseSchemaMapVisitor {
|
|
17
16
|
constructor(options) {
|
|
18
17
|
super(options);
|
|
19
|
-
this.element = new
|
|
18
|
+
this.element = new _apidomDatamodel.ObjectElement();
|
|
20
19
|
this.element.classes.push('json-schema-properties');
|
|
21
20
|
this.specPath = (0, _ramda.always)(['document', 'objects', 'JSONSchema']);
|
|
22
21
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { Mixin } from 'ts-mixer';
|
|
2
1
|
import { always } from 'ramda';
|
|
3
|
-
import { ObjectElement } from '@speclynx/apidom-
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { ObjectElement } from '@speclynx/apidom-datamodel';
|
|
3
|
+
import { BaseSchemaMapVisitor } from "./bases.mjs";
|
|
6
4
|
/**
|
|
7
5
|
* @public
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
7
|
/**
|
|
11
8
|
* @public
|
|
12
9
|
*/
|
|
13
|
-
class PropertiesVisitor extends
|
|
10
|
+
class PropertiesVisitor extends BaseSchemaMapVisitor {
|
|
14
11
|
constructor(options) {
|
|
15
12
|
super(options);
|
|
16
13
|
this.element = new ObjectElement();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.BaseSchemaMapVisitor = exports.BaseSchemaArrayVisitor = void 0;
|
|
5
|
+
var _tsMixer = require("ts-mixer");
|
|
6
|
+
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
const BaseSchemaArrayVisitor = exports.BaseSchemaArrayVisitor = (0, _tsMixer.Mixin)(_apidomNsJsonSchemaDraft.SpecificationVisitor, _apidomNsJsonSchemaDraft.ParentSchemaAwareVisitor, _apidomNsJsonSchemaDraft.FallbackVisitor);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
const BaseSchemaMapVisitor = exports.BaseSchemaMapVisitor = (0, _tsMixer.Mixin)(_apidomNsJsonSchemaDraft.MapVisitor, _apidomNsJsonSchemaDraft.ParentSchemaAwareVisitor, _apidomNsJsonSchemaDraft.FallbackVisitor);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Mixin } from 'ts-mixer';
|
|
2
|
+
import { FallbackVisitor, SpecificationVisitor, MapVisitor, ParentSchemaAwareVisitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export const BaseSchemaArrayVisitor = Mixin(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export const BaseSchemaMapVisitor = Mixin(MapVisitor, ParentSchemaAwareVisitor, FallbackVisitor);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var
|
|
6
|
+
var _apidomDatamodel = require("@speclynx/apidom-datamodel");
|
|
7
7
|
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-7");
|
|
8
8
|
var _JSONSchema = _interopRequireDefault(require("../../../elements/JSONSchema.cjs"));
|
|
9
9
|
/**
|
|
@@ -17,20 +17,20 @@ class JSONSchemaVisitor extends _apidomNsJsonSchemaDraft.JSONSchemaVisitor {
|
|
|
17
17
|
get defaultDialectIdentifier() {
|
|
18
18
|
return 'https://json-schema.org/draft/2019-09/schema';
|
|
19
19
|
}
|
|
20
|
-
ObjectElement(
|
|
20
|
+
ObjectElement(path) {
|
|
21
|
+
const objectElement = path.node;
|
|
21
22
|
this.handleDialectIdentifier(objectElement);
|
|
22
23
|
this.handleSchemaIdentifier(objectElement);
|
|
23
24
|
|
|
24
25
|
// for further processing consider this Schema Element as parent for all embedded Schema Elements
|
|
25
26
|
this.parent = this.element;
|
|
26
|
-
|
|
27
|
+
_apidomNsJsonSchemaDraft.FixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
27
28
|
|
|
28
29
|
// mark this SchemaElement with reference metadata
|
|
29
|
-
if ((0,
|
|
30
|
+
if ((0, _apidomDatamodel.isStringElement)(this.element.$ref)) {
|
|
30
31
|
this.element.classes.push('reference-element');
|
|
31
|
-
this.element.
|
|
32
|
+
this.element.meta.set('referenced-element', 'schema');
|
|
32
33
|
}
|
|
33
|
-
return result;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
var _default = exports.default = JSONSchemaVisitor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isStringElement } from '@speclynx/apidom-
|
|
1
|
+
import { isStringElement } from '@speclynx/apidom-datamodel';
|
|
2
2
|
import { FixedFieldsVisitor, JSONSchemaVisitor as JSONSchemaDraft7Visitor } from '@speclynx/apidom-ns-json-schema-draft-7';
|
|
3
3
|
import JSONSchemaElement from "../../../elements/JSONSchema.mjs";
|
|
4
4
|
/**
|
|
@@ -12,20 +12,20 @@ class JSONSchemaVisitor extends JSONSchemaDraft7Visitor {
|
|
|
12
12
|
get defaultDialectIdentifier() {
|
|
13
13
|
return 'https://json-schema.org/draft/2019-09/schema';
|
|
14
14
|
}
|
|
15
|
-
ObjectElement(
|
|
15
|
+
ObjectElement(path) {
|
|
16
|
+
const objectElement = path.node;
|
|
16
17
|
this.handleDialectIdentifier(objectElement);
|
|
17
18
|
this.handleSchemaIdentifier(objectElement);
|
|
18
19
|
|
|
19
20
|
// for further processing consider this Schema Element as parent for all embedded Schema Elements
|
|
20
21
|
this.parent = this.element;
|
|
21
|
-
|
|
22
|
+
FixedFieldsVisitor.prototype.ObjectElement.call(this, path);
|
|
22
23
|
|
|
23
24
|
// mark this SchemaElement with reference metadata
|
|
24
25
|
if (isStringElement(this.element.$ref)) {
|
|
25
26
|
this.element.classes.push('reference-element');
|
|
26
|
-
this.element.
|
|
27
|
+
this.element.meta.set('referenced-element', 'schema');
|
|
27
28
|
}
|
|
28
|
-
return result;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
export default JSONSchemaVisitor;
|