eclipse-vertx / vertx-openapi

OpenAPI repository
Other
10 stars 6 forks source link

Not implemented media type "application/octet-stream" (OpenAPI 3.x) #82

Open sebveit opened 4 weeks ago

sebveit commented 4 weeks ago

Version

io.vertx:vertx-openapi <= 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
pk-work commented 4 weeks ago

Hi @sebveit, thanks for using Vert.x OpenAPI! Maybe the error message is a little bit misleading. It does not mean, that OpenAPI does not support this feature. It mean that Vert.x OpenAPI has not yet implemented support for this kind of content in the requestBody.

sebveit commented 3 weeks ago

I've adapted the title of this issue to reflect that fact.