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

Support for Wildcard HTTP Responses #252

Open
melloware opened this issue Nov 12, 2023 · 0 comments
Open

Support for Wildcard HTTP Responses #252

melloware opened this issue Nov 12, 2023 · 0 comments

Comments

@melloware
Copy link

Originally reported at Orval: anymaniax/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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant