@speclynx/apidom-ns-json-schema-draft-6 4.0.2 → 4.0.4

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/apidom-ns-json-schema-draft-6.browser.js +7 -7
  3. package/dist/apidom-ns-json-schema-draft-6.browser.min.js +1 -1
  4. package/package.json +7 -7
  5. package/src/elements/JSONSchema.cjs +124 -0
  6. package/src/elements/JSONSchema.mjs +121 -0
  7. package/src/elements/LinkDescription.cjs +60 -0
  8. package/src/elements/LinkDescription.mjs +56 -0
  9. package/src/index.cjs +46 -0
  10. package/src/index.mjs +14 -0
  11. package/src/media-types.cjs +34 -0
  12. package/src/media-types.mjs +30 -0
  13. package/src/namespace.cjs +24 -0
  14. package/src/namespace.mjs +19 -0
  15. package/src/predicates.cjs +30 -0
  16. package/src/predicates.mjs +21 -0
  17. package/src/refractor/index.cjs +76 -0
  18. package/src/refractor/index.mjs +67 -0
  19. package/src/refractor/inspect.cjs +47 -0
  20. package/src/refractor/inspect.mjs +39 -0
  21. package/src/refractor/plugins/replace-empty-element.cjs +218 -0
  22. package/src/refractor/plugins/replace-empty-element.mjs +212 -0
  23. package/src/refractor/specification.cjs +29 -0
  24. package/src/refractor/specification.mjs +24 -0
  25. package/src/refractor/toolbox.cjs +26 -0
  26. package/src/refractor/toolbox.mjs +19 -0
  27. package/src/refractor/visitors/json-schema/ExamplesVisitor.cjs +15 -0
  28. package/src/refractor/visitors/json-schema/ExamplesVisitor.mjs +11 -0
  29. package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +15 -0
  30. package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +11 -0
  31. package/src/refractor/visitors/json-schema/index.cjs +29 -0
  32. package/src/refractor/visitors/json-schema/index.mjs +24 -0
  33. package/src/refractor/visitors/json-schema/link-description/index.cjs +19 -0
  34. package/src/refractor/visitors/json-schema/link-description/index.mjs +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speclynx/apidom-ns-json-schema-draft-6",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "JSON Schema Draft 6 namespace for ApiDOM.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -58,11 +58,11 @@
58
58
  "license": "Apache-2.0",
59
59
  "dependencies": {
60
60
  "@babel/runtime-corejs3": "^7.28.4",
61
- "@speclynx/apidom-core": "4.0.2",
62
- "@speclynx/apidom-datamodel": "4.0.2",
63
- "@speclynx/apidom-error": "4.0.2",
64
- "@speclynx/apidom-ns-json-schema-draft-4": "4.0.2",
65
- "@speclynx/apidom-traverse": "4.0.2",
61
+ "@speclynx/apidom-core": "4.0.4",
62
+ "@speclynx/apidom-datamodel": "4.0.4",
63
+ "@speclynx/apidom-error": "4.0.4",
64
+ "@speclynx/apidom-ns-json-schema-draft-4": "4.0.4",
65
+ "@speclynx/apidom-traverse": "4.0.4",
66
66
  "ramda": "~0.32.0",
67
67
  "ramda-adjunct": "^6.0.0",
68
68
  "ts-mixer": "^6.0.4"
@@ -77,5 +77,5 @@
77
77
  "README.md",
78
78
  "CHANGELOG.md"
79
79
  ],
80
- "gitHead": "af1b05d4d5e48a11a3a03cd5699324e0f1b62765"
80
+ "gitHead": "a06f6ef3d37ad5bf860cbbf4b442bfbe3a522cc2"
81
81
  }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _apidomError = require("@speclynx/apidom-error");
