Skip to content

Support for Wildcard HTTP Responses #252

Description

@melloware

Originally reported at Orval: orval-labs/orval#950

As per the OpenAPI specification, it is allowed with wildcard http response codes (like 2xx, 3xx). Orval does not seem to support this.

https://learn.openapis.org/specification/paths.html#the-responses-object

  /api/v1/users/me:
    get:
      tags:
      - user-resource
      summary: Fetch some metadata about the current logged in user
      operationId: getLoggedInUser
      responses:
        "2xx":
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserDto'
        "4xx":
          description: Errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'

Fails with:

Swagger schema validation failed.
  #/paths/~1api~1users~1me/get/responses must NOT have additional properties


Error: Swagger schema validation failed.
  #/paths/~1api~1users~1me/get/responses must NOT have additional properties

    at o (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95564)
    at https://apitools.dev/swagger-parser/online/js/bundle.min.js:29:45042

SyntaxError: Swagger schema validation failed.
  #/paths/~1api~1users~1me/get/responses must NOT have additional properties

    at Function.o [as syntax] (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:95564)
    at validateSchema (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:6322)
    at SwaggerParser.validate (https://apitools.dev/swagger-parser/online/js/bundle.min.js:1:3391)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions