@speclynx/apidom-ns-json-schema-draft-6 3.2.1 → 4.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 +16 -0
- package/dist/apidom-ns-json-schema-draft-6.browser.js +24 -20
- package/package.json +7 -7
- package/src/elements/JSONSchema.cjs +0 -124
- package/src/elements/JSONSchema.mjs +0 -121
- package/src/elements/LinkDescription.cjs +0 -60
- package/src/elements/LinkDescription.mjs +0 -56
- package/src/index.cjs +0 -46
- package/src/index.mjs +0 -14
- package/src/media-types.cjs +0 -34
- package/src/media-types.mjs +0 -30
- package/src/namespace.cjs +0 -24
- package/src/namespace.mjs +0 -19
- package/src/predicates.cjs +0 -30
- package/src/predicates.mjs +0 -21
- package/src/refractor/index.cjs +0 -76
- package/src/refractor/index.mjs +0 -67
- package/src/refractor/inspect.cjs +0 -47
- package/src/refractor/inspect.mjs +0 -39
- package/src/refractor/plugins/replace-empty-element.cjs +0 -218
- package/src/refractor/plugins/replace-empty-element.mjs +0 -212
- package/src/refractor/specification.cjs +0 -29
- package/src/refractor/specification.mjs +0 -24
- package/src/refractor/toolbox.cjs +0 -26
- package/src/refractor/toolbox.mjs +0 -19
- package/src/refractor/visitors/json-schema/ExamplesVisitor.cjs +0 -15
- package/src/refractor/visitors/json-schema/ExamplesVisitor.mjs +0 -11
- package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +0 -15
- package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +0 -11
- package/src/refractor/visitors/json-schema/index.cjs +0 -29
- package/src/refractor/visitors/json-schema/index.mjs +0 -24
- package/src/refractor/visitors/json-schema/link-description/index.cjs +0 -19
- package/src/refractor/visitors/json-schema/link-description/index.mjs +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.1](https://github.com/speclynx/apidom/compare/v4.0.0...v4.0.1) (2026-03-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @speclynx/apidom-ns-json-schema-draft-6
|
|
9
|
+
|
|
10
|
+
# [4.0.0](https://github.com/speclynx/apidom/compare/v3.2.1...v4.0.0) (2026-03-11)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **traverse:** all traverse operations work on Path and not Element ([#153](https://github.com/speclynx/apidom/issues/153)) ([67d244c](https://github.com/speclynx/apidom/commit/67d244cfd3e77f6a9db704cede50ba8e45d10b11))
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
- **traverse:** This is a breaking change as operation callbacks
|
|
19
|
+
now accept Path instead of Element. By accepting Path, full
|
|
20
|
+
context of traversal is exposed to consumer instead of just Element.
|
|
21
|
+
|
|
6
22
|
## [3.2.1](https://github.com/speclynx/apidom/compare/v3.2.0...v3.2.1) (2026-03-09)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @speclynx/apidom-ns-json-schema-draft-6
|
|
@@ -22067,7 +22067,9 @@ class Path {
|
|
|
22067
22067
|
*
|
|
22068
22068
|
* @example
|
|
22069
22069
|
* // For a path to $.paths['/pets'].get in an OpenAPI document:
|
|
22070
|
+
* ```
|
|
22070
22071
|
* path.getPathKeys(); // => ['paths', '/pets', 'get']
|
|
22072
|
+
* ```
|
|
22071
22073
|
*/
|
|
22072
22074
|
getPathKeys() {
|
|
22073
22075
|
const keys = [];
|
|
@@ -22102,18 +22104,22 @@ class Path {
|
|
|
22102
22104
|
* or Normalized JSONPath like "$['paths']['/pets']['get']['responses']['200']"
|
|
22103
22105
|
*
|
|
22104
22106
|
* @example
|
|
22107
|
+
* ```
|
|
22105
22108
|
* // JSON Pointer examples:
|
|
22106
22109
|
* path.formatPath(); // "" (root)
|
|
22107
22110
|
* path.formatPath(); // "/info"
|
|
22108
22111
|
* path.formatPath(); // "/paths/~1pets/get"
|
|
22109
22112
|
* path.formatPath(); // "/paths/~1users~1{id}/parameters/0"
|
|
22113
|
+
* ```
|
|
22110
22114
|
*
|
|
22111
22115
|
* @example
|
|
22116
|
+
* ```
|
|
22112
22117
|
* // JSONPath examples:
|
|
22113
22118
|
* path.formatPath('jsonpath'); // "$" (root)
|
|
22114
22119
|
* path.formatPath('jsonpath'); // "$['info']"
|
|
22115
22120
|
* path.formatPath('jsonpath'); // "$['paths']['/pets']['get']"
|
|
22116
22121
|
* path.formatPath('jsonpath'); // "$['paths']['/users/{id}']['parameters'][0]"
|
|
22122
|
+
* ```
|
|
22117
22123
|
*/
|
|
22118
22124
|
formatPath(pathFormat = 'jsonpointer') {
|
|
22119
22125
|
const parts = this.getPathKeys();
|
|
@@ -22321,15 +22327,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22321
22327
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
22322
22328
|
|
|
22323
22329
|
/**
|
|
22324
|
-
* Finds all elements
|
|
22330
|
+
* Finds all paths whose elements match the predicate.
|
|
22325
22331
|
* @public
|
|
22326
22332
|
*/
|
|
22327
22333
|
const filter = (element, predicate) => {
|
|
22328
22334
|
const result = [];
|
|
22329
22335
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
22330
22336
|
enter(path) {
|
|
22331
|
-
if (predicate(path
|
|
22332
|
-
result.push(path
|
|
22337
|
+
if (predicate(path)) {
|
|
22338
|
+
result.push(path);
|
|
22333
22339
|
}
|
|
22334
22340
|
}
|
|
22335
22341
|
});
|
|
@@ -22354,7 +22360,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22354
22360
|
* @public
|
|
22355
22361
|
*/
|
|
22356
22362
|
/**
|
|
22357
|
-
* Finds the most inner node at the given offset.
|
|
22363
|
+
* Finds the path of the most inner node at the given offset.
|
|
22358
22364
|
* If includeRightBound is set, also finds nodes that end at the given offset.
|
|
22359
22365
|
* @public
|
|
22360
22366
|
*/
|
|
@@ -22379,7 +22385,7 @@ const findAtOffset = (element, options) => {
|
|
|
22379
22385
|
const endOffset = node.endOffset;
|
|
22380
22386
|
const isWithinOffsetRange = offset >= startOffset && (offset < endOffset || includeRightBound && offset <= endOffset);
|
|
22381
22387
|
if (isWithinOffsetRange) {
|
|
22382
|
-
result.push(
|
|
22388
|
+
result.push(path);
|
|
22383
22389
|
return; // push to stack and dive in
|
|
22384
22390
|
}
|
|
22385
22391
|
path.skip(); // skip entire sub-tree
|
|
@@ -22401,15 +22407,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22401
22407
|
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
22402
22408
|
|
|
22403
22409
|
/**
|
|
22404
|
-
*
|
|
22410
|
+
* Finds first path whose element satisfies the provided predicate.
|
|
22405
22411
|
* @public
|
|
22406
22412
|
*/
|
|
22407
22413
|
const find = (element, predicate) => {
|
|
22408
22414
|
let result;
|
|
22409
22415
|
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
22410
22416
|
enter(path) {
|
|
22411
|
-
if (predicate(path
|
|
22412
|
-
result = path
|
|
22417
|
+
if (predicate(path)) {
|
|
22418
|
+
result = path;
|
|
22413
22419
|
path.stop();
|
|
22414
22420
|
}
|
|
22415
22421
|
}
|
|
@@ -22427,9 +22433,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22427
22433
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
22428
22434
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
22429
22435
|
/* harmony export */ });
|
|
22430
|
-
/* harmony import */ var
|
|
22431
|
-
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2078);
|
|
22432
|
-
|
|
22436
|
+
/* harmony import */ var _traversal_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2078);
|
|
22433
22437
|
|
|
22434
22438
|
/**
|
|
22435
22439
|
* @public
|
|
@@ -22438,7 +22442,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22438
22442
|
* @public
|
|
22439
22443
|
*/
|
|
22440
22444
|
/**
|
|
22441
|
-
* Executes the callback on this element and all
|
|
22445
|
+
* Executes the callback on this element's path and all descendant paths.
|
|
22442
22446
|
* @public
|
|
22443
22447
|
*/
|
|
22444
22448
|
const forEach = (element, options) => {
|
|
@@ -22446,15 +22450,15 @@ const forEach = (element, options) => {
|
|
|
22446
22450
|
let predicate;
|
|
22447
22451
|
if (typeof options === 'function') {
|
|
22448
22452
|
callback = options;
|
|
22449
|
-
predicate =
|
|
22453
|
+
predicate = () => true;
|
|
22450
22454
|
} else {
|
|
22451
22455
|
callback = options.callback ?? (() => {});
|
|
22452
|
-
predicate = options.predicate ??
|
|
22456
|
+
predicate = options.predicate ?? (() => true);
|
|
22453
22457
|
}
|
|
22454
|
-
(0,
|
|
22458
|
+
(0,_traversal_mjs__WEBPACK_IMPORTED_MODULE_0__.traverse)(element, {
|
|
22455
22459
|
enter(path) {
|
|
22456
|
-
if (predicate(path
|
|
22457
|
-
callback(path
|
|
22460
|
+
if (predicate(path)) {
|
|
22461
|
+
callback(path);
|
|
22458
22462
|
}
|
|
22459
22463
|
}
|
|
22460
22464
|
});
|
|
@@ -22501,11 +22505,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22501
22505
|
/* harmony import */ var _filter_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5247);
|
|
22502
22506
|
|
|
22503
22507
|
/**
|
|
22504
|
-
* Complement of filter. Finds all elements NOT
|
|
22508
|
+
* Complement of filter. Finds all paths whose elements do NOT match the predicate.
|
|
22505
22509
|
* @public
|
|
22506
22510
|
*/
|
|
22507
22511
|
const reject = (element, predicate) => {
|
|
22508
|
-
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element,
|
|
22512
|
+
return (0,_filter_mjs__WEBPACK_IMPORTED_MODULE_0__["default"])(element, path => !predicate(path));
|
|
22509
22513
|
};
|
|
22510
22514
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (reject);
|
|
22511
22515
|
|
|
@@ -22521,7 +22525,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
22521
22525
|
/* harmony import */ var _find_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4860);
|
|
22522
22526
|
|
|
22523
22527
|
/**
|
|
22524
|
-
* Tests whether at least one element passes the predicate.
|
|
22528
|
+
* Tests whether at least one path's element passes the predicate.
|
|
22525
22529
|
* @public
|
|
22526
22530
|
*/
|
|
22527
22531
|
const some = (element, predicate) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speclynx/apidom-ns-json-schema-draft-6",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
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": "
|
|
62
|
-
"@speclynx/apidom-datamodel": "
|
|
63
|
-
"@speclynx/apidom-error": "
|
|
64
|
-
"@speclynx/apidom-ns-json-schema-draft-4": "
|
|
65
|
-
"@speclynx/apidom-traverse": "
|
|
61
|
+
"@speclynx/apidom-core": "4.0.1",
|
|
62
|
+
"@speclynx/apidom-datamodel": "4.0.1",
|
|
63
|
+
"@speclynx/apidom-error": "4.0.1",
|
|
64
|
+
"@speclynx/apidom-ns-json-schema-draft-4": "4.0.1",
|
|
65
|
+
"@speclynx/apidom-traverse": "4.0.1",
|
|
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": "
|
|
80
|
+
"gitHead": "223132a9b00081ca04842efc2736a491f7876f44"
|
|
81
81
|
}
|
|
@@ -1,124 +0,0 @@
|
|
|
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;
|
|
@@ -1,121 +0,0 @@
|
|
|
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;
|
|
@@ -1,60 +0,0 @@
|
|
|
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;
|
|
@@ -1,56 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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";
|
package/src/media-types.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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;
|