@swagger-api/apidom-ns-api-design-systems 0.76.2 → 0.77.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 +4 -0
- package/cjs/elements/Info.cjs +1 -2
- package/cjs/elements/Main.cjs +1 -2
- package/cjs/elements/Principle.cjs +1 -2
- package/cjs/elements/Requirement.cjs +1 -2
- package/cjs/elements/RequirementLevel.cjs +1 -2
- package/cjs/elements/Scenario.cjs +1 -2
- package/cjs/elements/Standard.cjs +1 -2
- package/cjs/elements/StandardIdentifier.cjs +1 -2
- package/cjs/media-types.cjs +1 -2
- package/cjs/namespace.cjs +1 -2
- package/cjs/predicates.cjs +9 -17
- package/cjs/refractor/index.cjs +1 -2
- package/cjs/refractor/plugins/openapi-3-1/standard-identifier-accessors.cjs +14 -19
- package/cjs/refractor/plugins/openapi-3-1/standard-identifier-selectors.cjs +10 -14
- package/cjs/refractor/specification.cjs +1 -2
- package/cjs/refractor/toolbox.cjs +1 -2
- package/cjs/refractor/visitors/FallbackVisitor.cjs +2 -3
- package/cjs/refractor/visitors/SpecificationVisitor.cjs +2 -3
- package/cjs/refractor/visitors/Visitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/info/DescriptionVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/info/TitleVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/info/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/main/PrinciplesVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/main/ScenariosVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/main/StandardsVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/main/VersionVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/main/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/principle/DescriptionVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/principle/IriVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/principle/NameVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/principle/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/requirement/FollowsVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/requirement/ValuesVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/requirement/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/requirement-level/index.cjs +2 -3
- package/cjs/refractor/visitors/api-design-systems/scenario/DescriptionVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/scenario/ThenVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/scenario/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/standard/DescriptionVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/standard/IriVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/standard/NameVisitor.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/standard/index.cjs +1 -2
- package/cjs/refractor/visitors/api-design-systems/standard-identifier/index.cjs +1 -2
- package/cjs/refractor/visitors/generics/FixedFieldsVisitor.cjs +6 -7
- package/cjs/traversal/visitor.cjs +2 -3
- package/cjs/validator/openapi-3-1/accessor.cjs +3 -4
- package/cjs/validator/openapi-3-1/selector.cjs +5 -6
- package/cjs/validator/openapi-3-1/validator.cjs +8 -9
- package/dist/apidom-ns-api-design-systems.browser.js +557 -148
- package/dist/apidom-ns-api-design-systems.browser.min.js +1 -1
- package/es/refractor/plugins/openapi-3-1/standard-identifier-accessors.mjs +14 -18
- package/es/refractor/plugins/openapi-3-1/standard-identifier-selectors.mjs +9 -12
- package/es/refractor/visitors/FallbackVisitor.mjs +2 -2
- package/es/refractor/visitors/SpecificationVisitor.mjs +2 -2
- package/es/refractor/visitors/api-design-systems/requirement-level/index.mjs +2 -2
- package/es/refractor/visitors/generics/FixedFieldsVisitor.mjs +6 -6
- package/es/validator/openapi-3-1/accessor.mjs +3 -3
- package/es/validator/openapi-3-1/selector.mjs +5 -5
- package/es/validator/openapi-3-1/validator.mjs +8 -8
- package/package.json +5 -5
|
@@ -26,14 +26,14 @@ const FixedFieldsVisitor = (0, _stampit.default)(_SpecificationVisitor.default,
|
|
|
26
26
|
const specPath = this.specPath(objectElement);
|
|
27
27
|
const fields = this.retrieveFixedFields(specPath);
|
|
28
28
|
objectElement.forEach((value, key, memberElement) => {
|
|
29
|
-
if ((0, _apidomCore.isStringElement)(key) && fields.includes(
|
|
30
|
-
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields',
|
|
31
|
-
const newMemberElement = new _apidomCore.MemberElement(
|
|
29
|
+
if ((0, _apidomCore.isStringElement)(key) && fields.includes((0, _apidomCore.toValue)(key)) && !this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
30
|
+
const fixedFieldElement = this.toRefractedElement([...specPath, 'fixedFields', (0, _apidomCore.toValue)(key)], value);
|
|
31
|
+
const newMemberElement = new _apidomCore.MemberElement((0, _apidomCore.cloneDeep)(key), fixedFieldElement);
|
|
32
32
|
newMemberElement.classes.push('fixed-field');
|
|
33
33
|
this.copyMetaAndAttributes(memberElement, newMemberElement);
|
|
34
34
|
this.element.content.push(newMemberElement);
|
|
35
|
-
} else if (!this.ignoredFields.includes(
|
|
36
|
-
this.element.content.push(
|
|
35
|
+
} else if (!this.ignoredFields.includes((0, _apidomCore.toValue)(key))) {
|
|
36
|
+
this.element.content.push((0, _apidomCore.cloneDeep)(memberElement));
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
this.copyMetaAndAttributes(objectElement, this.element);
|
|
@@ -41,5 +41,4 @@ const FixedFieldsVisitor = (0, _stampit.default)(_SpecificationVisitor.default,
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
var _default = FixedFieldsVisitor;
|
|
45
|
-
exports.default = _default;
|
|
44
|
+
var _default = exports.default = FixedFieldsVisitor;
|
|
@@ -11,7 +11,7 @@ const getNodeType = element => {
|
|
|
11
11
|
return `${element.element.charAt(0).toUpperCase() + element.element.slice(1)}Element`;
|
|
12
12
|
};
|
|
13
13
|
exports.getNodeType = getNodeType;
|
|
14
|
-
const keyMap = {
|
|
14
|
+
const keyMap = exports.keyMap = {
|
|
15
15
|
/**
|
|
16
16
|
* API Design Systems 2021-05-07 specification elements.
|
|
17
17
|
*/
|
|
@@ -24,5 +24,4 @@ const keyMap = {
|
|
|
24
24
|
StandardIdentifierElement: ['content'],
|
|
25
25
|
RequirementLevelElement: [],
|
|
26
26
|
..._apidomCore.keyMap
|
|
27
|
-
};
|
|
28
|
-
exports.keyMap = keyMap;
|
|
27
|
+
};
|
|
@@ -13,13 +13,13 @@ const visitorOptions = {
|
|
|
13
13
|
nodeTypeGetter: _apidomNsOpenapi.getNodeType
|
|
14
14
|
};
|
|
15
15
|
const access = (selected, standardIdentifier) => {
|
|
16
|
-
const strStandardIdentifier = String(
|
|
16
|
+
const strStandardIdentifier = String((0, _apidomCore.toValue)(standardIdentifier));
|
|
17
17
|
const values = new _apidomCore.ArrayElement();
|
|
18
18
|
const visitor = {
|
|
19
19
|
enter(element) {
|
|
20
20
|
if (!element.meta.hasKey('ads-a-standard-identifier')) return;
|
|
21
21
|
element.meta.get('ads-a-standard-identifier').content.filter(accessorMapping => {
|
|
22
|
-
return String(accessorMapping.get('subject')
|
|
22
|
+
return String((0, _apidomCore.toValue)(accessorMapping.get('subject'))) === strStandardIdentifier;
|
|
23
23
|
}).forEach(accessorMapping => {
|
|
24
24
|
values.push(accessorMapping.get('value'));
|
|
25
25
|
});
|
|
@@ -28,5 +28,4 @@ const access = (selected, standardIdentifier) => {
|
|
|
28
28
|
(0, _apidomCore.visit)(selected, visitor, visitorOptions);
|
|
29
29
|
return values;
|
|
30
30
|
};
|
|
31
|
-
var _default = access;
|
|
32
|
-
exports.default = _default;
|
|
31
|
+
var _default = exports.default = access;
|
|
@@ -18,15 +18,15 @@ const select = (openAPIElement, standardIdentifier) => {
|
|
|
18
18
|
const visitor = {
|
|
19
19
|
OperationElement(element) {
|
|
20
20
|
if (!element.meta.hasKey('ads-s-standard-identifier')) return;
|
|
21
|
-
const standardIdentifiers = element.meta.get('ads-s-standard-identifier')
|
|
22
|
-
if ((0, _ramda.includes)(
|
|
21
|
+
const standardIdentifiers = (0, _apidomCore.toValue)(element.meta.get('ads-s-standard-identifier'));
|
|
22
|
+
if ((0, _ramda.includes)((0, _apidomCore.toValue)(standardIdentifier), standardIdentifiers)) {
|
|
23
23
|
selected.push(element);
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
ResponseElement(element) {
|
|
27
27
|
if (!element.meta.hasKey('ads-s-standard-identifier')) return;
|
|
28
|
-
const standardIdentifiers = element.meta.get('ads-s-standard-identifier')
|
|
29
|
-
if ((0, _ramda.includes)(
|
|
28
|
+
const standardIdentifiers = (0, _apidomCore.toValue)(element.meta.get('ads-s-standard-identifier'));
|
|
29
|
+
if ((0, _ramda.includes)((0, _apidomCore.toValue)(standardIdentifier), standardIdentifiers)) {
|
|
30
30
|
selected.push(element);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -34,5 +34,4 @@ const select = (openAPIElement, standardIdentifier) => {
|
|
|
34
34
|
(0, _apidomCore.visit)(openAPIElement, visitor, visitorOptions);
|
|
35
35
|
return selected;
|
|
36
36
|
};
|
|
37
|
-
var _default = select;
|
|
38
|
-
exports.default = _default;
|
|
37
|
+
var _default = exports.default = select;
|
|
@@ -9,9 +9,9 @@ var _selector = _interopRequireDefault(require("./selector.cjs"));
|
|
|
9
9
|
var _accessor = _interopRequireDefault(require("./accessor.cjs"));
|
|
10
10
|
var _requirementLevel = require("./requirement-level.cjs");
|
|
11
11
|
const makeMessage = (value, requirementLevel, standardIdentifier) => {
|
|
12
|
-
const primitiveValue =
|
|
13
|
-
const primitiveStandardIdentifier = JSON.stringify(
|
|
14
|
-
if (
|
|
12
|
+
const primitiveValue = (0, _apidomCore.toValue)(value);
|
|
13
|
+
const primitiveStandardIdentifier = JSON.stringify((0, _apidomCore.toValue)(standardIdentifier));
|
|
14
|
+
if ((0, _apidomCore.toValue)(requirementLevel) === 'may') {
|
|
15
15
|
return `"${primitiveValue}" not allowed for subject ${primitiveStandardIdentifier}`;
|
|
16
16
|
}
|
|
17
17
|
throw new _apidomError.NotImplementedError('[Requirement levels] other than "may" are currently not implemented.');
|
|
@@ -21,8 +21,8 @@ const makeMessage = (value, requirementLevel, standardIdentifier) => {
|
|
|
21
21
|
const makeAnnotation = (message, value, level, standardIdentifier) => {
|
|
22
22
|
const annotation = new _apidomCore.AnnotationElement(message);
|
|
23
23
|
annotation.classes.push(level);
|
|
24
|
-
annotation.attributes.set('value',
|
|
25
|
-
annotation.attributes.set('standardIdentifier',
|
|
24
|
+
annotation.attributes.set('value', (0, _apidomCore.cloneDeep)(value));
|
|
25
|
+
annotation.attributes.set('standardIdentifier', (0, _apidomCore.cloneDeep)(standardIdentifier));
|
|
26
26
|
return annotation;
|
|
27
27
|
};
|
|
28
28
|
const validateValue = (value, requirement) => {
|
|
@@ -31,8 +31,8 @@ const validateValue = (value, requirement) => {
|
|
|
31
31
|
subject
|
|
32
32
|
} = requirement;
|
|
33
33
|
if (typeof requirement.values === 'undefined') return annotations;
|
|
34
|
-
if (requirement.level
|
|
35
|
-
const isValid = (0, _requirementLevel.may)(
|
|
34
|
+
if ((0, _apidomCore.toValue)(requirement.level) === 'may') {
|
|
35
|
+
const isValid = (0, _requirementLevel.may)((0, _apidomCore.toValue)(value), (0, _apidomCore.toValue)(requirement.values));
|
|
36
36
|
if (!isValid) {
|
|
37
37
|
const message = makeMessage(value, requirement.level, subject);
|
|
38
38
|
const annotation = makeAnnotation(message, value, 'error', subject);
|
|
@@ -83,5 +83,4 @@ const validate = (mainElement, openApiElement) => {
|
|
|
83
83
|
});
|
|
84
84
|
return annotations;
|
|
85
85
|
};
|
|
86
|
-
var _default = validate;
|
|
87
|
-
exports.default = _default;
|
|
86
|
+
var _default = exports.default = validate;
|