Skip to content

Support "default" and "5XX" types of response status code #226

Open
@leonoh-oua

Description

@leonoh-oua

Which package are you using?
chai-openapi-response-validator

OpenAPI version
3

Describe the bug
Support "default" and "5XX" types of response status code. Those responses are valid based on the open api documents.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#responsesObject
https://swagger.io/docs/specification/describing-responses/

OpenAPIValidators doesn't seem to support these responses other than status codes in number.

To Reproduce
Sorry for not having time to provide recreation test case.

  1. In open api spec, add 2 different types of response type, "200" and "default", under responses section for whatever path and method

  2. In a test, call satisfyApiSpec with actual response with 400 status code

  3. Test fails with

         expected res to satisfy a '400' response defined for endpoint 'GET /aaa/bbb' in your API spec
         res had status '400', but your API spec has no '400' response defined for endpoint 'GET /aaa/bbb'
         Response statuses found for endpoint 'GET /subject/{subjectCode}/{apiVersion}/textbooks' in API spec: 200, default`
    

Expected behavior
The response is supposed to be validated based on the "default" response definition under responses

Additional context
Reproduce steps above are only about default. But I can see that OpenAPIValidators doesn't support status code range such as "5XX" either

Are you going to resolve the issue?
I'd like you to confirm this is a bug or there's something I'm missing.

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