When continueOnError is set to true and the api option that is failing includes a paths option, an error is thrown and no json produced.
This is not covered by the test here because it only tests a failing api that has no further options set. Thus none of the later steps try to access the undefined schema.
I didn't go through the entire code, but I'd suspect that the same happens with other things, not just basePath.
My proposal would be to discard all failed apis when continueOnError is true.
if (this.opts.continueOnError) {
apis = apis.filter((api) => api !== undefined);
}
Alternatively checking in each further step whether schema is undefined in the schema.map() is also an option.
Here's a failing integration test:
it('catches errors if `continueOnError` option is set to true and a swagger config is unreachable for extended api config', () => {
nock('https://api.apis.guru')
.get('/v2/specs/deutschebahn.com/betriebsstellen/v1/swagger.json')
.reply(500);
return swaggerCombine(basicConfig, { continueOnError: true });
});
When continueOnError is set to true and the api option that is failing includes a paths option, an error is thrown and no json produced.
This is not covered by the test here because it only tests a failing api that has no further options set. Thus none of the later steps try to access the undefined schema.
I didn't go through the entire code, but I'd suspect that the same happens with other things, not just basePath.
My proposal would be to discard all failed apis when continueOnError is true.
Something like this here:
Alternatively checking in each further step whether schema is undefined in the schema.map() is also an option.
Here's a failing integration test: