Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/languageservice/services/yamlSchemaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,15 @@ export class YAMLSchemaService extends JSONSchemaService {
toValidate = _cloneSchema(node, new Map(), stopAtDialectBoundary) as JSONSchema;
}

if (!validator(toValidate)) {
let valid = false;
try {
valid = validator(toValidate);
} catch (e) {
// AJV overflows on recursive/cyclic schemas; attempt to degrade gracefully
console.warn(l10n.t("Schema '{0}' could not be fully validated: {1}", loc, e.message));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to report this as a warning or error on the text document and provide translations for this message, but I think this is good for now.

return;
}
if (!valid) {
localizeAjvErrors(validator.errors, ajvErrorLocale);
const errs: string[] = [];
for (const err of validator.errors as DefinedError[]) {
Expand Down
Loading