@swagger-api/apidom-ns-json-schema-draft-6 0.99.1 → 1.0.0-alpha.0
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 +8 -0
- package/cjs/index.cjs +2 -1
- package/cjs/refractor/index.cjs +5 -7
- package/cjs/refractor/specification.cjs +2 -5
- package/cjs/refractor/visitors/json-schema/ExamplesVisitor.cjs +6 -11
- package/cjs/refractor/visitors/json-schema/ItemsVisitor.cjs +22 -25
- package/cjs/refractor/visitors/json-schema/index.cjs +15 -19
- package/cjs/refractor/visitors/json-schema/link-description/index.cjs +6 -7
- package/dist/apidom-ns-json-schema-draft-6.browser.js +1 -1
- package/es/index.mjs +1 -1
- package/es/refractor/index.mjs +5 -7
- package/es/refractor/specification.mjs +2 -5
- package/es/refractor/visitors/json-schema/ExamplesVisitor.mjs +6 -10
- package/es/refractor/visitors/json-schema/ItemsVisitor.mjs +22 -24
- package/es/refractor/visitors/json-schema/index.mjs +15 -19
- package/es/refractor/visitors/json-schema/link-description/index.mjs +6 -7
- package/package.json +8 -8
- package/types/dist.d.ts +265 -113
- package/cjs/refractor/visitors/json-schema/$idVisitor.cjs +0 -7
- package/cjs/refractor/visitors/json-schema/ConstVisitor.cjs +0 -7
- package/cjs/refractor/visitors/json-schema/link-description/SubmissionEncTypeVisitor.cjs +0 -7
- package/es/refractor/visitors/json-schema/$idVisitor.mjs +0 -3
- package/es/refractor/visitors/json-schema/ConstVisitor.mjs +0 -3
- package/es/refractor/visitors/json-schema/link-description/SubmissionEncTypeVisitor.mjs +0 -3
package/es/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ export { default as refractorPluginReplaceEmptyElement } from "./refractor/plugi
|
|
|
5
5
|
export { default as refract, createRefractor } from "./refractor/index.mjs";
|
|
6
6
|
export { default as specificationObj } from "./refractor/specification.mjs";
|
|
7
7
|
export { isJSONReferenceElement, isJSONSchemaElement, isLinkDescriptionElement, isMediaElement } from "./predicates.mjs";
|
|
8
|
-
export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
8
|
+
export { isJSONReferenceLikeElement, SpecificationVisitor, FallbackVisitor, FixedFieldsVisitor, PatternedFieldsVisitor, MapVisitor, AlternatingVisitor, ParentSchemaAwareVisitor, Visitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
9
9
|
export { keyMap, getNodeType } from "./traversal/visitor.mjs";
|
|
10
10
|
/**
|
|
11
11
|
* JSON Schema Draft 6 specification elements.
|
package/es/refractor/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { path } from 'ramda';
|
|
2
2
|
import { visit, dereference, refract as baseRefract, dispatchRefractorPlugins } from '@swagger-api/apidom-core';
|
|
3
3
|
import specification from "./specification.mjs";
|
|
4
4
|
import { keyMap, getNodeType } from "../traversal/visitor.mjs";
|
|
@@ -16,13 +16,11 @@ const refract = (value, {
|
|
|
16
16
|
* We don't allow consumers to hook into this translation.
|
|
17
17
|
* Though we allow consumers to define their onw plugins on already transformed ApiDOM.
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
state: {
|
|
23
|
-
specObj: resolvedSpec
|
|
24
|
-
}
|
|
19
|
+
const RootVisitorClass = path(specPath, resolvedSpec);
|
|
20
|
+
const rootVisitor = new RootVisitorClass({
|
|
21
|
+
specObj: resolvedSpec
|
|
25
22
|
});
|
|
23
|
+
visit(element, rootVisitor);
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
26
|
* Running plugins visitors means extra single traversal === performance hit.
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { pipe, assocPath, dissocPath } from 'ramda';
|
|
2
2
|
import { specificationObj } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
3
3
|
import JSONSchemaVisitor from "./visitors/json-schema/index.mjs";
|
|
4
|
-
import JSONSchema$idVisitor from "./visitors/json-schema/$idVisitor.mjs";
|
|
5
4
|
import JSONSchemaItemsVisitor from "./visitors/json-schema/ItemsVisitor.mjs";
|
|
6
|
-
import JSONSchemaConstVisitor from "./visitors/json-schema/ConstVisitor.mjs";
|
|
7
5
|
import JSONSchemaExamplesVisitor from "./visitors/json-schema/ExamplesVisitor.mjs";
|
|
8
6
|
import LinkDescriptionVisitor from "./visitors/json-schema/link-description/index.mjs";
|
|
9
|
-
import LinkDescriptionSubmissionEncTypeVisitor from "./visitors/json-schema/link-description/SubmissionEncTypeVisitor.mjs";
|
|
10
7
|
const specification = pipe(
|
|
11
8
|
// JSON Schema object modifications
|
|
12
|
-
assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'id']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$id'],
|
|
9
|
+
assocPath(['visitors', 'document', 'objects', 'JSONSchema', '$visitor'], JSONSchemaVisitor), dissocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'id']), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', '$id'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'contains'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'items'], JSONSchemaItemsVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'propertyNames'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'const'], specificationObj.visitors.value), assocPath(['visitors', 'document', 'objects', 'JSONSchema', 'fixedFields', 'examples'], JSONSchemaExamplesVisitor),
|
|
13
10
|
// Link Description object modifications
|
|
14
|
-
assocPath(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], LinkDescriptionVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'schema']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'method']), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'encType']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionEncType'],
|
|
11
|
+
assocPath(['visitors', 'document', 'objects', 'LinkDescription', '$visitor'], LinkDescriptionVisitor), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'hrefSchema'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'schema']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionSchema'], specificationObj.visitors.JSONSchemaOrJSONReferenceVisitor), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'method']), dissocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'encType']), assocPath(['visitors', 'document', 'objects', 'LinkDescription', 'fixedFields', 'submissionEncType'], specificationObj.visitors.value))(specificationObj);
|
|
15
12
|
export default specification;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import stampit from 'stampit';
|
|
2
|
-
import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
|
|
3
1
|
import { FallbackVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return BREAK;
|
|
10
|
-
}
|
|
2
|
+
class ExamplesVisitor extends FallbackVisitor {
|
|
3
|
+
ArrayElement(arrayElement) {
|
|
4
|
+
const result = this.enter(arrayElement);
|
|
5
|
+
this.element.classes.push('json-schema-examples');
|
|
6
|
+
return result;
|
|
11
7
|
}
|
|
12
|
-
}
|
|
8
|
+
}
|
|
13
9
|
export default ExamplesVisitor;
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Mixin } from 'ts-mixer';
|
|
2
2
|
import { ArrayElement, BREAK } from '@swagger-api/apidom-core';
|
|
3
3
|
import { SpecificationVisitor, FallbackVisitor, ParentSchemaAwareVisitor, isJSONReferenceLikeElement } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return BREAK;
|
|
10
|
-
},
|
|
11
|
-
ArrayElement(arrayElement) {
|
|
12
|
-
this.element = new ArrayElement();
|
|
13
|
-
this.element.classes.push('json-schema-items');
|
|
14
|
-
arrayElement.forEach(item => {
|
|
15
|
-
const specPath = isJSONReferenceLikeElement(item) ? ['document', 'objects', 'JSONReference'] : ['document', 'objects', 'JSONSchema'];
|
|
16
|
-
const element = this.toRefractedElement(specPath, item);
|
|
17
|
-
this.element.push(element);
|
|
18
|
-
});
|
|
19
|
-
this.copyMetaAndAttributes(arrayElement, this.element);
|
|
20
|
-
return BREAK;
|
|
21
|
-
},
|
|
22
|
-
BooleanElement(booleanElement) {
|
|
23
|
-
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], booleanElement);
|
|
24
|
-
return BREAK;
|
|
25
|
-
}
|
|
4
|
+
class ItemsVisitor extends Mixin(SpecificationVisitor, ParentSchemaAwareVisitor, FallbackVisitor) {
|
|
5
|
+
ObjectElement(objectElement) {
|
|
6
|
+
const specPath = isJSONReferenceLikeElement(objectElement) ? ['document', 'objects', 'JSONReference'] : ['document', 'objects', 'JSONSchema'];
|
|
7
|
+
this.element = this.toRefractedElement(specPath, objectElement);
|
|
8
|
+
return BREAK;
|
|
26
9
|
}
|
|
27
|
-
|
|
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
|
+
}
|
|
21
|
+
BooleanElement(booleanElement) {
|
|
22
|
+
this.element = this.toRefractedElement(['document', 'objects', 'JSONSchema'], booleanElement);
|
|
23
|
+
return BREAK;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
28
26
|
export default ItemsVisitor;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Mixin } from 'ts-mixer';
|
|
2
2
|
import { always } from 'ramda';
|
|
3
|
-
import { BREAK, cloneDeep } from '@swagger-api/apidom-core';
|
|
4
3
|
import { FixedFieldsVisitor, FallbackVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
5
4
|
import JSONSchemaElement from "../../../elements/JSONSchema.mjs";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
methods: {
|
|
11
|
-
ObjectElement(objectElement) {
|
|
12
|
-
this.element = new JSONSchemaElement();
|
|
13
|
-
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
return FixedFieldsVisitor.compose.methods.ObjectElement.call(this, objectElement);
|
|
16
|
-
},
|
|
17
|
-
BooleanElement(booleanElement) {
|
|
18
|
-
this.element = cloneDeep(booleanElement);
|
|
19
|
-
this.element.classes.push('boolean-json-schema');
|
|
20
|
-
return BREAK;
|
|
21
|
-
}
|
|
5
|
+
class JSONSchemaVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options);
|
|
8
|
+
this.specPath = always(['document', 'objects', 'JSONSchema']);
|
|
22
9
|
}
|
|
23
|
-
|
|
10
|
+
ObjectElement(objectElement) {
|
|
11
|
+
this.element = new JSONSchemaElement();
|
|
12
|
+
return FixedFieldsVisitor.prototype.ObjectElement.call(this, objectElement);
|
|
13
|
+
}
|
|
14
|
+
BooleanElement(booleanElement) {
|
|
15
|
+
const result = this.enter(booleanElement);
|
|
16
|
+
this.element.classes.push('boolean-json-schema');
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
24
20
|
export default JSONSchemaVisitor;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Mixin } from 'ts-mixer';
|
|
2
2
|
import { always } from 'ramda';
|
|
3
3
|
import { FixedFieldsVisitor, FallbackVisitor } from '@swagger-api/apidom-ns-json-schema-draft-4';
|
|
4
4
|
import LinkDescriptionElement from "../../../../elements/LinkDescription.mjs";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
init() {
|
|
5
|
+
class LinkDescriptionVisitor extends Mixin(FixedFieldsVisitor, FallbackVisitor) {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options);
|
|
10
8
|
this.element = new LinkDescriptionElement();
|
|
9
|
+
this.specPath = always(['document', 'objects', 'LinkDescription']);
|
|
11
10
|
}
|
|
12
|
-
}
|
|
11
|
+
}
|
|
13
12
|
export default LinkDescriptionVisitor;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swagger-api/apidom-ns-json-schema-draft-6",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "JSON Schema Draft 6 namespace for ApiDOM.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime-corejs3": "^7.20.7",
|
|
45
|
-
"@swagger-api/apidom-core": "^0.
|
|
45
|
+
"@swagger-api/apidom-core": "^1.0.0-alpha.0",
|
|
46
46
|
"@swagger-api/apidom-error": "^0.99.0",
|
|
47
|
-
"@swagger-api/apidom-ns-json-schema-draft-4": "^0.
|
|
48
|
-
"@types/ramda": "~0.
|
|
49
|
-
"ramda": "~0.
|
|
50
|
-
"ramda-adjunct": "^
|
|
51
|
-
"
|
|
47
|
+
"@swagger-api/apidom-ns-json-schema-draft-4": "^1.0.0-alpha.0",
|
|
48
|
+
"@types/ramda": "~0.30.0",
|
|
49
|
+
"ramda": "~0.30.0",
|
|
50
|
+
"ramda-adjunct": "^5.0.0",
|
|
51
|
+
"ts-mixer": "^6.0.4"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
54
54
|
"cjs/",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"README.md",
|
|
61
61
|
"CHANGELOG.md"
|
|
62
62
|
],
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "b126995cc9e0f0c986c581aaa8b3fd1c35dfbdf7"
|
|
64
64
|
}
|