Skip to content

Commit

Permalink
Merge pull request #348 from mtolhurst/master
Browse files Browse the repository at this point in the history
Fixes cleaned up errors still logging doc path
  • Loading branch information
daniloab committed Jan 16, 2023
2 parents b6e3c54 + 6184624 commit 55c614b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/yaml-anchors-aliases/yaml-anchors-aliases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
1 change: 1 addition & 0 deletions src/specification.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 55c614b

Please sign in to comment.