6
+ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
7
+ /**
8
+ * @public
9
+ */
10
+ class JSONSchema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
11
+ constructor(content, meta, attributes) {
12
+ super(content, meta, attributes);
13
+ this.element = 'JSONSchemaDraft6';
14
+ }
15
+
16
+ /**
17
+ * Core vocabulary
18
+ *
19
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01
20
+ */
21
+
22
+ get idField() {
23
+ throw new _apidomError.UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
24
+ }
25
+ set idField(id) {
26
+ throw new _apidomError.UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
27
+ }
28
+ get $id() {
29
+ return this.get('$id');
30
+ }
31
+ set $id($id) {
32
+ this.set('$id', $id);
33
+ }
34
+
35
+ /**
36
+ * Validation vocabulary
37
+ *
38
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01
39
+ */
40
+
41
+ /**
42
+ * Validation keywords for numeric instances (number and integer)
43
+ */
44
+
45
+ get exclusiveMaximum() {
46
+ return this.get('exclusiveMaximum');
47
+ }
48
+ set exclusiveMaximum(exclusiveMaximum) {
49
+ this.set('exclusiveMaximum', exclusiveMaximum);
50
+ }
51
+ get exclusiveMinimum() {
52
+ return this.get('exclusiveMinimum');
53
+ }
54
+ set exclusiveMinimum(exclusiveMinimum) {
55
+ this.set('exclusiveMinimum', exclusiveMinimum);
56
+ }
57
+
58
+ /**
59
+ * Validation keywords for arrays
60
+ */
61
+
62
+ get containsField() {
63
+ return this.get('contains');
64
+ }
65
+ set containsField(contains) {
66
+ this.set('contains', contains);
67
+ }
68
+
69
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
70
+ get itemsField() {
71
+ return this.get('items');
72
+ }
73
+
74
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
75
+ set itemsField(items) {
76
+ this.set('items', items);
77
+ }
78
+
79
+ /**
80
+ * Validation keywords for objects
81
+ */
82
+
83
+ get propertyNames() {
84
+ return this.get('propertyNames');
85
+ }
86
+ set propertyNames(propertyNames) {
87
+ this.set('propertyNames', propertyNames);
88
+ }
89
+
90
+ /**
91
+ * Validation keywords for any instance type
92
+ */
93
+
94
+ get const() {
95
+ return this.get('const');
96
+ }
97
+ set const(constValue) {
98
+ this.set('const', constValue);
99
+ }
100
+
101
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
102
+ get not() {
103
+ return this.get('not');
104
+ }
105
+
106
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
107
+ set not(not) {
108
+ this.set('not', not);
109
+ }
110
+
111
+ /**
112
+ * Metadata keywords
113
+ *
114
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01#section-7
115
+ */
116
+
117
+ get examples() {
118
+ return this.get('examples');
119
+ }
120
+ set examples(examples) {
121
+ this.set('examples', examples);
122
+ }
123
+ }
124
+ var _default = exports.default = JSONSchema;
@@ -0,0 +1,121 @@
1
+ import { UnsupportedOperationError } from '@speclynx/apidom-error';
2
+ import { JSONSchemaElement } from '@speclynx/apidom-ns-json-schema-draft-4';
3
+
4
+ /**
5
+ * @public
6
+ */
7
+ class JSONSchema extends JSONSchemaElement {
8
+ constructor(content, meta, attributes) {
9
+ super(content, meta, attributes);
10
+ this.element = 'JSONSchemaDraft6';
11
+ }
12
+
13
+ /**
14
+ * Core vocabulary
15
+ *
16
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-01
17
+ */
18
+
19
+ get idField() {
20
+ throw new UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
21
+ }
22
+ set idField(id) {
23
+ throw new UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
24
+ }
25
+ get $id() {
26
+ return this.get('$id');
27
+ }
28
+ set $id($id) {
29
+ this.set('$id', $id);
30
+ }
31
+
32
+ /**
33
+ * Validation vocabulary
34
+ *
35
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01
36
+ */
37
+
38
+ /**
39
+ * Validation keywords for numeric instances (number and integer)
40
+ */
41
+
42
+ get exclusiveMaximum() {
43
+ return this.get('exclusiveMaximum');
44
+ }
45
+ set exclusiveMaximum(exclusiveMaximum) {
46
+ this.set('exclusiveMaximum', exclusiveMaximum);
47
+ }
48
+ get exclusiveMinimum() {
49
+ return this.get('exclusiveMinimum');
50
+ }
51
+ set exclusiveMinimum(exclusiveMinimum) {
52
+ this.set('exclusiveMinimum', exclusiveMinimum);
53
+ }
54
+
55
+ /**
56
+ * Validation keywords for arrays
57
+ */
58
+
59
+ get containsField() {
60
+ return this.get('contains');
61
+ }
62
+ set containsField(contains) {
63
+ this.set('contains', contains);
64
+ }
65
+
66
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
67
+ get itemsField() {
68
+ return this.get('items');
69
+ }
70
+
71
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
72
+ set itemsField(items) {
73
+ this.set('items', items);
74
+ }
75
+
76
+ /**
77
+ * Validation keywords for objects
78
+ */
79
+
80
+ get propertyNames() {
81
+ return this.get('propertyNames');
82
+ }
83
+ set propertyNames(propertyNames) {
84
+ this.set('propertyNames', propertyNames);
85
+ }
86
+
87
+ /**
88
+ * Validation keywords for any instance type
89
+ */
90
+
91
+ get const() {
92
+ return this.get('const');
93
+ }
94
+ set const(constValue) {
95
+ this.set('const', constValue);
96
+ }
97
+
98
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
99
+ get not() {
100
+ return this.get('not');
101
+ }
102
+
103
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
104
+ set not(not) {
105
+ this.set('not', not);
106
+ }
107
+
108
+ /**
109
+ * Metadata keywords
110
+ *
111
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01#section-7
112
+ */
113
+
114
+ get examples() {
115
+ return this.get('examples');
116
+ }
117
+ set examples(examples) {
118
+ this.set('examples', examples);
119
+ }
120
+ }
121
+ export default JSONSchema;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _apidomError = require("@speclynx/apidom-error");
6
+ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
7
+ /**
8
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
9
+ * @public
10
+ */
11
+
12
+ class LinkDescription extends _apidomNsJsonSchemaDraft.LinkDescriptionElement {
13
+ get hrefSchema() {
14
+ return this.get('hrefSchema');
15
+ }
16
+ set hrefSchema(hrefSchema) {
17
+ this.set('hrefSchema', hrefSchema);
18
+ }
19
+
20
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
21
+ get targetSchema() {
22
+ return this.get('targetSchema');
23
+ }
24
+
25
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
26
+ set targetSchema(targetSchema) {
27
+ this.set('targetSchema', targetSchema);
28
+ }
29
+ get schema() {
30
+ throw new _apidomError.UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
31
+ }
32
+ set schema(schema) {
33
+ throw new _apidomError.UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
34
+ }
35
+ get submissionSchema() {
36
+ return this.get('submissionSchema');
37
+ }
38
+ set submissionSchema(submissionSchema) {
39
+ this.set('submissionSchema', submissionSchema);
40
+ }
41
+ get method() {
42
+ throw new _apidomError.UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
43
+ }
44
+ set method(method) {
45
+ throw new _apidomError.UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
46
+ }
47
+ get encType() {
48
+ throw new _apidomError.UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
49
+ }
50
+ set encType(encType) {
51
+ throw new _apidomError.UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
52
+ }
53
+ get submissionEncType() {
54
+ return this.get('submissionEncType');
55
+ }
56
+ set submissionEncType(submissionEncType) {
57
+ this.set('submissionEncType', submissionEncType);
58
+ }
59
+ }
60
+ var _default = exports.default = LinkDescription;
@@ -0,0 +1,56 @@
1
+ import { UnsupportedOperationError } from '@speclynx/apidom-error';
2
+ import { LinkDescriptionElement } from '@speclynx/apidom-ns-json-schema-draft-4';
3
+ /**
4
+ * URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
5
+ * @public
6
+ */
7
+
8
+ class LinkDescription extends LinkDescriptionElement {
9
+ get hrefSchema() {
10
+ return this.get('hrefSchema');
11
+ }
12
+ set hrefSchema(hrefSchema) {
13
+ this.set('hrefSchema', hrefSchema);
14
+ }
15
+
16
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
17
+ get targetSchema() {
18
+ return this.get('targetSchema');
19
+ }
20
+
21
+ // @ts-expect-error - widening type to include BooleanElement (boolean schemas introduced in draft-6)
22
+ set targetSchema(targetSchema) {
23
+ this.set('targetSchema', targetSchema);
24
+ }
25
+ get schema() {
26
+ throw new UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
27
+ }
28
+ set schema(schema) {
29
+ throw new UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
30
+ }
31
+ get submissionSchema() {
32
+ return this.get('submissionSchema');
33
+ }
34
+ set submissionSchema(submissionSchema) {
35
+ this.set('submissionSchema', submissionSchema);
36
+ }
37
+ get method() {
38
+ throw new UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
39
+ }
40
+ set method(method) {
41
+ throw new UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
42
+ }
43
+ get encType() {
44
+ throw new UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
45
+ }
46
+ set encType(encType) {
47
+ throw new UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
48
+ }
49
+ get submissionEncType() {
50
+ return this.get('submissionEncType');
51
+ }
52
+ set submissionEncType(submissionEncType) {
53
+ this.set('submissionEncType', submissionEncType);
54
+ }
55
+ }
56
+ export default LinkDescription;
package/src/index.cjs ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
5
+ exports.__esModule = true;
6
+ exports.specificationObj = exports.refractorPluginReplaceEmptyElement = exports.refractLinkDescription = exports.refractJSONSchema = exports.refract = exports.mediaTypes = exports.isMediaElement = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isJSONReferenceLikeElement = exports.isJSONReferenceElement = exports.isBooleanJSONSchemaElement = exports.default = exports.Visitor = exports.SpecificationVisitor = exports.PatternedFieldsVisitor = exports.ParentSchemaAwareVisitor = exports.MediaElement = exports.MapVisitor = exports.LinkDescriptionVisitor = exports.LinkDescriptionElement = exports.JSONSchemaVisitor = exports.JSONSchemaElement = exports.JSONSchemaDraft6MediaTypes = exports.JSONReferenceElement = exports.ItemsVisitor = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.AlternatingVisitor = void 0;
7
+ var _mediaTypes = _interopRequireWildcard(require("./media-types.cjs"));
8
+ exports.mediaTypes = _mediaTypes.default;
9
+ exports.JSONSchemaDraft6MediaTypes = _mediaTypes.JSONSchemaDraft6MediaTypes;
10
+ var _namespace = _interopRequireDefault(require("./namespace.cjs"));
11
+ exports.default = _namespace.default;
12
+ var _replaceEmptyElement = _interopRequireDefault(require("./refractor/plugins/replace-empty-element.cjs"));
13
+ exports.refractorPluginReplaceEmptyElement = _replaceEmptyElement.default;
14
+ var _index = _interopRequireWildcard(require("./refractor/index.cjs"));
15
+ exports.refract = _index.default;
16
+ exports.refractJSONSchema = _index.refractJSONSchema;
17
+ exports.refractLinkDescription = _index.refractLinkDescription;
18
+ var _specification = _interopRequireDefault(require("./refractor/specification.cjs"));
19
+ exports.specificationObj = _specification.default;
20
+ var _predicates = require("./predicates.cjs");
21
+ exports.isBooleanJSONSchemaElement = _predicates.isBooleanJSONSchemaElement;
22
+ exports.isJSONReferenceElement = _predicates.isJSONReferenceElement;
23
+ exports.isJSONSchemaElement = _predicates.isJSONSchemaElement;
24
+ exports.isLinkDescriptionElement = _predicates.isLinkDescriptionElement;
25
+ exports.isMediaElement = _predicates.isMediaElement;
26
+ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
27
+ exports.isJSONReferenceLikeElement = _apidomNsJsonSchemaDraft.isJSONReferenceLikeElement;
28
+ exports.SpecificationVisitor = _apidomNsJsonSchemaDraft.SpecificationVisitor;
29
+ exports.FallbackVisitor = _apidomNsJsonSchemaDraft.FallbackVisitor;
30
+ exports.FixedFieldsVisitor = _apidomNsJsonSchemaDraft.FixedFieldsVisitor;
31
+ exports.PatternedFieldsVisitor = _apidomNsJsonSchemaDraft.PatternedFieldsVisitor;
32
+ exports.MapVisitor = _apidomNsJsonSchemaDraft.MapVisitor;
33
+ exports.AlternatingVisitor = _apidomNsJsonSchemaDraft.AlternatingVisitor;
34
+ exports.ParentSchemaAwareVisitor = _apidomNsJsonSchemaDraft.ParentSchemaAwareVisitor;
35
+ exports.Visitor = _apidomNsJsonSchemaDraft.Visitor;
36
+ var _index2 = _interopRequireDefault(require("./refractor/visitors/json-schema/link-description/index.cjs"));
37
+ exports.LinkDescriptionVisitor = _index2.default;
38
+ var _index3 = _interopRequireDefault(require("./refractor/visitors/json-schema/index.cjs"));
39
+ exports.JSONSchemaVisitor = _index3.default;
40
+ var _ItemsVisitor = _interopRequireDefault(require("./refractor/visitors/json-schema/ItemsVisitor.cjs"));
41
+ exports.ItemsVisitor = _ItemsVisitor.default;
42
+ var _inspect = require("./refractor/inspect.cjs");
43
+ exports.JSONSchemaElement = _inspect.JSONSchemaElement;
44
+ exports.JSONReferenceElement = _inspect.JSONReferenceElement;
45
+ exports.MediaElement = _inspect.MediaElement;
46
+ exports.LinkDescriptionElement = _inspect.LinkDescriptionElement;
package/src/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ export { default as mediaTypes, JSONSchemaDraft6MediaTypes } from "./media-types.mjs";
2
+ export { default } from "./namespace.mjs";
3
+ export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugins/replace-empty-element.mjs";
4
+ export { default as refract, refractJSONSchema, refractLinkDescription } from "./refractor/index.mjs";
5
+ export { default as specificationObj } from "./refractor/specification.mjs";
6
+ export { isBooleanJSONSchemaElement, isJSONReferenceElement, isJSONSchemaElement, isLinkDescriptionElement, isMediaElement } from "./predicates.mjs";
7
+ export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@speclynx/apidom-ns-json-schema-draft-4';
8
+ export { default as LinkDescriptionVisitor } from "./refractor/visitors/json-schema/link-description/index.mjs";
9
+ export { default as JSONSchemaVisitor } from "./refractor/visitors/json-schema/index.mjs";
10
+ export { default as ItemsVisitor } from "./refractor/visitors/json-schema/ItemsVisitor.mjs";
11
+ /**
12
+ * JSON Schema Draft 6 specification elements.
13
+ */
14
+ export { JSONSchemaElement, JSONReferenceElement, MediaElement, LinkDescriptionElement } from "./refractor/inspect.mjs";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.JSONSchemaDraft6MediaTypes = void 0;
5
+ var _ramda = require("ramda");
6
+ var _apidomCore = require("@speclynx/apidom-core");
7
+ /**
8
+ * @public
9
+ */
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ class JSONSchemaDraft6MediaTypes extends _apidomCore.MediaTypes {
15
+ filterByFormat(format = 'generic') {
16
+ const effectiveFormat = format === 'generic' ? 'schema;version' : format;
17
+ return this.filter(mediaType => mediaType.includes(effectiveFormat));
18
+ }
19
+ findBy(version = 'draft-06', format = 'generic') {
20
+ const search = format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
21
+ const found = this.find(mediaType => mediaType.includes(search));
22
+ return found || this.unknownMediaType;
23
+ }
24
+ latest(format = 'generic') {
25
+ return (0, _ramda.last)(this.filterByFormat(format));
26
+ }
27
+ }
28
+
29
+ /**
30
+ * @public
31
+ */
32
+ exports.JSONSchemaDraft6MediaTypes = JSONSchemaDraft6MediaTypes;
33
+ const mediaTypes = new JSONSchemaDraft6MediaTypes('application/schema;version=draft-06', 'application/schema+json;version=draft-06', 'application/schema+yaml;version=draft-06');
34
+ var _default = exports.default = mediaTypes;
@@ -0,0 +1,30 @@
1
+ import { last } from 'ramda';
2
+ import { MediaTypes } from '@speclynx/apidom-core';
3
+
4
+ /**
5
+ * @public
6
+ */
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export class JSONSchemaDraft6MediaTypes extends MediaTypes {
12
+ filterByFormat(format = 'generic') {
13
+ const effectiveFormat = format === 'generic' ? 'schema;version' : format;
14
+ return this.filter(mediaType => mediaType.includes(effectiveFormat));
15
+ }
16
+ findBy(version = 'draft-06', format = 'generic') {
17
+ const search = format === 'generic' ? `schema;version=${version}` : `schema+${format};version=${version}`;
18
+ const found = this.find(mediaType => mediaType.includes(search));
19
+ return found || this.unknownMediaType;
20
+ }
21
+ latest(format = 'generic') {
22
+ return last(this.filterByFormat(format));
23
+ }
24
+ }
25
+
26
+ /**
27
+ * @public
28
+ */
29
+ const mediaTypes = new JSONSchemaDraft6MediaTypes('application/schema;version=draft-06', 'application/schema+json;version=draft-06', 'application/schema+yaml;version=draft-06');
30
+ export default mediaTypes;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.default = void 0;
6
+ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
7
+ var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
8
+ var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
9
+ /**
10
+ * @public
11
+ */
12
+ const jsonSchemaDraft6 = {
13
+ namespace: options => {
14
+ const {
15
+ base
16
+ } = options;
17
+ base.register('JSONSchemaDraft6', _JSONSchema.default);
18
+ base.register('JSONReference', _apidomNsJsonSchemaDraft.JSONReferenceElement);
19
+ base.register('media', _apidomNsJsonSchemaDraft.MediaElement);
20
+ base.register('linkDescription', _LinkDescription.default);
21
+ return base;
22
+ }
23
+ };
24
+ var _default = exports.default = jsonSchemaDraft6;
@@ -0,0 +1,19 @@
1
+ import { JSONReferenceElement, MediaElement } from '@speclynx/apidom-ns-json-schema-draft-4';
2
+ import JSONSchemaElement from "./elements/JSONSchema.mjs";
3
+ import LinkDescriptionElement from "./elements/LinkDescription.mjs";
4
+ /**
5
+ * @public
6
+ */
7
+ const jsonSchemaDraft6 = {
8
+ namespace: options => {
9
+ const {
10
+ base
11
+ } = options;
12
+ base.register('JSONSchemaDraft6', JSONSchemaElement);
13
+ base.register('JSONReference', JSONReferenceElement);
14
+ base.register('media', MediaElement);
15
+ base.register('linkDescription', LinkDescriptionElement);
16
+ return base;
17
+ }
18
+ };
19
+ export default jsonSchemaDraft6;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.isMediaElement = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isJSONReferenceElement = exports.isBooleanJSONSchemaElement = void 0;
6
+ var _apidomDatamodel = require("@speclynx/apidom-datamodel");
7
+ var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
8
+ var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
9
+ var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
10
+ exports.isJSONReferenceElement = _apidomNsJsonSchemaDraft.isJSONReferenceElement;
11
+ exports.isMediaElement = _apidomNsJsonSchemaDraft.isMediaElement;
12
+ /**
13
+ * @public
14
+ */
15
+ const isBooleanJSONSchemaElement = element => {
16
+ return (0, _apidomDatamodel.isBooleanElement)(element) && (0, _apidomDatamodel.includesClasses)(element, ['boolean-json-schema']);
17
+ };
18
+
19
+ /**
20
+ * @public
21
+ */
22
+ exports.isBooleanJSONSchemaElement = isBooleanJSONSchemaElement;
23
+ const isJSONSchemaElement = element => element instanceof _JSONSchema.default;
24
+
25
+ /**
26
+ * @public
27
+ */
28
+ exports.isJSONSchemaElement = isJSONSchemaElement;
29
+ const isLinkDescriptionElement = element => element instanceof _LinkDescription.default;
30
+ exports.isLinkDescriptionElement = isLinkDescriptionElement;
@@ -0,0 +1,21 @@
1
+ import { isBooleanElement, includesClasses } from '@speclynx/apidom-datamodel';
2
+ import JSONSchemaElement from "./elements/JSONSchema.mjs";
3
+ import LinkDescriptionElement from "./elements/LinkDescription.mjs";
4
+ export { isJSONReferenceElement, isMediaElement } from '@speclynx/apidom-ns-json-schema-draft-4';
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ export const isBooleanJSONSchemaElement = element => {
10
+ return isBooleanElement(element) && includesClasses(element, ['boolean-json-schema']);
11
+ };
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ export const isJSONSchemaElement = element => element instanceof JSONSchemaElement;
17
+
18
+ /**
19
+ * @public
20
+ */
21
+ export const isLinkDescriptionElement = element => element instanceof LinkDescriptionElement;