springdoc-openapi icon indicating copy to clipboard operation
springdoc-openapi copied to clipboard

Unable to render the definition when using `type: string` together with `format: byte` without custom message converters configuration in Spring Boot 3.2

Open mrhnrk opened this issue 2 years ago • 1 comments

Describe the bug

Tech stack:

  • Spring Boot 3.2.7
  • Java21
  • springdoc-openapi-starter-webmvc-ui version 2.5.0

springdoc configuration:

springdoc:
  swagger-ui:
    url: ${management.endpoints.web.base-path}/api/openapi.yml
    path: ${management.endpoints.web.base-path}/swagger-ui.html
  api-docs:
    path: ${management.endpoints.web.base-path}/api

When having an object with a string which has the format byte, the Swagger UI shows this error:

Errors

Parser error on line 8141
unknown tag !<tag:yaml.org,2002:binary>

Unable to render this definition

The provided definition does not specify a valid version field.

Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.x.y (for example, openapi: 3.1.0).

Our object in our openapi.yml looks like this:

SomeObject:
  type: object
  description: Some description
  properties:
    data:
      type: string
      format: byte
      description: Description
      example: 040E245432914D9CBB00DC27BA9E6437F8F5F5140A3C44D10B3F736F49583A9F98023DA94FE008D371163FBA4768E226E4702CB757C1E892A0286143753E291C4E

We're not overriding any message converters.

When removing the format: byte, then the Swagger UI is rendered without any issues.

To Reproduce Steps to reproduce the behavior:

  • Create sample Spring Boot app
  • Include SpringDoc MVC dependency
  • Create OpenAPI spec with an object which has a property of type string in format byte
  • Open Swagger UI in your browser of choice

Expected behavior

The Swagger UI is rendered without errors.

Screenshots

Additional context

mrhnrk avatar Jul 31 '24 11:07 mrhnrk

@hnrkdmsk,

Not reproducible. Feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.

This ticket will be closed, but can be reopened if your provide the reproducible sample.

bnasslahsen avatar Sep 22 '24 19:09 bnasslahsen