Skip to content

jest-openapi Wrong path with method parsing #301

@vitalyiegorov

Description

@vitalyiegorov

Are you using jest or chai?
JEST

Are you using OpenAPI 2, 3.0.X, or 3.1.0?
OpenAPI 3.0.3

Describe the bug clearly
jest-openapi:0.14.2 cannot understand following endpoints configuration:

    /order/{contractId}/{orderId}:
        get:

    /order/{orderId}/{orderItemId}:
        delete:

Steps to reproduce the bug:

  1. Provide following OpenAPI yaml
  2. Run jest test with expect(response).toSatisfyApiSpec();
  3. See error:
expect(received).toSatisfyApiSpec() // Matches 'received' to a response defined in your API spec, then validates 'received' against it

expected received to satisfy a '200' response defined for endpoint 'GET /order/{orderId}/{orderItemId}' in your API spec

received had request method GET, but your API spec has no GET operation defined for path '/order/{orderId}/{orderItemId}'

Request operations found for path '/order/{orderId}/{orderItemId}' in API spec: DELETE

What did you expect to happen instead?
Validator can differentiate paths and pick the right one to validate

Are you going to resolve the issue?
If you guide me where to start, because multiple packages are involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions