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

String with format byte (base64) is being an array of strings and not a string #1559

Closed
weesftw opened this issue Mar 17, 2022 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@weesftw
Copy link

weesftw commented Mar 17, 2022

When I'm creating an object and it has an attribute of type String with the format: byte (base64), the documentation view (UI) converts this type to an array of strings and not just a string...

  • spring-boot version 2.6.4
  • Using springdoc-openapi-ui version 1.6.6

Source code for example and swagger.yaml.

swagger

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Mar 19, 2022

@weesftw,

This is related to swagger-core enhancement. swagger-api/swagger-core#3944
And there is a related PR: swagger-api/swagger-core#3955

Once fixed, we can integrate it.
This the syntax to get your expected result.
And make sure you remove @Schema from the getter.

    @Schema(name = "message",  required = true, type = "string", format = "binary")
    @JsonProperty("message")
    @lombok.Builder.Default
    @NotNull
    private byte[] message = null;

@bnasslahsen bnasslahsen added the enhancement New feature or request label Mar 19, 2022
@spulci
Copy link

spulci commented May 14, 2024

@weesftw,

This is related to swagger-core enhancement. swagger-api/swagger-core#3944 And there is a related PR: swagger-api/swagger-core#3955

Once fixed, we can integrate it. This the syntax to get your expected result. And make sure you remove @Schema from the getter.

    @Schema(name = "message",  required = true, type = "string", format = "binary")
    @JsonProperty("message")
    @lombok.Builder.Default
    @NotNull
    private byte[] message = null;

PR has changed:

swagger-api/swagger-core#4659

it has been merged on their main branch a month ago. It has not been released yet! Hopefully they will release it soon

Thanks

Simone

@spulci
Copy link

spulci commented May 15, 2024

A new version of Swagger Core has been released with the above bug FIXED.

https://github.com/swagger-api/swagger-core/releases/tag/v2.2.22

@bnasslahsen have you got an idea of the release date of Spring Doc based on this new swagger-core version?

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

No branches or pull requests

3 participants