From 66ebb23e9fba00d7d1d78b6b9881685a8681a718 Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Tue, 15 Oct 2024 12:02:54 +0200 Subject: [PATCH] fix(yaml): allow filtering of invalid multidoc --- lib/util/yaml.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util/yaml.ts b/lib/util/yaml.ts index e483b762cf39d6..ac38840ead54dc 100644 --- a/lib/util/yaml.ts +++ b/lib/util/yaml.ts @@ -63,19 +63,19 @@ export function parseYaml( const results: ResT[] = []; for (const rawDocument of rawDocuments) { - const document = rawDocument.toJS({ maxAliasCount: 10000 }); - const errors = rawDocument.errors; // handle YAML parse errors if (errors?.length) { const error = new AggregateError(errors, 'Failed to parse YAML file'); if (options?.failureBehaviour === 'filter') { - logger.debug({ error, document }, 'Failed to parse YAML'); + logger.debug(`Failed to parse YAML file: ${error.message}`); continue; } throw error; } + const document = rawDocument.toJS({ maxAliasCount: 10000 }); + // skip schema validation if no schema is provided if (!schema) { results.push(document as ResT);