toSatisfyApiSpec
lacks functionality to handle "overlapping" endpoint definitions
#295
Labels
bug
Something isn't working
Are you using jest or chai?
Jest
Are you using OpenAPI 2, 3.0.X, or 3.1.0?
3.0.0
Describe the bug clearly
Consider this yaml schema:
This is a tricky schema; a client request for
/a/k/b
could arguably correspond to either of the of the paths - the server needs an explicit rule ensuring/a/k/b
is handled by/a/{x}/b
. UnfortunatelytoSatisfyApiSpec
fails forGET /a/k/b
, saying the endpoint shouldn't supportGET
, because it thinks/a/k/b
corresponds to/a/{x}/{y}
, which only supportsPOST
.Steps to reproduce the bug:
let res = await request({ host: '...', method: 'GET', path: '/a/k/b' });
expect(res).toSatisfyApiSpec()
This causes
toSatisfyApiSpec
to fail, saying GET is not a supported method.What did you expect to happen instead?
I expected
toSatisfyApiSpec
to succeed, asGET /a/k/b
is supported under the/a/{x}/b
path.Perhaps
toSatisfyApiSpec
could, after trying and failing for the/a/{x}/{y}
endpoint, look for any additional paths which also match the path forres
. In this case it would find/a/{x}/b
, which supportsGET
.Or another possibility may be to allow
toSatisfyApiSpec
to be further qualified with an explicit path:Are you going to resolve the issue?
No
The text was updated successfully, but these errors were encountered: