From 6184624d07e21c0bad6df3aef52ba75945418000 Mon Sep 17 00:00:00 2001 From: Matt Tolhurst Date: Fri, 13 Jan 2023 17:19:24 +1100 Subject: [PATCH] Fixes cleaned up errors still logging doc path --- .../yaml-anchors-aliases.spec.js | 19 +++++++++++++++++++ src/specification.js | 1 + 2 files changed, 20 insertions(+) diff --git a/examples/yaml-anchors-aliases/yaml-anchors-aliases.spec.js b/examples/yaml-anchors-aliases/yaml-anchors-aliases.spec.js index 9ce1049..80b8a47 100644 --- a/examples/yaml-anchors-aliases/yaml-anchors-aliases.spec.js +++ b/examples/yaml-anchors-aliases/yaml-anchors-aliases.spec.js @@ -18,4 +18,23 @@ describe('Example for using anchors and aliases in YAML documents', () => { }); expect(result).toEqual(referenceSpecification); }); + + it('should not throw errors that have been cleaned up', () => { + expect(() => { + swaggerJsdoc({ + swaggerDefinition: { + info: { + title: 'Example with anchors and aliases', + version: '0.0.1', + }, + }, + failOnErrors: true, + apis: [ + './examples/yaml-anchors-aliases/x-amazon-apigateway-integrations.yaml', + './examples/yaml-anchors-aliases/properties/*.yml', + './examples/yaml-anchors-aliases/example.js', + ], + }); + }).not.toThrowError(); + }); }); diff --git a/src/specification.js b/src/specification.js index 9eaf117..299e968 100644 --- a/src/specification.js +++ b/src/specification.js @@ -281,6 +281,7 @@ function build(options) { // Format errors into a printable/throwable string const errReport = yamlDocsErrors + .filter((doc) => doc.errors.length) .map(({ errors, filePath }) => { let str = `Error in ${filePath} :\n`; if (options.verbose) {