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

openapi-router: Unsupported media type "application/octet-stream" but OpenApi 3.1.0 supports it #2636

Open
sebveit opened this issue Jul 25, 2024 · 4 comments
Labels

Comments

@sebveit
Copy link

sebveit commented Jul 25, 2024

Version

io.vertx:vertx-web-openapi-router <= 4.5.9

Context

I encountered an exception which looks suspicious because the media type application/octet-stream is legit.
io.vertx.openapi.contract.OpenAPIContractException: The passed OpenAPI contract contains a feature that is not supported: Operation createBinary defines a request body with an unsupported media type. Supported: application/json, application/json; charset=utf-8, multipart/form-data, application/hal+json

Here is a migration guide on what has changed between OpenAPI 3.0 and 3.1:
https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0

Steps to reproduce

Have a openapi-contract.yml with the following snippet:

/api/v1/binary/{binaryId}:
  put:
    operationId: createBinary
    parameters:
      - name: binaryId
        in: path
        required: true
        schema:
          type: string
          pattern: '^[0-9a-f]{64}$'
    requestBody:
      required: true
      content:
        application/octet-stream: {}
    responses:
      '201':
        description: Resource created and stored on disk
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourceRefBasedUponHash'
      '409':
        description: Resource already exists
@sebveit sebveit added the bug label Jul 25, 2024
@CheesyBoy123
Copy link

Hey @sebveit this is a restriction in https://github.com/eclipse-vertx/vertx-openapi/ project currently. It might be a good idea to also open an issue there.

@sebveit
Copy link
Author

sebveit commented Aug 15, 2024

Thx for the hint! I've opened the same issue on https://github.com/eclipse-vertx/vertx-openapi/

But I guess this issue is still relevant here, since vertx-web-openapi depends on vertx-openapi?

@CheesyBoy123
Copy link

Yup! Once it is fixed there it will flow to the openapi router as well. I see pl has started looking into it 😄

@stempler
Copy link

Related ticket is eclipse-vertx/vertx-openapi#82

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

No branches or pull requests

3 participants