@swagger-api/apidom-ns-json-schema-draft-6 1.0.0-beta.2 → 1.0.0-beta.23
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 +89 -0
- package/LICENSES/AFL-3.0.txt +182 -0
- package/LICENSES/BSD-3-Clause.txt +26 -0
- package/NOTICE +26 -0
- package/dist/apidom-ns-json-schema-draft-6.browser.js +1 -1
- package/package.json +9 -9
- package/src/elements/JSONSchema.cjs +3 -0
- package/src/elements/JSONSchema.mjs +3 -0
- package/src/elements/LinkDescription.cjs +1 -0
- package/src/elements/LinkDescription.mjs +1 -0
- package/src/index.cjs +7 -1
- package/src/index.mjs +5 -1
- package/src/media-types.cjs +11 -0
- package/src/media-types.mjs +12 -0
- package/src/namespace.cjs +3 -0
- package/src/namespace.mjs +3 -0
- package/src/predicates.cjs +7 -0
- package/src/predicates.mjs +8 -0
- package/src/refractor/index.cjs +7 -0
- package/src/refractor/index.mjs +7 -0
- package/src/refractor/plugins/replace-empty-element.cjs +4 -0
- package/src/refractor/plugins/replace-empty-element.mjs +4 -0
- package/src/refractor/visitors/json-schema/ExamplesVisitor.cjs +3 -0
- package/src/refractor/visitors/json-schema/ExamplesVisitor.mjs +3 -0
- package/src/refractor/visitors/json-schema/ItemsVisitor.cjs +4 -18
- package/src/refractor/visitors/json-schema/ItemsVisitor.mjs +6 -20
- package/src/refractor/visitors/json-schema/index.cjs +12 -7
- package/src/refractor/visitors/json-schema/index.mjs +13 -8
- package/src/refractor/visitors/json-schema/link-description/index.cjs +4 -4
- package/src/refractor/visitors/json-schema/link-description/index.mjs +5 -5
- package/src/traversal/visitor.cjs +5 -8
- package/src/traversal/visitor.mjs +5 -8
- package/types/apidom-ns-json-schema-draft-6.d.ts +517 -0
- package/types/dist.d.ts +0 -304
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-ns-json-schema-draft-6",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.23",
|
|
4
4
|
"description": "JSON Schema Draft 6 namespace for ApiDOM.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"unpkg": "./dist/apidom-ns-json-schema-draft-6.browser.min.js",
|
|
15
15
|
"main": "./src/index.cjs",
|
|
16
16
|
"exports": {
|
|
17
|
-
"types": "./types/
|
|
17
|
+
"types": "./types/apidom-ns-json-schema-draft-6.d.ts",
|
|
18
18
|
"import": "./src/index.mjs",
|
|
19
19
|
"require": "./src/index.cjs"
|
|
20
20
|
},
|
|
21
|
-
"types": "./types/
|
|
21
|
+
"types": "./types/apidom-ns-json-schema-draft-6.d.ts",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
|
|
24
24
|
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
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
31
|
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 mocha",
|
|
32
32
|
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
|
|
33
|
-
"typescript:declaration": "tsc -p tsconfig.declaration.json &&
|
|
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
34
|
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
|
|
35
35
|
"postpack": "rimraf NOTICE LICENSES"
|
|
36
36
|
},
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime-corejs3": "^7.20.7",
|
|
45
|
-
"@swagger-api/apidom-core": "^1.0.0-beta.
|
|
46
|
-
"@swagger-api/apidom-error": "^1.0.0-beta.
|
|
47
|
-
"@swagger-api/apidom-ns-json-schema-draft-4": "^1.0.0-beta.
|
|
45
|
+
"@swagger-api/apidom-core": "^1.0.0-beta.23",
|
|
46
|
+
"@swagger-api/apidom-error": "^1.0.0-beta.23",
|
|
47
|
+
"@swagger-api/apidom-ns-json-schema-draft-4": "^1.0.0-beta.23",
|
|
48
48
|
"@types/ramda": "~0.30.0",
|
|
49
49
|
"ramda": "~0.30.0",
|
|
50
50
|
"ramda-adjunct": "^5.0.0",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"src/**/*.mjs",
|
|
55
55
|
"src/**/*.cjs",
|
|
56
56
|
"dist/",
|
|
57
|
-
"types/
|
|
57
|
+
"types/apidom-ns-json-schema-draft-6.d.ts",
|
|
58
58
|
"LICENSES",
|
|
59
59
|
"NOTICE",
|
|
60
60
|
"README.md",
|
|
61
61
|
"CHANGELOG.md"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e73dc6728c161af2fafd47784d02a89d1ab43557"
|
|
64
64
|
}
|
|
@@ -6,6 +6,9 @@ var _apidomError = require("@swagger-api/apidom-error");
|
|
|
6
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
7
7
|
/* eslint-disable class-methods-use-this */
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
class JSONSchema extends _apidomNsJsonSchemaDraft.JSONSchemaElement {
|
|
10
13
|
constructor(content, meta, attributes) {
|
|
11
14
|
super(content, meta, attributes);
|
|
@@ -3,6 +3,9 @@ import { JSONSchemaElement } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable class-methods-use-this */
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
class JSONSchema extends JSONSchemaElement {
|
|
7
10
|
constructor(content, meta, attributes) {
|
|
8
11
|
super(content, meta, attributes);
|
|
@@ -8,6 +8,7 @@ var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* URI: https://datatracker.ietf.org/doc/html/draft-wright-json-schema-hyperschema-01#section-6
|
|
11
|
+
* @public
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
class LinkDescription extends _apidomNsJsonSchemaDraft.LinkDescriptionElement {
|
package/src/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default;
|
|
5
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.LinkDescriptionElement = exports.JSONSchemaElement = exports.JSONSchemaDraft6MediaTypes = exports.JSONReferenceElement = exports.FixedFieldsVisitor = exports.FallbackVisitor = exports.AlternatingVisitor = void 0;
|
|
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
7
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
8
8
|
exports.isRefElement = _apidomCore.isRefElement;
|
|
9
9
|
exports.isLinkElement = _apidomCore.isLinkElement;
|
|
@@ -44,6 +44,12 @@ exports.ParentSchemaAwareVisitor = _apidomNsJsonSchemaDraft.ParentSchemaAwareVis
|
|
|
44
44
|
exports.Visitor = _apidomNsJsonSchemaDraft.Visitor;
|
|
45
45
|
exports.JSONReferenceElement = _apidomNsJsonSchemaDraft.JSONReferenceElement;
|
|
46
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;
|
|
47
53
|
var _visitor = require("./traversal/visitor.cjs");
|
|
48
54
|
exports.keyMap = _visitor.keyMap;
|
|
49
55
|
exports.getNodeType = _visitor.getNodeType;
|
package/src/index.mjs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
export { isRefElement, isLinkElement, isMemberElement, isObjectElement, isArrayElement, isBooleanElement, isNullElement, isElement, isNumberElement, isStringElement } from '@swagger-api/apidom-core';
|
|
2
|
-
export { default as mediaTypes, JSONSchemaDraft6MediaTypes } from "./media-types.mjs";
|
|
2
|
+
export { default as mediaTypes, JSONSchemaDraft6MediaTypes } from "./media-types.mjs";
|
|
3
|
+
// eslint-disable-next-line no-restricted-exports
|
|
3
4
|
export { default } from "./namespace.mjs";
|
|
4
5
|
export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugins/replace-empty-element.mjs";
|
|
5
6
|
export { default as refract, createRefractor } from "./refractor/index.mjs";
|
|
6
7
|
export { default as specificationObj } from "./refractor/specification.mjs";
|
|
7
8
|
export { isJSONReferenceElement, isJSONSchemaElement, isLinkDescriptionElement, isMediaElement } from "./predicates.mjs";
|
|
8
9
|
export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
10
|
+
export { default as LinkDescriptionVisitor } from "./refractor/visitors/json-schema/link-description/index.mjs";
|
|
11
|
+
export { default as JSONSchemaVisitor } from "./refractor/visitors/json-schema/index.mjs";
|
|
12
|
+
export { default as ItemsVisitor } from "./refractor/visitors/json-schema/ItemsVisitor.mjs";
|
|
9
13
|
export { keyMap, getNodeType } from "./traversal/visitor.mjs";
|
|
10
14
|
/**
|
|
11
15
|
* JSON Schema Draft 6 specification elements.
|
package/src/media-types.cjs
CHANGED
|
@@ -4,6 +4,13 @@ exports.__esModule = true;
|
|
|
4
4
|
exports.default = exports.JSONSchemaDraft6MediaTypes = void 0;
|
|
5
5
|
var _ramda = require("ramda");
|
|
6
6
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
7
14
|
class JSONSchemaDraft6MediaTypes extends _apidomCore.MediaTypes {
|
|
8
15
|
filterByFormat(format = 'generic') {
|
|
9
16
|
const effectiveFormat = format === 'generic' ? 'schema;version' : format;
|
|
@@ -18,6 +25,10 @@ class JSONSchemaDraft6MediaTypes extends _apidomCore.MediaTypes {
|
|
|
18
25
|
return (0, _ramda.last)(this.filterByFormat(format));
|
|
19
26
|
}
|
|
20
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
21
32
|
exports.JSONSchemaDraft6MediaTypes = JSONSchemaDraft6MediaTypes;
|
|
22
33
|
const mediaTypes = new JSONSchemaDraft6MediaTypes('application/schema;version=draft-06', 'application/schema+json;version=draft-06', 'application/schema+yaml;version=draft-06');
|
|
23
34
|
var _default = exports.default = mediaTypes;
|
package/src/media-types.mjs
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { last } from 'ramda';
|
|
2
2
|
import { MediaTypes } from '@swagger-api/apidom-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
3
11
|
export class JSONSchemaDraft6MediaTypes extends MediaTypes {
|
|
4
12
|
filterByFormat(format = 'generic') {
|
|
5
13
|
const effectiveFormat = format === 'generic' ? 'schema;version' : format;
|
|
@@ -14,5 +22,9 @@ export class JSONSchemaDraft6MediaTypes extends MediaTypes {
|
|
|
14
22
|
return last(this.filterByFormat(format));
|
|
15
23
|
}
|
|
16
24
|
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
17
29
|
const mediaTypes = new JSONSchemaDraft6MediaTypes('application/schema;version=draft-06', 'application/schema+json;version=draft-06', 'application/schema+yaml;version=draft-06');
|
|
18
30
|
export default mediaTypes;
|
package/src/namespace.cjs
CHANGED
|
@@ -6,6 +6,9 @@ exports.default = void 0;
|
|
|
6
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
7
7
|
var _JSONSchema = _interopRequireDefault(require("./elements/JSONSchema.cjs"));
|
|
8
8
|
var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescription.cjs"));
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
const jsonSchemaDraft6 = {
|
|
10
13
|
namespace: options => {
|
|
11
14
|
const {
|
package/src/namespace.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { JSONReferenceElement, MediaElement } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
2
2
|
import JSONSchemaElement from "./elements/JSONSchema.mjs";
|
|
3
3
|
import LinkDescriptionElement from "./elements/LinkDescription.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
const jsonSchemaDraft6 = {
|
|
5
8
|
namespace: options => {
|
|
6
9
|
const {
|
package/src/predicates.cjs
CHANGED
|
@@ -9,6 +9,9 @@ var _LinkDescription = _interopRequireDefault(require("./elements/LinkDescriptio
|
|
|
9
9
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
10
10
|
exports.isJSONReferenceElement = _apidomNsJsonSchemaDraft.isJSONReferenceElement;
|
|
11
11
|
exports.isMediaElement = _apidomNsJsonSchemaDraft.isMediaElement;
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
12
15
|
const isJSONSchemaElement = exports.isJSONSchemaElement = (0, _apidomCore.createPredicate)(({
|
|
13
16
|
hasBasicElementProps,
|
|
14
17
|
isElementType,
|
|
@@ -16,6 +19,10 @@ const isJSONSchemaElement = exports.isJSONSchemaElement = (0, _apidomCore.create
|
|
|
16
19
|
}) => {
|
|
17
20
|
return element => element instanceof _JSONSchema.default || hasBasicElementProps(element) && isElementType('JSONSchemaDraft6', element) && primitiveEq('object', element);
|
|
18
21
|
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
19
26
|
const isLinkDescriptionElement = exports.isLinkDescriptionElement = (0, _apidomCore.createPredicate)(({
|
|
20
27
|
hasBasicElementProps,
|
|
21
28
|
isElementType,
|
package/src/predicates.mjs
CHANGED
|
@@ -2,6 +2,10 @@ import { createPredicate } from '@swagger-api/apidom-core';
|
|
|
2
2
|
import JSONSchemaElement from "./elements/JSONSchema.mjs";
|
|
3
3
|
import LinkDescriptionElement from "./elements/LinkDescription.mjs";
|
|
4
4
|
export { isJSONReferenceElement, isMediaElement } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
5
9
|
export const isJSONSchemaElement = createPredicate(({
|
|
6
10
|
hasBasicElementProps,
|
|
7
11
|
isElementType,
|
|
@@ -9,6 +13,10 @@ export const isJSONSchemaElement = createPredicate(({
|
|
|
9
13
|
}) => {
|
|
10
14
|
return element => element instanceof JSONSchemaElement || hasBasicElementProps(element) && isElementType('JSONSchemaDraft6', element) && primitiveEq('object', element);
|
|
11
15
|
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
12
20
|
export const isLinkDescriptionElement = createPredicate(({
|
|
13
21
|
hasBasicElementProps,
|
|
14
22
|
isElementType,
|
package/src/refractor/index.cjs
CHANGED
|
@@ -8,6 +8,9 @@ var _apidomCore = require("@swagger-api/apidom-core");
|
|
|
8
8
|
var _specification = _interopRequireDefault(require("./specification.cjs"));
|
|
9
9
|
var _visitor = require("../traversal/visitor.cjs");
|
|
10
10
|
var _toolbox = _interopRequireDefault(require("./toolbox.cjs"));
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
11
14
|
const refract = (value, {
|
|
12
15
|
specPath = ['visitors', 'document', 'objects', 'JSONSchema', '$visitor'],
|
|
13
16
|
plugins = [],
|
|
@@ -38,6 +41,10 @@ const refract = (value, {
|
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
41
48
|
const createRefractor = specPath => (value, options = {}) => refract(value, {
|
|
42
49
|
specPath,
|
|
43
50
|
...options
|
package/src/refractor/index.mjs
CHANGED
|
@@ -3,6 +3,9 @@ import { visit, dereference, refract as baseRefract, dispatchRefractorPlugins }
|
|
|
3
3
|
import specification from "./specification.mjs";
|
|
4
4
|
import { keyMap, getNodeType } from "../traversal/visitor.mjs";
|
|
5
5
|
import createToolbox from "./toolbox.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
const refract = (value, {
|
|
7
10
|
specPath = ['visitors', 'document', 'objects', 'JSONSchema', '$visitor'],
|
|
8
11
|
plugins = [],
|
|
@@ -33,6 +36,10 @@ const refract = (value, {
|
|
|
33
36
|
}
|
|
34
37
|
});
|
|
35
38
|
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
36
43
|
export const createRefractor = specPath => (value, options = {}) => refract(value, {
|
|
37
44
|
specPath,
|
|
38
45
|
...options
|
|
@@ -183,6 +183,10 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
183
183
|
const keyMapping = schema[elementType] || schema[(0, _apidomCore.toValue)(ancestor.classes.first)];
|
|
184
184
|
return typeof keyMapping === 'undefined' ? undefined : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
185
185
|
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @public
|
|
189
|
+
*/
|
|
186
190
|
const plugin = () => () => ({
|
|
187
191
|
visitor: {
|
|
188
192
|
StringElement(element, key, parent, path, ancestors) {
|
|
@@ -176,6 +176,10 @@ const findElementFactory = (ancestor, keyName) => {
|
|
|
176
176
|
const keyMapping = schema[elementType] || schema[toValue(ancestor.classes.first)];
|
|
177
177
|
return typeof keyMapping === 'undefined' ? undefined : Object.prototype.hasOwnProperty.call(keyMapping, '[key: *]') ? keyMapping['[key: *]'] : keyMapping[keyName];
|
|
178
178
|
};
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
179
183
|
const plugin = () => () => ({
|
|
180
184
|
visitor: {
|
|
181
185
|
StringElement(element, key, parent, path, ancestors) {
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
5
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
class ExamplesVisitor extends _apidomNsJsonSchemaDraft.FallbackVisitor {
|
|
7
10
|
ArrayElement(arrayElement) {
|
|
8
11
|
const result = this.enter(arrayElement);
|
|
@@ -2,26 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
var _tsMixer = require("ts-mixer");
|
|
6
5
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
7
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return _apidomCore.BREAK;
|
|
13
|
-
}
|
|
14
|
-
ArrayElement(arrayElement) {
|
|
15
|
-
this.element = new _apidomCore.ArrayElement();
|
|
16
|
-
this.element.classes.push('json-schema-items');
|
|
17
|
-
arrayElement.forEach(item => {
|
|
18
|
-
const specPath = (0, _apidomNsJsonSchemaDraft.isJSONReferenceLikeElement)(item) ? ['document', 'objects', 'JSONReference'] : ['document', 'objects', 'JSONSchema'];
|
|
19
|
-
const element = this.toRefractedElement(specPath, item);
|
|
20
|
-
this.element.push(element);
|
|
21
|
-
});
|
|
22
|
-
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
23
|
-
return _apidomCore.BREAK;
|
|
24
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
class ItemsVisitor extends _apidomNsJsonSchemaDraft.ItemsVisitor {
|
|
25
11
|
BooleanElement(booleanElement) {
|
|
26
12
|
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], booleanElement);
|
|
27
13
|
return _apidomCore.BREAK;
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.element = this.toRefractedElement(specPath, objectElement);
|
|
8
|
-
return BREAK;
|
|
9
|
-
}
|
|
10
|
-
ArrayElement(arrayElement) {
|
|
11
|
-
this.element = new ArrayElement();
|
|
12
|
-
this.element.classes.push('json-schema-items');
|
|
13
|
-
arrayElement.forEach(item => {
|
|
14
|
-
const specPath = isJSONReferenceLikeElement(item) ? ['document', 'objects', 'JSONReference'] : ['document', 'objects', 'JSONSchema'];
|
|
15
|
-
const element = this.toRefractedElement(specPath, item);
|
|
16
|
-
this.element.push(element);
|
|
17
|
-
});
|
|
18
|
-
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
19
|
-
return BREAK;
|
|
20
|
-
}
|
|
1
|
+
import { BREAK } from '@swagger-api/apidom-core';
|
|
2
|
+
import { ItemsVisitor as JSONSchemaDraft4ItemsVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
class ItemsVisitor extends JSONSchemaDraft4ItemsVisitor {
|
|
21
7
|
BooleanElement(booleanElement) {
|
|
22
8
|
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], booleanElement);
|
|
23
9
|
return BREAK;
|
|
@@ -3,23 +3,28 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _tsMixer = require("ts-mixer");
|
|
7
|
-
var _ramda = require("ramda");
|
|
8
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
9
7
|
var _JSONSchema = _interopRequireDefault(require("../../../elements/JSONSchema.cjs"));
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class JSONSchemaVisitor extends _apidomNsJsonSchemaDraft.JSONSchemaVisitor {
|
|
11
12
|
constructor(options) {
|
|
12
13
|
super(options);
|
|
13
|
-
this.specPath = (0, _ramda.always)(['document', 'objects', 'JSONSchema']);
|
|
14
|
-
}
|
|
15
|
-
ObjectElement(objectElement) {
|
|
16
14
|
this.element = new _JSONSchema.default();
|
|
17
|
-
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line class-methods-use-this
|
|
18
|
+
get defaultDialectIdentifier() {
|
|
19
|
+
return 'http://json-schema.org/draft-06/schema#';
|
|
18
20
|
}
|
|
19
21
|
BooleanElement(booleanElement) {
|
|
20
22
|
const result = this.enter(booleanElement);
|
|
21
23
|
this.element.classes.push('boolean-json-schema');
|
|
22
24
|
return result;
|
|
23
25
|
}
|
|
26
|
+
handleSchemaIdentifier(objectElement, identifierKeyword = '$id') {
|
|
27
|
+
return super.handleSchemaIdentifier(objectElement, identifierKeyword);
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
var _default = exports.default = JSONSchemaVisitor;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { always } from 'ramda';
|
|
3
|
-
import { FixedFieldsVisitor, FallbackVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
1
|
+
import { JSONSchemaVisitor as JSONSchemaDraft4Visitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
4
2
|
import JSONSchemaElement from "../../../elements/JSONSchema.mjs";
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
class JSONSchemaVisitor extends JSONSchemaDraft4Visitor {
|
|
6
7
|
constructor(options) {
|
|
7
8
|
super(options);
|
|
8
|
-
this.specPath = always(['document', 'objects', 'JSONSchema']);
|
|
9
|
-
}
|
|
10
|
-
ObjectElement(objectElement) {
|
|
11
9
|
this.element = new JSONSchemaElement();
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line class-methods-use-this
|
|
13
|
+
get defaultDialectIdentifier() {
|
|
14
|
+
return 'http://json-schema.org/draft-06/schema#';
|
|
13
15
|
}
|
|
14
16
|
BooleanElement(booleanElement) {
|
|
15
17
|
const result = this.enter(booleanElement);
|
|
16
18
|
this.element.classes.push('boolean-json-schema');
|
|
17
19
|
return result;
|
|
18
20
|
}
|
|
21
|
+
handleSchemaIdentifier(objectElement, identifierKeyword = '$id') {
|
|
22
|
+
return super.handleSchemaIdentifier(objectElement, identifierKeyword);
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
export default JSONSchemaVisitor;
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _tsMixer = require("ts-mixer");
|
|
7
|
-
var _ramda = require("ramda");
|
|
8
6
|
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
9
7
|
var _LinkDescription = _interopRequireDefault(require("../../../../elements/LinkDescription.cjs"));
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
class LinkDescriptionVisitor extends _apidomNsJsonSchemaDraft.LinkDescriptionVisitor {
|
|
11
12
|
constructor(options) {
|
|
12
13
|
super(options);
|
|
13
14
|
this.element = new _LinkDescription.default();
|
|
14
|
-
this.specPath = (0, _ramda.always)(['document', 'objects', 'LinkDescription']);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
var _default = exports.default = LinkDescriptionVisitor;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { always } from 'ramda';
|
|
3
|
-
import { FixedFieldsVisitor, FallbackVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
1
|
+
import { LinkDescriptionVisitor as JSONSchemaDraft4LinkDescriptionVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
4
2
|
import LinkDescriptionElement from "../../../../elements/LinkDescription.mjs";
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
class LinkDescriptionVisitor extends JSONSchemaDraft4LinkDescriptionVisitor {
|
|
6
7
|
constructor(options) {
|
|
7
8
|
super(options);
|
|
8
9
|
this.element = new LinkDescriptionElement();
|
|
9
|
-
this.specPath = always(['document', 'objects', 'LinkDescription']);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export default LinkDescriptionVisitor;
|
|
@@ -3,14 +3,11 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.keyMap = exports.getNodeType = void 0;
|
|
5
5
|
var _apidomCore = require("@swagger-api/apidom-core");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return `${element.element.charAt(0).toUpperCase() + element.element.slice(1)}Element`;
|
|
12
|
-
};
|
|
13
|
-
exports.getNodeType = getNodeType;
|
|
6
|
+
var _apidomNsJsonSchemaDraft = require("@swagger-api/apidom-ns-json-schema-draft-4");
|
|
7
|
+
exports.getNodeType = _apidomNsJsonSchemaDraft.getNodeType;
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
14
11
|
const keyMap = exports.keyMap = {
|
|
15
12
|
JSONSchemaDraft6Element: ['content'],
|
|
16
13
|
JSONReferenceElement: ['content'],
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { keyMap as keyMapBase
|
|
1
|
+
import { keyMap as keyMapBase } from '@swagger-api/apidom-core';
|
|
2
|
+
export { getNodeType } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
return `${element.element.charAt(0).toUpperCase() + element.element.slice(1)}Element`;
|
|
9
|
-
};
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
10
7
|
export const keyMap = {
|
|
11
8
|
JSONSchemaDraft6Element: ['content'],
|
|
12
9
|
JSONReferenceElement: ['content'],
|