-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Are you using jest or chai?
jest
Are you using OpenAPI 2, 3.0.X, or 3.1.0?
3.0.3
Describe the bug clearly
When having a path that contains a hard-coded : in it (that does not signify a parameter) toSatisfyApiSpec still treats it as a parameter and ignores the text after the :. that causes a mixup between different paths.
Steps to reproduce the bug:
- Have a spec with two paths that are identical except for an ending that container a
:. for example
POST /api/{prefix}/example:one
POST /api/{prefix}/example:two - Test a response to one of them with
toSatisfyApiSpec - See error
expected received to satisfy the '200' response defined for endpoint 'POST /api/{prefix}/example:two' in your API spec
received did not satisfy it because: response must have required property 'two'
received contained: { body: { one: 'foo' } }
The '200' response defined for endpoint 'POST /api/{prefix}/example:two' in API spec: {
'200': {
description: 'Two',
content: {
'application/json': {
schema: {
type: 'object',
required: [ 'two' ],
properties: { two: { type: 'string' } }
}
}
}
}
}
See full example in my branch - https://github.com/aradbar/OpenAPIValidators/blob/bug-report-1/packages/jest-openapi/__test__/colonInUrlBug.test.ts
What did you expect to happen instead?
toSatisfyApiSpec to be able to differentiate between the two paths
Are you going to resolve the issue?
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working