@swagger-api/apidom-ns-json-schema-2020-12 1.0.0-beta.10

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 (40) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSES/AFL-3.0.txt +182 -0
  3. package/LICENSES/Apache-2.0.txt +202 -0
  4. package/LICENSES/BSD-3-Clause.txt +26 -0
  5. package/LICENSES/MIT.txt +9 -0
  6. package/NOTICE +83 -0
  7. package/README.md +186 -0
  8. package/dist/apidom-ns-json-schema-2020-12.browser.js +1 -0
  9. package/package.json +64 -0
  10. package/src/elements/JSONSchema.cjs +148 -0
  11. package/src/elements/JSONSchema.mjs +145 -0
  12. package/src/elements/LinkDescription.cjs +50 -0
  13. package/src/elements/LinkDescription.mjs +46 -0
  14. package/src/index.cjs +48 -0
  15. package/src/index.mjs +15 -0
  16. package/src/media-types.cjs +34 -0
  17. package/src/media-types.mjs +30 -0
  18. package/src/namespace.cjs +21 -0
  19. package/src/namespace.mjs +16 -0
  20. package/src/predicates.cjs +29 -0
  21. package/src/predicates.mjs +24 -0
  22. package/src/refractor/index.cjs +54 -0
  23. package/src/refractor/index.mjs +48 -0
  24. package/src/refractor/plugins/replace-empty-element.cjs +264 -0
  25. package/src/refractor/plugins/replace-empty-element.mjs +257 -0
  26. package/src/refractor/registration.cjs +13 -0
  27. package/src/refractor/registration.mjs +6 -0
  28. package/src/refractor/specification.cjs +16 -0
  29. package/src/refractor/specification.mjs +11 -0
  30. package/src/refractor/toolbox.cjs +21 -0
  31. package/src/refractor/toolbox.mjs +15 -0
  32. package/src/refractor/visitors/json-schema/PrefixItemsVisitor.cjs +30 -0
  33. package/src/refractor/visitors/json-schema/PrefixItemsVisitor.mjs +27 -0
  34. package/src/refractor/visitors/json-schema/index.cjs +22 -0
  35. package/src/refractor/visitors/json-schema/index.mjs +17 -0
  36. package/src/refractor/visitors/json-schema/link-description/index.cjs +17 -0
  37. package/src/refractor/visitors/json-schema/link-description/index.mjs +12 -0
  38. package/src/traversal/visitor.cjs +15 -0
  39. package/src/traversal/visitor.mjs +10 -0
  40. package/types/apidom-ns-json-schema-2020-12.d.ts +443 -0
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@swagger-api/apidom-ns-json-schema-2020-12",
3
+ "version": "1.0.0-beta.10",
4
+ "description": "JSON Schema 2020-12 namespace for ApiDOM.",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org"
8
+ },
9
+ "type": "module",
10
+ "sideEffects": [
11
+ "./src/refractor/registration.mjs",
12
+ "./src/refractor/registration.cjs"
13
+ ],
14
+ "unpkg": "./dist/apidom-ns-json-schema-2020-12.browser.min.js",
15
+ "main": "./src/index.cjs",
16
+ "exports": {
17
+ "types": "./types/apidom-ns-json-schema-2020-12.d.ts",
18
+ "import": "./src/index.mjs",
19
+ "require": "./src/index.cjs"
20
+ },
21
+ "types": "./types/apidom-ns-json-schema-2020-12.d.ts",
22
+ "scripts": {
23
+ "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
24
+ "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
25
+ "build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
26
+ "build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
27
+ "lint": "eslint ./",
28
+ "lint:fix": "eslint ./ --fix",
29
+ "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
30
+ "test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
31
+ "test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 mocha",
32
+ "typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
33
+ "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json 2>&1 | shx grep -v 'Visitor_base'",
34
+ "prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
35
+ "postpack": "rimraf NOTICE LICENSES"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/swagger-api/apidom.git"
40
+ },
41
+ "author": "Vladimir Gorej",
42
+ "license": "Apache-2.0",
43
+ "dependencies": {
44
+ "@babel/runtime-corejs3": "^7.20.7",
45
+ "@swagger-api/apidom-core": "^1.0.0-beta.10",
46
+ "@swagger-api/apidom-error": "^1.0.0-beta.10",
47
+ "@swagger-api/apidom-ns-json-schema-2019-09": "^1.0.0-beta.10",
48
+ "@types/ramda": "~0.30.0",
49
+ "ramda": "~0.30.0",
50
+ "ramda-adjunct": "^5.0.0",
51
+ "ts-mixer": "^6.0.4"
52
+ },
53
+ "files": [
54
+ "src/**/*.mjs",
55
+ "src/**/*.cjs",
56
+ "dist/",
57
+ "types/apidom-ns-json-schema-2020-12.d.ts",
58
+ "LICENSES",
59
+ "NOTICE",
60
+ "README.md",
61
+ "CHANGELOG.md"
62
+ ],
63
+ "gitHead": "ee2045e4a14214810fecb7ddaa75b1ae35daf8e4"
64
+ }
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _apidomError = require("@swagger-api/apidom-error");
6
+ var _apidomNsJsonSchema = require("@swagger-api/apidom-ns-json-schema-2019-09");
7
+ /* eslint-disable class-methods-use-this */
8
+
9
+ /**
10
+ * @public
11
+ */
12
+ class JSONSchema extends _apidomNsJsonSchema.JSONSchemaElement {
13
+ constructor(content, meta, attributes) {
14
+ super(content, meta, attributes);
15
+ this.element = 'JSONSchema202012';
16
+ }
17
+
18
+ /**
19
+ * Core vocabulary
20
+ *
21
+ * URI: https://json-schema.org/draft/2020-12/vocab/core
22
+ */
23
+
24
+ get $dynamicAnchor() {
25
+ return this.get('$dynamicAnchor');
26
+ }
27
+ set $dynamicAnchor($dynamicAnchor) {
28
+ this.set('$dynamicAnchor', $dynamicAnchor);
29
+ }
30
+ get $recursiveAnchor() {
31
+ throw new _apidomError.UnsupportedOperationError('$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.');
32
+ }
33
+ set $recursiveAnchor($recursiveAnchor) {
34
+ throw new _apidomError.UnsupportedOperationError('$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.');
35
+ }
36
+ get $dynamicRef() {
37
+ return this.get('$dynamicRef');
38
+ }
39
+ set $dynamicRef($dynamicRef) {
40
+ this.set('$dynamicRef', $dynamicRef);
41
+ }
42
+ get $recursiveRef() {
43
+ throw new _apidomError.UnsupportedOperationError('$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.');
44
+ }
45
+ set $recursiveRef($recursiveRef) {
46
+ throw new _apidomError.UnsupportedOperationError('$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.');
47
+ }
48
+
49
+ /**
50
+ * Applicator vocabulary
51
+ *
52
+ * URI: https://json-schema.org/draft/2020-12/vocab/applicator
53
+ */
54
+
55
+ get not() {
56
+ return this.get('not');
57
+ }
58
+ set not(not) {
59
+ this.set('not', not);
60
+ }
61
+ get if() {
62
+ return this.get('if');
63
+ }
64
+ set if(ifSchema) {
65
+ this.set('if', ifSchema);
66
+ }
67
+ get then() {
68
+ return this.get('then');
69
+ }
70
+ set then(thenSchema) {
71
+ this.set('then', thenSchema);
72
+ }
73
+ get else() {
74
+ return this.get('else');
75
+ }
76
+ set else(elseSchema) {
77
+ this.set('else', elseSchema);
78
+ }
79
+ get prefixItems() {
80
+ return this.get('prefixItems');
81
+ }
82
+ set prefixItems(prefixItems) {
83
+ this.set('prefixItems', prefixItems);
84
+ }
85
+ get items() {
86
+ return this.get('items');
87
+ }
88
+ set items(items) {
89
+ this.set('items', items);
90
+ }
91
+ get containsProp() {
92
+ return this.get('contains');
93
+ }
94
+ set containsProp(containsProp) {
95
+ this.set('contains', containsProp);
96
+ }
97
+ get additionalProperties() {
98
+ return this.get('additionalProperties');
99
+ }
100
+ set additionalProperties(additionalProperties) {
101
+ this.set('additionalProperties', additionalProperties);
102
+ }
103
+ get additionalItems() {
104
+ throw new _apidomError.UnsupportedOperationError('additionalItems keyword from Applicator vocabulary has been removed.');
105
+ }
106
+ set additionalItems(additionalItems) {
107
+ throw new _apidomError.UnsupportedOperationError('additionalItems keyword from Applicator vocabulary has been removed.');
108
+ }
109
+ get propertyNames() {
110
+ return this.get('propertyNames');
111
+ }
112
+ set propertyNames(propertyNames) {
113
+ this.set('propertyNames', propertyNames);
114
+ }
115
+
116
+ /**
117
+ * Unevaluated Locations vocabulary
118
+ *
119
+ * URI: https://json-schema.org/draft/2020-12/json-schema-core#section-11
120
+ */
121
+
122
+ get unevaluatedItems() {
123
+ return this.get('unevaluatedItems');
124
+ }
125
+ set unevaluatedItems(unevaluatedItems) {
126
+ this.set('unevaluatedItems', unevaluatedItems);
127
+ }
128
+ get unevaluatedProperties() {
129
+ return this.get('unevaluatedProperties');
130
+ }
131
+ set unevaluatedProperties(unevaluatedProperties) {
132
+ this.set('unevaluatedProperties', unevaluatedProperties);
133
+ }
134
+
135
+ /**
136
+ * Vocabulary for the Contents of String-Encoded Data
137
+ *
138
+ * URI: https://json-schema.org/draft/2020-12/vocab/content
139
+ */
140
+
141
+ get contentSchema() {
142
+ return this.get('contentSchema');
143
+ }
144
+ set contentSchema(contentSchema) {
145
+ this.set('contentSchema', contentSchema);
146
+ }
147
+ }
148
+ var _default = exports.default = JSONSchema;
@@ -0,0 +1,145 @@
1
+ import { UnsupportedOperationError } from '@swagger-api/apidom-error';
2
+ import { JSONSchemaElement } from '@swagger-api/apidom-ns-json-schema-2019-09';
3
+
4
+ /* eslint-disable class-methods-use-this */
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ class JSONSchema extends JSONSchemaElement {
10
+ constructor(content, meta, attributes) {
11
+ super(content, meta, attributes);
12
+ this.element = 'JSONSchema202012';
13
+ }
14
+
15
+ /**
16
+ * Core vocabulary
17
+ *
18
+ * URI: https://json-schema.org/draft/2020-12/vocab/core
19
+ */
20
+
21
+ get $dynamicAnchor() {
22
+ return this.get('$dynamicAnchor');
23
+ }
24
+ set $dynamicAnchor($dynamicAnchor) {
25
+ this.set('$dynamicAnchor', $dynamicAnchor);
26
+ }
27
+ get $recursiveAnchor() {
28
+ throw new UnsupportedOperationError('$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.');
29
+ }
30
+ set $recursiveAnchor($recursiveAnchor) {
31
+ throw new UnsupportedOperationError('$recursiveAnchor keyword from Core vocabulary has been renamed to $dynamicAnchor.');
32
+ }
33
+ get $dynamicRef() {
34
+ return this.get('$dynamicRef');
35
+ }
36
+ set $dynamicRef($dynamicRef) {
37
+ this.set('$dynamicRef', $dynamicRef);
38
+ }
39
+ get $recursiveRef() {
40
+ throw new UnsupportedOperationError('$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.');
41
+ }
42
+ set $recursiveRef($recursiveRef) {
43
+ throw new UnsupportedOperationError('$recursiveRef keyword from Core vocabulary has been renamed to $dynamicRef.');
44
+ }
45
+
46
+ /**
47
+ * Applicator vocabulary
48
+ *
49
+ * URI: https://json-schema.org/draft/2020-12/vocab/applicator
50
+ */
51
+
52
+ get not() {
53
+ return this.get('not');
54
+ }
55
+ set not(not) {
56
+ this.set('not', not);
57
+ }
58
+ get if() {
59
+ return this.get('if');
60
+ }
61
+ set if(ifSchema) {
62
+ this.set('if', ifSchema);
63
+ }
64
+ get then() {
65
+ return this.get('then');
66
+ }
67
+ set then(thenSchema) {
68
+ this.set('then', thenSchema);
69
+ }
70
+ get else() {
71
+ return this.get('else');
72
+ }
73
+ set else(elseSchema) {
74
+ this.set('else', elseSchema);
75
+ }
76
+ get prefixItems() {
77
+ return this.get('prefixItems');
78
+ }
79
+ set prefixItems(prefixItems) {
80
+ this.set('prefixItems', prefixItems);
81
+ }
82
+ get items() {
83
+ return this.get('items');
84
+ }
85
+ set items(items) {
86
+ this.set('items', items);
87
+ }
88
+ get containsProp() {
89
+ return this.get('contains');
90
+ }
91
+ set containsProp(containsProp) {
92
+ this.set('contains', containsProp);
93
+ }
94
+ get additionalProperties() {
95
+ return this.get('additionalProperties');
96
+ }
97
+ set additionalProperties(additionalProperties) {
98
+ this.set('additionalProperties', additionalProperties);
99
+ }
100
+ get additionalItems() {
101
+ throw new UnsupportedOperationError('additionalItems keyword from Applicator vocabulary has been removed.');
102
+ }
103
+ set additionalItems(additionalItems) {
104
+ throw new UnsupportedOperationError('additionalItems keyword from Applicator vocabulary has been removed.');
105
+ }
106
+ get propertyNames() {
107
+ return this.get('propertyNames');
108
+ }
109
+ set propertyNames(propertyNames) {
110
+ this.set('propertyNames', propertyNames);
111
+ }
112
+
113
+ /**
114
+ * Unevaluated Locations vocabulary
115
+ *
116
+ * URI: https://json-schema.org/draft/2020-12/json-schema-core#section-11
117
+ */
118
+
119
+ get unevaluatedItems() {
120
+ return this.get('unevaluatedItems');
121
+ }
122
+ set unevaluatedItems(unevaluatedItems) {
123
+ this.set('unevaluatedItems', unevaluatedItems);
124
+ }
125
+ get unevaluatedProperties() {
126
+ return this.get('unevaluatedProperties');
127
+ }
128
+ set unevaluatedProperties(unevaluatedProperties) {
129
+ this.set('unevaluatedProperties', unevaluatedProperties);
130
+ }
131
+
132
+ /**
133
+ * Vocabulary for the Contents of String-Encoded Data
134
+ *
135
+ * URI: https://json-schema.org/draft/2020-12/vocab/content
136
+ */
137
+
138
+ get contentSchema() {
139
+ return this.get('contentSchema');
140
+ }
141
+ set contentSchema(contentSchema) {
142
+ this.set('contentSchema', contentSchema);
143
+ }
144
+ }
145
+ export default JSONSchema;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ var _apidomNsJsonSchema = require("@swagger-api/apidom-ns-json-schema-2019-09");
6
+ /* eslint-disable class-methods-use-this */
7
+
8
+ /**
9
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#rfc.section.6
10
+ * @public
11
+ */
12
+
13
+ class LinkDescription extends _apidomNsJsonSchema.LinkDescriptionElement {
14
+ /**
15
+ * Link Target Attributes.
16
+ *
17
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#rfc.section.6.5
18
+ */
19
+ get targetSchema() {
20
+ return this.get('targetSchema');
21
+ }
22
+ set targetSchema(targetSchema) {
23
+ this.set('targetSchema', targetSchema);
24
+ }
25
+
26
+ /**
27
+ * Link Input.
28
+ *
29
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#input
30
+ */
31
+ get hrefSchema() {
32
+ return this.get('hrefSchema');
33
+ }
34
+ set hrefSchema(hrefSchema) {
35
+ this.set('hrefSchema', hrefSchema);
36
+ }
37
+ get headerSchema() {
38
+ return this.get('headerSchema');
39
+ }
40
+ set headerSchema(headerSchema) {
41
+ this.set('headerSchema', headerSchema);
42
+ }
43
+ get submissionSchema() {
44
+ return this.get('submissionSchema');
45
+ }
46
+ set submissionSchema(submissionSchema) {
47
+ this.set('submissionSchema', submissionSchema);
48
+ }
49
+ }
50
+ var _default = exports.default = LinkDescription;
@@ -0,0 +1,46 @@
1
+ import { LinkDescriptionElement } from '@swagger-api/apidom-ns-json-schema-2019-09';
2
+ /* eslint-disable class-methods-use-this */
3
+
4
+ /**
5
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#rfc.section.6
6
+ * @public
7
+ */
8
+
9
+ class LinkDescription extends LinkDescriptionElement {
10
+ /**
11
+ * Link Target Attributes.
12
+ *
13
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#rfc.section.6.5
14
+ */
15
+ get targetSchema() {
16
+ return this.get('targetSchema');
17
+ }
18
+ set targetSchema(targetSchema) {
19
+ this.set('targetSchema', targetSchema);
20
+ }
21
+
22
+ /**
23
+ * Link Input.
24
+ *
25
+ * URI: https://json-schema.org/draft/2019-09/draft-handrews-json-schema-hyperschema-02#input
26
+ */
27
+ get hrefSchema() {
28
+ return this.get('hrefSchema');
29
+ }
30
+ set hrefSchema(hrefSchema) {
31
+ this.set('hrefSchema', hrefSchema);
32
+ }
33
+ get headerSchema() {
34
+ return this.get('headerSchema');
35
+ }
36
+ set headerSchema(headerSchema) {
37
+ this.set('headerSchema', headerSchema);
38
+ }
39
+ get submissionSchema() {
40
+ return this.get('submissionSchema');
41
+ }
42
+ set submissionSchema(submissionSchema) {
43
+ this.set('submissionSchema', submissionSchema);
44
+ }
45
+ }
46
+ export default LinkDescription;
package/src/index.cjs ADDED
@@ -0,0 +1,48 @@
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.refract = exports.mediaTypes = exports.isStringElement = exports.isRefElement = exports.isObjectElement = exports.isNumberElement = exports.isNullElement = exports.isMemberElement = exports.isLinkElement = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isElement = exports.isBooleanElement = exports.isArrayElement = exports.default = exports.createRefractor = exports.Visitor = exports.SpecificationVisitor = exports.PatternedFieldsVisitor = exports.ParentSchemaAwareVisitor = exports.MapVisitor = exports.LinkDescriptionVisitor = exports.LinkDescriptionElement = exports.JSONSchemaVisitor = exports.JSONSchemaElement = exports.JSONSchema202012MediaTypes = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.AlternatingVisitor = void 0;
7
+ var _apidomCore = require("@swagger-api/apidom-core");
8
+ exports.isRefElement = _apidomCore.isRefElement;
9
+ exports.isLinkElement = _apidomCore.isLinkElement;
10
+ exports.isMemberElement = _apidomCore.isMemberElement;
11
+ exports.isObjectElement = _apidomCore.isObjectElement;
12
+ exports.isArrayElement = _apidomCore.isArrayElement;
13
+ exports.isBooleanElement = _apidomCore.isBooleanElement;
14
+ exports.isNullElement = _apidomCore.isNullElement;
15
+ exports.isElement = _apidomCore.isElement;
16
+ exports.isNumberElement = _apidomCore.isNumberElement;
17
+ exports.isStringElement = _apidomCore.isStringElement;
18
+ var _mediaTypes = _interopRequireWildcard(require("./media-types.cjs"));
19
+ exports.mediaTypes = _mediaTypes.default;
20
+ exports.JSONSchema202012MediaTypes = _mediaTypes.JSONSchema202012MediaTypes;
21
+ var _namespace = _interopRequireDefault(require("./namespace.cjs"));
22
+ exports.default = _namespace.default;
23
+ var _replaceEmptyElement = _interopRequireDefault(require("./refractor/plugins/replace-empty-element.cjs"));
24
+ exports.refractorPluginReplaceEmptyElement = _replaceEmptyElement.default;
25
+ var _index = _interopRequireWildcard(require("./refractor/index.cjs"));
26
+ exports.refract = _index.default;
27
+ exports.createRefractor = _index.createRefractor;
28
+ var _specification = _interopRequireDefault(require("./refractor/specification.cjs"));
29
+ exports.specificationObj = _specification.default;
30
+ var _predicates = require("./predicates.cjs");
31
+ exports.isJSONSchemaElement = _predicates.isJSONSchemaElement;
32
+ exports.isLinkDescriptionElement = _predicates.isLinkDescriptionElement;
33
+ var _apidomNsJsonSchema = require("@swagger-api/apidom-ns-json-schema-2019-09");
34
+ exports.SpecificationVisitor = _apidomNsJsonSchema.SpecificationVisitor;
35
+ exports.FallbackVisitor = _apidomNsJsonSchema.FallbackVisitor;
36
+ exports.FixedFieldsVisitor = _apidomNsJsonSchema.FixedFieldsVisitor;
37
+ exports.PatternedFieldsVisitor = _apidomNsJsonSchema.PatternedFieldsVisitor;
38
+ exports.MapVisitor = _apidomNsJsonSchema.MapVisitor;
39
+ exports.AlternatingVisitor = _apidomNsJsonSchema.AlternatingVisitor;
40
+ exports.ParentSchemaAwareVisitor = _apidomNsJsonSchema.ParentSchemaAwareVisitor;
41
+ exports.Visitor = _apidomNsJsonSchema.Visitor;
42
+ var _index2 = _interopRequireDefault(require("./refractor/visitors/json-schema/index.cjs"));
43
+ exports.JSONSchemaVisitor = _index2.default;
44
+ var _index3 = _interopRequireDefault(require("./refractor/visitors/json-schema/link-description/index.cjs"));
45
+ exports.LinkDescriptionVisitor = _index3.default;
46
+ var _registration = require("./refractor/registration.cjs");
47
+ exports.JSONSchemaElement = _registration.JSONSchemaElement;
48
+ exports.LinkDescriptionElement = _registration.LinkDescriptionElement;
package/src/index.mjs ADDED
@@ -0,0 +1,15 @@
1
+ export { isRefElement, isLinkElement, isMemberElement, isObjectElement, isArrayElement, isBooleanElement, isNullElement, isElement, isNumberElement, isStringElement } from '@swagger-api/apidom-core';
2
+ export { default as mediaTypes, JSONSchema202012MediaTypes } from "./media-types.mjs";
3
+ // eslint-disable-next-line no-restricted-exports
4
+ export { default } from "./namespace.mjs";
5
+ export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugins/replace-empty-element.mjs";
6
+ export { default as refract, createRefractor } from "./refractor/index.mjs";
7
+ export { default as specificationObj } from "./refractor/specification.mjs";
8
+ export { isJSONSchemaElement, isLinkDescriptionElement } from "./predicates.mjs";
9
+ export { SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@swagger-api/apidom-ns-json-schema-2019-09';
10
+ export { default as JSONSchemaVisitor } from "./refractor/visitors/json-schema/index.mjs";
11
+ export { default as LinkDescriptionVisitor } from "./refractor/visitors/json-schema/link-description/index.mjs";
12
+ /**
13
+ * JSON Schema 2020-12 specification elements.
14
+ */
15
+ export { JSONSchemaElement, LinkDescriptionElement } from "./refractor/registration.mjs";
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports.JSONSchema202012MediaTypes = void 0;
5
+ var _ramda = require("ramda");
6
+ var _apidomCore = require("@swagger-api/apidom-core");
7
+ /**
8
+ * @public
9
+ */
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ class JSONSchema202012MediaTypes 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 = '2020-12', 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.JSONSchema202012MediaTypes = JSONSchema202012MediaTypes;
33
+ const mediaTypes = new JSONSchema202012MediaTypes('application/schema;version=2020-12', 'application/schema+json;version=2020-12', 'application/schema+yaml;version=2020-12');
34
+ var _default = exports.default = mediaTypes;
@@ -0,0 +1,30 @@
1
+ import { last } from 'ramda';
2
+ import { MediaTypes } from '@swagger-api/apidom-core';
3
+
4
+ /**
5
+ * @public
6
+ */
7
+
8
+ /**
9
+ * @public
10
+ */
11
+ export class JSONSchema202012MediaTypes 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 = '2020-12', 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 JSONSchema202012MediaTypes('application/schema;version=2020-12', 'application/schema+json;version=2020-12', 'application/schema+yaml;version=2020-12');
30
+ export default mediaTypes;
@@ -0,0 +1,21 @@
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 _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
7
+ var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
8
+ /**
9
+ * @public
10
+ */
11
+ const jsonSchema202012 = {
12
+ namespace: options => {
13
+ const {
14
+ base
15
+ } = options;
16
+ base.register('jSONSchema202012', _JSONSchema.default);
17
+ base.register('linkDescription', _LinkDescription.default);
18
+ return base;
19
+ }
20
+ };
21
+ var _default = exports.default = jsonSchema202012;
@@ -0,0 +1,16 @@
1
+ import JSONSchemaElement from "./elements/JSONSchema.mjs";
2
+ import LinkDescriptionElement from "./elements/LinkDescription.mjs";
3
+ /**
4
+ * @public
5
+ */
6
+ const jsonSchema202012 = {
7
+ namespace: options => {
8
+ const {
9
+ base
10
+ } = options;
11
+ base.register('jSONSchema202012', JSONSchemaElement);
12
+ base.register('linkDescription', LinkDescriptionElement);
13
+ return base;
14
+ }
15
+ };
16
+ export default jsonSchema202012;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ exports.__esModule = true;
5
+ exports.isLinkDescriptionElement = exports.isJSONSchemaElement = void 0;
6
+ var _apidomCore = require("@swagger-api/apidom-core");
7
+ var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
8
+ var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
9
+ /**
10
+ * @public
11
+ */
12
+ const isJSONSchemaElement = exports.isJSONSchemaElement = (0, _apidomCore.createPredicate)(({
13
+ hasBasicElementProps,
14
+ isElementType,
15
+ primitiveEq
16
+ }) => {
17
+ return element => element instanceof _JSONSchema.default || hasBasicElementProps(element) && isElementType('JSONSchema202012', element) && primitiveEq('object', element);
18
+ });
19
+
20
+ /**
21
+ * @public
22
+ */
23
+ const isLinkDescriptionElement = exports.isLinkDescriptionElement = (0, _apidomCore.createPredicate)(({
24
+ hasBasicElementProps,
25
+ isElementType,
26
+ primitiveEq
27
+ }) => {
28
+ return element => element instanceof _LinkDescription.default || hasBasicElementProps(element) && isElementType('linkDescription', element) && primitiveEq('object', element);
29
+ });
@@ -0,0 +1,24 @@
1
+ import { createPredicate } from '@swagger-api/apidom-core';
2
+ import JSONSchemaElement from "./elements/JSONSchema.mjs";
3
+ import LinkDescriptionElement from "./elements/LinkDescription.mjs";
4
+ /**
5
+ * @public
6
+ */
7
+ export const isJSONSchemaElement = createPredicate(({
8
+ hasBasicElementProps,
9
+ isElementType,
10
+ primitiveEq
11
+ }) => {
12
+ return element => element instanceof JSONSchemaElement || hasBasicElementProps(element) && isElementType('JSONSchema202012', element) && primitiveEq('object', element);
13
+ });
14
+
15
+ /**
16
+ * @public
17
+ */
18
+ export const isLinkDescriptionElement = createPredicate(({
19
+ hasBasicElementProps,
20
+ isElementType,
21
+ primitiveEq
22
+ }) => {
23
+ return element => element instanceof LinkDescriptionElement || hasBasicElementProps(element) && isElementType('linkDescription', element) && primitiveEq('object', element);
24
+ });