Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toSatisfyApiSpec doesn't work with openAPI allOf in response schema #296

Open
ittahtal opened this issue Jun 23, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@ittahtal
Copy link

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
I have a response type defined in openAPI yaml file that is combined with 2 response types using allOf, like the following:
GetXResponse:
allOf:
- $ref: '#/components/schemas/YResponse'
- type: object
title: GetXResponse
additionalProperties: false
properties:
data:
type: array
items:
$ref: '#/components/schemas/X'
required:
- data

When using jest-openapi toSatisfyApiSpec method, it throws an error:
expected received to satisfy the '200' response defined for endpoint 'GET /x' in your API spec
received did not satisfy it because: response must NOT have additional properties

Even though I see that the printed output really corresponds to GetXResponse.

Steps to reproduce the bug:

  1. Use schema defined above for tested route
  2. Create a test for that request that includes expect(response).toSatisfyApiSpec();
  3. See error:
    expected received to satisfy the '200' response defined for endpoint 'GET /x' in your API spec
    received did not satisfy it because: response must NOT have additional properties

What did you expect to happen instead?
API spec will acknowledge the extending of GetXResponse

Are you going to resolve the issue?
dont know how

@ittahtal ittahtal added the bug Something isn't working label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant