@swagger-api/apidom-ast 0.74.1 → 0.76.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 -18
- package/NOTICE +1 -1
- package/cjs/index.cjs +5 -1
- package/cjs/traversal/visitor.cjs +3 -2
- package/cjs/yaml/errors/YamlSchemaError.cjs +8 -0
- package/cjs/yaml/errors/YamlTagError.cjs +20 -0
- package/cjs/yaml/schemas/failsafe/index.cjs +15 -2
- package/dist/apidom-ast.browser.js +5825 -1544
- package/dist/apidom-ast.browser.min.js +1 -1
- package/es/index.js +4 -1
- package/es/traversal/visitor.js +4 -2
- package/es/yaml/errors/YamlSchemaError.js +3 -0
- package/es/yaml/errors/YamlTagError.js +20 -0
- package/es/yaml/schemas/failsafe/index.js +15 -2
- package/package.json +4 -3
- package/types/dist.d.ts +21 -1
package/CHANGELOG.md
CHANGED
@@ -3,46 +3,36 @@
|
|
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
|
-
|
7
|
-
|
8
|
-
**Note:** Version bump only for package @swagger-api/apidom-ast
|
9
|
-
|
10
|
-
|
6
|
+
# [0.76.0](https://github.com/swagger-api/apidom/compare/v0.75.0...v0.76.0) (2023-09-01)
|
11
7
|
|
8
|
+
### Bug Fixes
|
12
9
|
|
10
|
+
- **parser-adapter-yaml-1-2:** fix bug related to explicit tag resolution ([#3090](https://github.com/swagger-api/apidom/issues/3090)) ([8d8bdc4](https://github.com/swagger-api/apidom/commit/8d8bdc4168dfbb43614de2c4e89d11538647598c)), closes [#3039](https://github.com/swagger-api/apidom/issues/3039)
|
13
11
|
|
14
|
-
# [0.
|
12
|
+
# [0.75.0](https://github.com/swagger-api/apidom/compare/v0.74.1...v0.75.0) (2023-08-22)
|
15
13
|
|
16
14
|
**Note:** Version bump only for package @swagger-api/apidom-ast
|
17
15
|
|
16
|
+
## [0.74.1](https://github.com/swagger-api/apidom/compare/v0.74.0...v0.74.1) (2023-07-28)
|
18
17
|
|
18
|
+
**Note:** Version bump only for package @swagger-api/apidom-ast
|
19
19
|
|
20
|
+
# [0.74.0](https://github.com/swagger-api/apidom/compare/v0.73.0...v0.74.0) (2023-07-24)
|
20
21
|
|
22
|
+
**Note:** Version bump only for package @swagger-api/apidom-ast
|
21
23
|
|
22
24
|
# [0.73.0](https://github.com/swagger-api/apidom/compare/v0.72.0...v0.73.0) (2023-07-18)
|
23
25
|
|
24
26
|
**Note:** Version bump only for package @swagger-api/apidom-ast
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
28
|
# [0.72.0](https://github.com/swagger-api/apidom/compare/v0.71.1...v0.72.0) (2023-07-17)
|
31
29
|
|
32
30
|
**Note:** Version bump only for package @swagger-api/apidom-ast
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
32
|
# [0.71.0](https://github.com/swagger-api/apidom/compare/v0.70.4...v0.71.0) (2023-07-13)
|
39
33
|
|
40
34
|
**Note:** Version bump only for package @swagger-api/apidom-ast
|
41
35
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
36
|
# [0.70.0](https://github.com/swagger-api/apidom/compare/v0.69.3...v0.70.0) (2023-05-23)
|
47
37
|
|
48
38
|
**Note:** Version bump only for package @swagger-api/apidom-ast
|
package/NOTICE
CHANGED
@@ -38,7 +38,7 @@ Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
|
38
38
|
- File packages/apidom-core/src/deepmerge.ts contains algorithms that we originally created
|
39
39
|
in https://github.com/TehShrike/deepmerge/blob/master/index.js to handle deep merging of JavaScript Objects and Arrays.
|
40
40
|
These algorithms have been reverse engineered and adapted to support deep merging of ApiDOM structures.
|
41
|
-
- File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that
|
41
|
+
- File packages/apidom-core/test/deepmerge.ts contains tests and fixtures that were originally created
|
42
42
|
in https://github.com/TehShrike/deepmerge/blob/master/test/merge.js to test deep merging of JavaScript Objects and Arrays.
|
43
43
|
These tests have been adapted to support testing deep merging of ApiDOM structures.
|
44
44
|
- File packages/apidom-core/README.md contains text fragments that were originally created
|
package/cjs/index.cjs
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
4
|
exports.__esModule = true;
|
5
|
-
exports.visit = exports.mergeAllVisitors = exports.isYamlTag = exports.isYamlStream = exports.isYamlSequence = exports.isYamlScalar = exports.isYamlMapping = exports.isYamlKeyValuePair = exports.isYamlDocument = exports.isYamlDirective = exports.isYamlAlias = exports.isPosition = exports.isPoint = exports.isParseResult = exports.isNode = exports.isLiteral = exports.isJsonTrue = exports.isJsonStringContent = exports.isJsonString = exports.isJsonProperty = exports.isJsonObject = exports.isJsonNumber = exports.isJsonNull = exports.isJsonKey = exports.isJsonFalse = exports.isJsonEscapeSequence = exports.isJsonDocument = exports.isJsonArray = exports.getVisitFn = exports.getNodeType = exports.YamlTag = exports.YamlStyleGroup = exports.YamlStyle = exports.YamlStream = exports.YamlSequence = exports.YamlScalar = exports.YamlNodeKind = exports.YamlNode = exports.YamlMapping = exports.YamlKeyValuePair = exports.YamlJsonSchema = exports.YamlFailsafeSchema = exports.YamlDocument = exports.YamlDirective = exports.YamlComment = exports.YamlCollection = exports.YamlAnchor = exports.YamlAlias = exports.Position = exports.Point = exports.ParseResult = exports.Literal = exports.JsonValue = exports.JsonTrue = exports.JsonStringContent = exports.JsonString = exports.JsonProperty = exports.JsonObject = exports.JsonNumber = exports.JsonNull = exports.JsonNode = exports.JsonKey = exports.JsonFalse = exports.JsonEscapeSequence = exports.JsonDocument = exports.JsonArray = exports.Error = exports.BREAK = void 0;
|
5
|
+
exports.visit = exports.mergeAllVisitors = exports.isYamlTag = exports.isYamlStream = exports.isYamlSequence = exports.isYamlScalar = exports.isYamlMapping = exports.isYamlKeyValuePair = exports.isYamlDocument = exports.isYamlDirective = exports.isYamlAlias = exports.isPosition = exports.isPoint = exports.isParseResult = exports.isNode = exports.isLiteral = exports.isJsonTrue = exports.isJsonStringContent = exports.isJsonString = exports.isJsonProperty = exports.isJsonObject = exports.isJsonNumber = exports.isJsonNull = exports.isJsonKey = exports.isJsonFalse = exports.isJsonEscapeSequence = exports.isJsonDocument = exports.isJsonArray = exports.getVisitFn = exports.getNodeType = exports.YamlTagError = exports.YamlTag = exports.YamlStyleGroup = exports.YamlStyle = exports.YamlStream = exports.YamlSequence = exports.YamlSchemaError = exports.YamlScalar = exports.YamlNodeKind = exports.YamlNode = exports.YamlMapping = exports.YamlKeyValuePair = exports.YamlJsonSchema = exports.YamlFailsafeSchema = exports.YamlDocument = exports.YamlDirective = exports.YamlComment = exports.YamlCollection = exports.YamlAnchor = exports.YamlAlias = exports.Position = exports.Point = exports.ParseResult = exports.Literal = exports.JsonValue = exports.JsonTrue = exports.JsonStringContent = exports.JsonString = exports.JsonProperty = exports.JsonObject = exports.JsonNumber = exports.JsonNull = exports.JsonNode = exports.JsonKey = exports.JsonFalse = exports.JsonEscapeSequence = exports.JsonDocument = exports.JsonArray = exports.Error = exports.BREAK = void 0;
|
6
6
|
var _JsonNode = _interopRequireDefault(require("./json/nodes/JsonNode.cjs"));
|
7
7
|
exports.JsonNode = _JsonNode.default;
|
8
8
|
var _JsonDocument = _interopRequireDefault(require("./json/nodes/JsonDocument.cjs"));
|
@@ -88,6 +88,10 @@ exports.isYamlScalar = _predicates2.isScalar;
|
|
88
88
|
exports.isYamlSequence = _predicates2.isSequence;
|
89
89
|
exports.isYamlStream = _predicates2.isStream;
|
90
90
|
exports.isYamlTag = _predicates2.isTag;
|
91
|
+
var _YamlSchemaError = _interopRequireDefault(require("./yaml/errors/YamlSchemaError.cjs"));
|
92
|
+
exports.YamlSchemaError = _YamlSchemaError.default;
|
93
|
+
var _YamlTagError = _interopRequireDefault(require("./yaml/errors/YamlTagError.cjs"));
|
94
|
+
exports.YamlTagError = _YamlTagError.default;
|
91
95
|
var _Literal = _interopRequireDefault(require("./Literal.cjs"));
|
92
96
|
exports.Literal = _Literal.default;
|
93
97
|
var _Position = _interopRequireWildcard(require("./Position.cjs"));
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.visit = exports.mergeAll = exports.isNode = exports.getVisitFn = exports.getNodeType = exports.BREAK = void 0;
|
5
|
+
var _apidomError = require("@swagger-api/apidom-error");
|
5
6
|
/**
|
6
7
|
* SPDX-FileCopyrightText: Copyright (c) GraphQL Contributors
|
7
8
|
*
|
@@ -275,7 +276,7 @@ visitor, {
|
|
275
276
|
let result;
|
276
277
|
if (!Array.isArray(node)) {
|
277
278
|
if (!nodePredicate(node)) {
|
278
|
-
throw new
|
279
|
+
throw new _apidomError.ApiDOMError(`Invalid AST Node: ${JSON.stringify(node)}`);
|
279
280
|
}
|
280
281
|
// cycle detected; skipping over a sub-tree to avoid recursion
|
281
282
|
if (detectCycles && ancestors.includes(node)) {
|
@@ -425,7 +426,7 @@ visitor, {
|
|
425
426
|
let result;
|
426
427
|
if (!Array.isArray(node)) {
|
427
428
|
if (!nodePredicate(node)) {
|
428
|
-
throw new
|
429
|
+
throw new _apidomError.ApiDOMError(`Invalid AST Node: ${JSON.stringify(node)}`);
|
429
430
|
}
|
430
431
|
// cycle detected; skipping over a sub-tree to avoid recursion
|
431
432
|
if (detectCycles && ancestors.includes(node)) {
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
|
+
exports.__esModule = true;
|
5
|
+
exports.default = void 0;
|
6
|
+
var _YamlSchemaError = _interopRequireDefault(require("./YamlSchemaError.cjs"));
|
7
|
+
class YamlTagError extends _YamlSchemaError.default {
|
8
|
+
constructor(message, structuredOptions) {
|
9
|
+
super(message, structuredOptions);
|
10
|
+
if (typeof structuredOptions !== 'undefined') {
|
11
|
+
this.specificTagName = structuredOptions.specificTagName;
|
12
|
+
this.explicitTagName = structuredOptions.explicitTagName;
|
13
|
+
this.tagKind = structuredOptions.tagKind;
|
14
|
+
this.tagPosition = structuredOptions.tagPosition;
|
15
|
+
this.nodeCanonicalContent = structuredOptions.nodeCanonicalContent;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
var _default = YamlTagError;
|
20
|
+
exports.default = _default;
|
@@ -3,7 +3,9 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
4
4
|
exports.__esModule = true;
|
5
5
|
exports.default = void 0;
|
6
|
+
var _ramda = require("ramda");
|
6
7
|
var _stampit = _interopRequireDefault(require("stampit"));
|
8
|
+
var _YamlTagError = _interopRequireDefault(require("../../errors/YamlTagError.cjs"));
|
7
9
|
var _YamlTag = require("../../nodes/YamlTag.cjs");
|
8
10
|
var _GenericMapping = _interopRequireDefault(require("./GenericMapping.cjs"));
|
9
11
|
var _GenericSequence = _interopRequireDefault(require("./GenericSequence.cjs"));
|
@@ -81,12 +83,23 @@ const FailsafeSchema = (0, _stampit.default)({
|
|
81
83
|
|
82
84
|
// mechanism for resolving node (tag implementation) not found
|
83
85
|
if (typeof tag === 'undefined') {
|
84
|
-
throw new
|
86
|
+
throw new _YamlTagError.default(`Tag "${specificTagName}" was not recognized.`, {
|
87
|
+
specificTagName,
|
88
|
+
explicitTagName: node.tag.explicitName,
|
89
|
+
tagKind: node.tag.kind,
|
90
|
+
tagPosition: (0, _ramda.clone)(node.tag.position)
|
91
|
+
});
|
85
92
|
}
|
86
93
|
|
87
94
|
// node content is not compatible with resolving mechanism (tag implementation)
|
88
95
|
if (!tag.test(canonicalNode)) {
|
89
|
-
throw new
|
96
|
+
throw new _YamlTagError.default(`Node couldn't be resolved against the tag "${specificTagName}"`, {
|
97
|
+
specificTagName,
|
98
|
+
explicitTagName: node.tag.explicitName,
|
99
|
+
tagKind: node.tag.kind,
|
100
|
+
tagPosition: (0, _ramda.clone)(node.tag.position),
|
101
|
+
nodeCanonicalContent: canonicalNode.content
|
102
|
+
});
|
90
103
|
}
|
91
104
|
return tag.resolve(canonicalNode);
|
92
105
|
}
|