@speclynx/apidom-ns-json-schema-draft-6 1.12.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 +82 -0
- package/LICENSE +202 -0
- package/LICENSES/AFL-3.0.txt +182 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/LICENSES/BSD-3-Clause.txt +26 -0
- package/LICENSES/MIT.txt +9 -0
- package/NOTICE +65 -0
- package/README.md +189 -0
- package/dist/apidom-ns-json-schema-draft-6.browser.js +1 -0
- package/package.json +65 -0
- package/src/elements/JSONSchema.cjs +116 -0
- package/src/elements/JSONSchema.mjs +113 -0
- package/src/elements/LinkDescription.cjs +56 -0
- package/src/elements/LinkDescription.mjs +52 -0
- package/src/index.cjs +58 -0
- package/src/index.mjs +17 -0
- package/src/media-types.cjs +34 -0
- package/src/media-types.mjs +30 -0
- package/src/namespace.cjs +24 -0
- package/src/namespace.mjs +19 -0
- package/src/predicates.cjs +32 -0
- package/src/predicates.mjs +26 -0
- package/src/refractor/index.cjs +53 -0
- package/src/refractor/index.mjs +47 -0
- package/src/refractor/plugins/replace-empty-element.cjs +214 -0
- package/src/refractor/plugins/replace-empty-element.mjs +207 -0
- package/src/refractor/registration.cjs +13 -0
- package/src/refractor/registration.mjs +6 -0
- package/src/refractor/specification.cjs +17 -0
- package/src/refractor/specification.mjs +12 -0
- package/src/refractor/toolbox.cjs +21 -0
- package/src/refractor/toolbox.mjs +15 -0
- package/src/refractor/visitors/json-schema/ExamplesVisitor.cjs +16 -0
- package/src/refractor/visitors/json-schema/ExamplesVisitor.mjs +12 -0
- package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +16 -0
- package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +12 -0
- package/src/refractor/visitors/json-schema/index.cjs +28 -0
- package/src/refractor/visitors/json-schema/index.mjs +23 -0
- package/src/refractor/visitors/json-schema/link-description/index.cjs +17 -0
- package/src/refractor/visitors/json-schema/link-description/index.mjs +12 -0
- package/src/traversal/visitor.cjs +17 -0
- package/src/traversal/visitor.mjs +13 -0
- package/types/apidom-ns-json-schema-draft-6.d.ts +517 -0
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@speclynx/apidom-ns-json-schema-draft-6",
|
|
3
|
+
"version": "1.12.1",
|
|
4
|
+
"description": "JSON Schema Draft 6 namespace for ApiDOM.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public",
|
|
7
|
+
"registry": "https://registry.npmjs.org",
|
|
8
|
+
"provenance": true
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"./src/refractor/registration.mjs",
|
|
13
|
+
"./src/refractor/registration.cjs"
|
|
14
|
+
],
|
|
15
|
+
"unpkg": "./dist/apidom-ns-json-schema-draft-6.browser.min.js",
|
|
16
|
+
"main": "./src/index.cjs",
|
|
17
|
+
"exports": {
|
|
18
|
+
"types": "./types/apidom-ns-json-schema-draft-6.d.ts",
|
|
19
|
+
"import": "./src/index.mjs",
|
|
20
|
+
"require": "./src/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"types": "./types/apidom-ns-json-schema-draft-6.d.ts",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
|
|
25
|
+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
|
|
26
|
+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
|
|
27
|
+
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
|
|
28
|
+
"lint": "eslint ./",
|
|
29
|
+
"lint:fix": "eslint ./ --fix",
|
|
30
|
+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
|
|
31
|
+
"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",
|
|
32
|
+
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 mocha",
|
|
33
|
+
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
|
|
34
|
+
"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'",
|
|
35
|
+
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
|
|
36
|
+
"postpack": "rimraf NOTICE LICENSES"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/speclynx/apidom.git"
|
|
41
|
+
},
|
|
42
|
+
"author": "Vladimir Gorej",
|
|
43
|
+
"license": "Apache-2.0",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@babel/runtime-corejs3": "^7.28.4",
|
|
46
|
+
"@speclynx/apidom-core": "^1.12.1",
|
|
47
|
+
"@speclynx/apidom-error": "^1.12.1",
|
|
48
|
+
"@speclynx/apidom-ns-json-schema-draft-4": "^1.12.1",
|
|
49
|
+
"@types/ramda": "~0.30.0",
|
|
50
|
+
"ramda": "~0.32.0",
|
|
51
|
+
"ramda-adjunct": "^6.0.0",
|
|
52
|
+
"ts-mixer": "^6.0.4"
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"src/**/*.mjs",
|
|
56
|
+
"src/**/*.cjs",
|
|
57
|
+
"dist/",
|
|
58
|
+
"types/apidom-ns-json-schema-draft-6.d.ts",
|
|
59
|
+
"LICENSES",
|
|
60
|
+
"NOTICE",
|
|
61
|
+
"README.md",
|
|
62
|
+
"CHANGELOG.md"
|
|
63
|
+
],
|
|
64
|
+
"gitHead": "49be88493f922c4ace2e4ebc0f23387ccb62c4fc"
|
|
65
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 idProp() {
|
|
23
|
+
throw new _apidomError.UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
|
|
24
|
+
}
|
|
25
|
+
set idProp(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 containsProp() {
|
|
63
|
+
return this.get('contains');
|
|
64
|
+
}
|
|
65
|
+
set containsProp(contains) {
|
|
66
|
+
this.set('contains', contains);
|
|
67
|
+
}
|
|
68
|
+
get items() {
|
|
69
|
+
return this.get('items');
|
|
70
|
+
}
|
|
71
|
+
set items(items) {
|
|
72
|
+
this.set('items', items);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Validation keywords for objects
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
get propertyNames() {
|
|
80
|
+
return this.get('propertyNames');
|
|
81
|
+
}
|
|
82
|
+
set propertyNames(propertyNames) {
|
|
83
|
+
this.set('propertyNames', propertyNames);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Validation keywords for any instance type
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
get const() {
|
|
91
|
+
return this.get('const');
|
|
92
|
+
}
|
|
93
|
+
set const(constValue) {
|
|
94
|
+
this.set('const', constValue);
|
|
95
|
+
}
|
|
96
|
+
get not() {
|
|
97
|
+
return this.get('not');
|
|
98
|
+
}
|
|
99
|
+
set not(not) {
|
|
100
|
+
this.set('not', not);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Metadata keywords
|
|
105
|
+
*
|
|
106
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01#section-7
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
get examples() {
|
|
110
|
+
return this.get('examples');
|
|
111
|
+
}
|
|
112
|
+
set examples(examples) {
|
|
113
|
+
this.set('examples', examples);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
var _default = exports.default = JSONSchema;
|
|
@@ -0,0 +1,113 @@
|
|
|
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 idProp() {
|
|
20
|
+
throw new UnsupportedOperationError('id keyword from Core vocabulary has been renamed to $id.');
|
|
21
|
+
}
|
|
22
|
+
set idProp(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 containsProp() {
|
|
60
|
+
return this.get('contains');
|
|
61
|
+
}
|
|
62
|
+
set containsProp(contains) {
|
|
63
|
+
this.set('contains', contains);
|
|
64
|
+
}
|
|
65
|
+
get items() {
|
|
66
|
+
return this.get('items');
|
|
67
|
+
}
|
|
68
|
+
set items(items) {
|
|
69
|
+
this.set('items', items);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Validation keywords for objects
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
get propertyNames() {
|
|
77
|
+
return this.get('propertyNames');
|
|
78
|
+
}
|
|
79
|
+
set propertyNames(propertyNames) {
|
|
80
|
+
this.set('propertyNames', propertyNames);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Validation keywords for any instance type
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
get const() {
|
|
88
|
+
return this.get('const');
|
|
89
|
+
}
|
|
90
|
+
set const(constValue) {
|
|
91
|
+
this.set('const', constValue);
|
|
92
|
+
}
|
|
93
|
+
get not() {
|
|
94
|
+
return this.get('not');
|
|
95
|
+
}
|
|
96
|
+
set not(not) {
|
|
97
|
+
this.set('not', not);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Metadata keywords
|
|
102
|
+
*
|
|
103
|
+
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-01#section-7
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
get examples() {
|
|
107
|
+
return this.get('examples');
|
|
108
|
+
}
|
|
109
|
+
set examples(examples) {
|
|
110
|
+
this.set('examples', examples);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export default JSONSchema;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
get targetSchema() {
|
|
20
|
+
return this.get('targetSchema');
|
|
21
|
+
}
|
|
22
|
+
set targetSchema(targetSchema) {
|
|
23
|
+
this.set('targetSchema', targetSchema);
|
|
24
|
+
}
|
|
25
|
+
get schema() {
|
|
26
|
+
throw new _apidomError.UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
|
|
27
|
+
}
|
|
28
|
+
set schema(schema) {
|
|
29
|
+
throw new _apidomError.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 _apidomError.UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
|
|
39
|
+
}
|
|
40
|
+
set method(method) {
|
|
41
|
+
throw new _apidomError.UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
|
|
42
|
+
}
|
|
43
|
+
get encType() {
|
|
44
|
+
throw new _apidomError.UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
|
|
45
|
+
}
|
|
46
|
+
set encType(encType) {
|
|
47
|
+
throw new _apidomError.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
|
+
var _default = exports.default = LinkDescription;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
get targetSchema() {
|
|
16
|
+
return this.get('targetSchema');
|
|
17
|
+
}
|
|
18
|
+
set targetSchema(targetSchema) {
|
|
19
|
+
this.set('targetSchema', targetSchema);
|
|
20
|
+
}
|
|
21
|
+
get schema() {
|
|
22
|
+
throw new UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
|
|
23
|
+
}
|
|
24
|
+
set schema(schema) {
|
|
25
|
+
throw new UnsupportedOperationError('schema keyword from Hyper-Schema vocabulary has been renamed to submissionSchema.');
|
|
26
|
+
}
|
|
27
|
+
get submissionSchema() {
|
|
28
|
+
return this.get('submissionSchema');
|
|
29
|
+
}
|
|
30
|
+
set submissionSchema(submissionSchema) {
|
|
31
|
+
this.set('submissionSchema', submissionSchema);
|
|
32
|
+
}
|
|
33
|
+
get method() {
|
|
34
|
+
throw new UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
|
|
35
|
+
}
|
|
36
|
+
set method(method) {
|
|
37
|
+
throw new UnsupportedOperationError('method keyword from Hyper-Schema vocabulary has been removed.');
|
|
38
|
+
}
|
|
39
|
+
get encType() {
|
|
40
|
+
throw new UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
|
|
41
|
+
}
|
|
42
|
+
set encType(encType) {
|
|
43
|
+
throw new UnsupportedOperationError('encType keyword from Hyper-Schema vocabulary has been renamed to submissionEncType.');
|
|
44
|
+
}
|
|
45
|
+
get submissionEncType() {
|
|
46
|
+
return this.get('submissionEncType');
|
|
47
|
+
}
|
|
48
|
+
set submissionEncType(submissionEncType) {
|
|
49
|
+
this.set('submissionEncType', submissionEncType);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export default LinkDescription;
|
package/src/index.cjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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.keyMap = exports.isStringElement = exports.isRefElement = exports.isObjectElement = exports.isNumberElement = exports.isNullElement = exports.isMemberElement = exports.isMediaElement = exports.isLinkElement = exports.isLinkDescriptionElement = exports.isJSONSchemaElement = exports.isJSONReferenceLikeElement = exports.isJSONReferenceElement = exports.isElement = exports.isBooleanElement = exports.isArrayElement = exports.getNodeType = exports.default = exports.createRefractor = 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 _apidomCore = require("@speclynx/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.JSONSchemaDraft6MediaTypes = _mediaTypes.JSONSchemaDraft6MediaTypes;
|
|
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.isJSONReferenceElement = _predicates.isJSONReferenceElement;
|
|
32
|
+
exports.isJSONSchemaElement = _predicates.isJSONSchemaElement;
|
|
33
|
+
exports.isLinkDescriptionElement = _predicates.isLinkDescriptionElement;
|
|
34
|
+
exports.isMediaElement = _predicates.isMediaElement;
|
|
35
|
+
var _apidomNsJsonSchemaDraft = require("@speclynx/apidom-ns-json-schema-draft-4");
|
|
36
|
+
exports.isJSONReferenceLikeElement = _apidomNsJsonSchemaDraft.isJSONReferenceLikeElement;
|
|
37
|
+
exports.SpecificationVisitor = _apidomNsJsonSchemaDraft.SpecificationVisitor;
|
|
38
|
+
exports.FallbackVisitor = _apidomNsJsonSchemaDraft.FallbackVisitor;
|
|
39
|
+
exports.FixedFieldsVisitor = _apidomNsJsonSchemaDraft.FixedFieldsVisitor;
|
|
40
|
+
exports.PatternedFieldsVisitor = _apidomNsJsonSchemaDraft.PatternedFieldsVisitor;
|
|
41
|
+
exports.MapVisitor = _apidomNsJsonSchemaDraft.MapVisitor;
|
|
42
|
+
exports.AlternatingVisitor = _apidomNsJsonSchemaDraft.AlternatingVisitor;
|
|
43
|
+
exports.ParentSchemaAwareVisitor = _apidomNsJsonSchemaDraft.ParentSchemaAwareVisitor;
|
|
44
|
+
exports.Visitor = _apidomNsJsonSchemaDraft.Visitor;
|
|
45
|
+
exports.JSONReferenceElement = _apidomNsJsonSchemaDraft.JSONReferenceElement;
|
|
46
|
+
exports.MediaElement = _apidomNsJsonSchemaDraft.MediaElement;
|
|
47
|
+
var _index2 = _interopRequireDefault(require("./refractor/visitors/json-schema/link-description/index.cjs"));
|
|
48
|
+
exports.LinkDescriptionVisitor = _index2.default;
|
|
49
|
+
var _index3 = _interopRequireDefault(require("./refractor/visitors/json-schema/index.cjs"));
|
|
50
|
+
exports.JSONSchemaVisitor = _index3.default;
|
|
51
|
+
var _ItemsVisitor = _interopRequireDefault(require("./refractor/visitors/json-schema/ItemsVisitor.cjs"));
|
|
52
|
+
exports.ItemsVisitor = _ItemsVisitor.default;
|
|
53
|
+
var _visitor = require("./traversal/visitor.cjs");
|
|
54
|
+
exports.keyMap = _visitor.keyMap;
|
|
55
|
+
exports.getNodeType = _visitor.getNodeType;
|
|
56
|
+
var _registration = require("./refractor/registration.cjs");
|
|
57
|
+
exports.JSONSchemaElement = _registration.JSONSchemaElement;
|
|
58
|
+
exports.LinkDescriptionElement = _registration.LinkDescriptionElement;
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { isRefElement, isLinkElement, isMemberElement, isObjectElement, isArrayElement, isBooleanElement, isNullElement, isElement, isNumberElement, isStringElement } from '@speclynx/apidom-core';
|
|
2
|
+
export { default as mediaTypes, JSONSchemaDraft6MediaTypes } from "./media-types.mjs";
|
|
3
|
+
export { default } from "./namespace.mjs";
|
|
4
|
+
export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugins/replace-empty-element.mjs";
|
|
5
|
+
export { default as refract, createRefractor } from "./refractor/index.mjs";
|
|
6
|
+
export { default as specificationObj } from "./refractor/specification.mjs";
|
|
7
|
+
export { isJSONReferenceElement, isJSONSchemaElement, isLinkDescriptionElement, isMediaElement } from "./predicates.mjs";
|
|
8
|
+
export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
9
|
+
export { default as LinkDescriptionVisitor } from "./refractor/visitors/json-schema/link-description/index.mjs";
|
|
10
|
+
export { default as JSONSchemaVisitor } from "./refractor/visitors/json-schema/index.mjs";
|
|
11
|
+
export { default as ItemsVisitor } from "./refractor/visitors/json-schema/ItemsVisitor.mjs";
|
|
12
|
+
export { keyMap, getNodeType } from "./traversal/visitor.mjs";
|
|
13
|
+
/**
|
|
14
|
+
* JSON Schema Draft 6 specification elements.
|
|
15
|
+
*/
|
|
16
|
+
export { JSONSchemaElement, LinkDescriptionElement } from "./refractor/registration.mjs";
|
|
17
|
+
export { JSONReferenceElement, MediaElement } from '@speclynx/apidom-ns-json-schema-draft-4';
|
|
@@ -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,32 @@
|
|
|
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 = void 0;
|
|
6
|
+
var _apidomCore = require("@speclynx/apidom-core");
|
|
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 isJSONSchemaElement = exports.isJSONSchemaElement = (0, _apidomCore.createPredicate)(({
|
|
16
|
+
hasBasicElementProps,
|
|
17
|
+
isElementType,
|
|
18
|
+
primitiveEq
|
|
19
|
+
}) => {
|
|
20
|
+
return element => element instanceof _JSONSchema.default || hasBasicElementProps(element) && isElementType('JSONSchemaDraft6', element) && primitiveEq('object', element);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
const isLinkDescriptionElement = exports.isLinkDescriptionElement = (0, _apidomCore.createPredicate)(({
|
|
27
|
+
hasBasicElementProps,
|
|
28
|
+
isElementType,
|
|
29
|
+
primitiveEq
|
|
30
|
+
}) => {
|
|
31
|
+
return element => element instanceof _LinkDescription.default || hasBasicElementProps(element) && isElementType('linkDescription', element) && primitiveEq('object', element);
|
|
32
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPredicate } from '@speclynx/apidom-core';
|
|
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 isJSONSchemaElement = createPredicate(({
|
|
10
|
+
hasBasicElementProps,
|
|
11
|
+
isElementType,
|
|
12
|
+
primitiveEq
|
|
13
|
+
}) => {
|
|
14
|
+
return element => element instanceof JSONSchemaElement || hasBasicElementProps(element) && isElementType('JSONSchemaDraft6', element) && primitiveEq('object', element);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export const isLinkDescriptionElement = createPredicate(({
|
|
21
|
+
hasBasicElementProps,
|
|
22
|
+
isElementType,
|
|
23
|
+
primitiveEq
|
|
24
|
+
}) => {
|
|
25
|
+
return element => element instanceof LinkDescriptionElement || hasBasicElementProps(element) && isElementType('linkDescription', element) && primitiveEq('object', element);
|
|
26
|
+
});
|