@swagger-api/apidom-ast
Advanced tools
Comparing version 0.75.0 to 0.76.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [0.76.0](https://github.com/swagger-api/apidom/compare/v0.75.0...v0.76.0) (2023-09-01) | ||
### Bug Fixes | ||
- **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) | ||
# [0.75.0](https://github.com/swagger-api/apidom/compare/v0.74.1...v0.75.0) (2023-08-22) | ||
@@ -8,0 +14,0 @@ |
@@ -33,3 +33,6 @@ // JSON AST related exports | ||
export { default as YamlJsonSchema } from "./yaml/schemas/json/index.js"; | ||
export { isAlias as isYamlAlias, isKeyValuePair as isYamlKeyValuePair, isDirective as isYamlDirective, isDocument as isYamlDocument, isMapping as isYamlMapping, isScalar as isYamlScalar, isSequence as isYamlSequence, isStream as isYamlStream, isTag as isYamlTag } from "./yaml/nodes/predicates.js"; // generic AST related exports | ||
export { isAlias as isYamlAlias, isKeyValuePair as isYamlKeyValuePair, isDirective as isYamlDirective, isDocument as isYamlDocument, isMapping as isYamlMapping, isScalar as isYamlScalar, isSequence as isYamlSequence, isStream as isYamlStream, isTag as isYamlTag } from "./yaml/nodes/predicates.js"; | ||
export { default as YamlSchemaError } from "./yaml/errors/YamlSchemaError.js"; | ||
export { default as YamlTagError } from "./yaml/errors/YamlTagError.js"; | ||
// generic AST related exports | ||
export { default as Literal } from "./Literal.js"; | ||
@@ -36,0 +39,0 @@ export { Point, default as Position } from "./Position.js"; |
@@ -0,1 +1,3 @@ | ||
import { ApiDOMError } from '@swagger-api/apidom-error'; | ||
/** | ||
@@ -269,3 +271,3 @@ * SPDX-FileCopyrightText: Copyright (c) GraphQL Contributors | ||
if (!nodePredicate(node)) { | ||
throw new Error(`Invalid AST Node: ${JSON.stringify(node)}`); | ||
throw new ApiDOMError(`Invalid AST Node: ${JSON.stringify(node)}`); | ||
} | ||
@@ -419,3 +421,3 @@ // cycle detected; skipping over a sub-tree to avoid recursion | ||
if (!nodePredicate(node)) { | ||
throw new Error(`Invalid AST Node: ${JSON.stringify(node)}`); | ||
throw new ApiDOMError(`Invalid AST Node: ${JSON.stringify(node)}`); | ||
} | ||
@@ -422,0 +424,0 @@ // cycle detected; skipping over a sub-tree to avoid recursion |
@@ -0,2 +1,4 @@ | ||
import { clone } from 'ramda'; | ||
import stampit from 'stampit'; | ||
import YamlTagError from "../../errors/YamlTagError.js"; | ||
import { YamlNodeKind } from "../../nodes/YamlTag.js"; | ||
@@ -79,3 +81,8 @@ import GenericMapping from "./GenericMapping.js"; | ||
if (typeof tag === 'undefined') { | ||
throw new Error(`Tag "${specificTagName}" couldn't be resolved`); | ||
throw new YamlTagError(`Tag "${specificTagName}" was not recognized.`, { | ||
specificTagName, | ||
explicitTagName: node.tag.explicitName, | ||
tagKind: node.tag.kind, | ||
tagPosition: clone(node.tag.position) | ||
}); | ||
} | ||
@@ -85,3 +92,9 @@ | ||
if (!tag.test(canonicalNode)) { | ||
throw new Error(`Node couldn't be resolved against tag "${specificTagName}"`); | ||
throw new YamlTagError(`Node couldn't be resolved against the tag "${specificTagName}"`, { | ||
specificTagName, | ||
explicitTagName: node.tag.explicitName, | ||
tagKind: node.tag.kind, | ||
tagPosition: clone(node.tag.position), | ||
nodeCanonicalContent: canonicalNode.content | ||
}); | ||
} | ||
@@ -88,0 +101,0 @@ return tag.resolve(canonicalNode); |
{ | ||
"name": "@swagger-api/apidom-ast", | ||
"version": "0.75.0", | ||
"version": "0.76.0", | ||
"description": "Tools necessary for parsing stage of ApiDOM, specifically for syntactic analysis.", | ||
@@ -45,2 +45,3 @@ "publishConfig": { | ||
"@babel/runtime-corejs3": "^7.20.7", | ||
"@swagger-api/apidom-error": "^0.76.0", | ||
"@types/ramda": "~0.29.3", | ||
@@ -62,3 +63,3 @@ "ramda": "~0.29.0", | ||
], | ||
"gitHead": "1be099d8de39f3fb703cbb5e3f59076e1110fd9b" | ||
"gitHead": "ce497d1083df34162b9cf2047d6cbd8843af3314" | ||
} |
import stampit from 'stampit'; | ||
import { ApiDOMStructuredError, ApiDOMErrorOptions } from '@swagger-api/apidom-error'; | ||
@@ -216,2 +217,21 @@ interface Point { | ||
declare class YamlSchemaError extends ApiDOMStructuredError { | ||
} | ||
interface YamlTagErrorOptions extends ApiDOMErrorOptions { | ||
readonly specificTagName: string; | ||
readonly explicitTagName: string; | ||
readonly tagKind: string; | ||
readonly tagPosition?: Position; | ||
readonly nodeCanonicalContent?: string; | ||
} | ||
declare class YamlTagError extends YamlSchemaError { | ||
readonly specificTagName: string; | ||
readonly explicitTagName: string; | ||
readonly tagKind: string; | ||
readonly tagPosition?: Position; | ||
readonly nodeCanonicalContent?: string; | ||
constructor(message?: string, structuredOptions?: YamlTagErrorOptions); | ||
} | ||
interface Literal extends Node$1 { | ||
@@ -363,2 +383,2 @@ type: 'literal'; | ||
export { BREAK, Error, JsonArray, JsonDocument, JsonEscapeSequence, JsonFalse, JsonKey, JsonNode, JsonNull, JsonNumber, JsonObject, JsonProperty, JsonString, JsonStringContent, JsonTrue, JsonValue, Literal, ParseResult, Point, Position, YamlAlias, YamlAnchor, YamlCollection, YamlComment, YamlDirective, YamlDocument, FailsafeSchema as YamlFailsafeSchema, JsonSchema as YamlJsonSchema, YamlKeyValuePair, YamlMapping, YamlNode, YamlNodeKind, YamlScalar, YamlSequence, YamlStream, YamlStyle, YamlStyleGroup, YamlTag, getNodeType, getVisitFn, isArray as isJsonArray, isDocument$1 as isJsonDocument, isEscapeSequence as isJsonEscapeSequence, isFalse as isJsonFalse, isKey as isJsonKey, isNull as isJsonNull, isNumber as isJsonNumber, isObject as isJsonObject, isProperty as isJsonProperty, isString as isJsonString, isStringContent as isJsonStringContent, isTrue as isJsonTrue, isLiteral, isNode, isParseResult, isPoint, isPosition, isAlias as isYamlAlias, isDirective as isYamlDirective, isDocument as isYamlDocument, isKeyValuePair as isYamlKeyValuePair, isMapping as isYamlMapping, isScalar as isYamlScalar, isSequence as isYamlSequence, isStream as isYamlStream, isTag as isYamlTag, mergeAll as mergeAllVisitors, visit }; | ||
export { BREAK, Error, JsonArray, JsonDocument, JsonEscapeSequence, JsonFalse, JsonKey, JsonNode, JsonNull, JsonNumber, JsonObject, JsonProperty, JsonString, JsonStringContent, JsonTrue, JsonValue, Literal, ParseResult, Point, Position, YamlAlias, YamlAnchor, YamlCollection, YamlComment, YamlDirective, YamlDocument, FailsafeSchema as YamlFailsafeSchema, JsonSchema as YamlJsonSchema, YamlKeyValuePair, YamlMapping, YamlNode, YamlNodeKind, YamlScalar, YamlSchemaError, YamlSequence, YamlStream, YamlStyle, YamlStyleGroup, YamlTag, YamlTagError, YamlTagErrorOptions, getNodeType, getVisitFn, isArray as isJsonArray, isDocument$1 as isJsonDocument, isEscapeSequence as isJsonEscapeSequence, isFalse as isJsonFalse, isKey as isJsonKey, isNull as isJsonNull, isNumber as isJsonNumber, isObject as isJsonObject, isProperty as isJsonProperty, isString as isJsonString, isStringContent as isJsonStringContent, isTrue as isJsonTrue, isLiteral, isNode, isParseResult, isPoint, isPosition, isAlias as isYamlAlias, isDirective as isYamlDirective, isDocument as isYamlDocument, isKeyValuePair as isYamlKeyValuePair, isMapping as isYamlMapping, isScalar as isYamlScalar, isSequence as isYamlSequence, isStream as isYamlStream, isTag as isYamlTag, mergeAll as mergeAllVisitors, visit }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1158060
114
25157
7
+ Added@swagger-api/apidom-error@0.76.2(transitive)