Open ahenket opened 3 years ago
Hi @ahenket, thanks for this enhancement suggestion! Looks pretty valid. I don't have much time to implement it myself right now, but can support anyone who wants to do it.
Also, if other people would like this enhancement, please upvote, and we'll prioritise it.
@ahenket If this is still causing you issues, I was able to work around this by using the SwaggerParser package to read the spec and give me an object to pass to jestOpenAPI. In my code:
const jestOpenAPI = require('jest-openapi');
const resolve = require('path').resolve;
const SwaggerParser = require("@apidevtools/swagger-parser");
const api = await SwaggerParser.validate(resolve('./api-spec-root.json'));
jestOpenAPI(api);
OpenAPI version 3.0.3
Is your feature request related to a problem? Please describe. I have 197kb worth of schema that I keep separate from the api specification itself. This in turn means that path parameters, responses and requestBody use
$ref
to a different file to get those. This is currently not supported and that leaves me without option to usesatisfyApiSpec
in my tests. Example fragment of my api definition:Describe the solution you'd like I would like support for external JSON Schema to be able to test against my api specification.
Describe alternatives you've considered Manual validation of a couple key fields.
Additional context The actual type of error I get with my api definition running tests with mochajs/chai:
Are you going to resolve the issue? No I don't have the knowledge for that