-
-
Notifications
You must be signed in to change notification settings - Fork 514
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
Webflux-ui - JsonMappingException: Null key for a Map not allowed in JSON #1266
Comments
Make sure you Provide a Minimal, Reproducible Example - with HelloController that reproduces the problem. This ticket can be reopened, if the relevant information are provided. |
I am hitting a similar issue with Boot
Works <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.7</version>
</dependency> Breaks <dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.8</version>
</dependency> In my case, I am providing Json Type Information to my response. This annotation is causing the issue:
I will try to provide a reproducible example. Should I possibly file a separate issue as mine is not related to Webflux? |
same problem: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: io.swagger.v3.oas.models.OpenAPI["paths"]->io.swagger.v3.oas.models.Paths["/v2/reprocess-loading/{realm}/PricelistSource/{id}"]->io.swagger.v3.oas.models.PathItem["get"]->io.swagger.v3.oas.models.Operation["responses"]->io.swagger.v3.oas.models.responses.ApiResponses["200"]->io.swagger.v3.oas.models.responses.ApiResponse["content"]->io.swagger.v3.oas.models.media.Content["application/json"]->io.swagger.v3.oas.models.media.MediaType["schema"]->io.swagger.v3.oas.models.media.ObjectSchema["properties"]->java.util.LinkedHashMap["null"]) |
Are you able to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem? |
Hey @bnasslahsen,
What I can add, though: the issue was most likely introduced in 1.5.8. At least that is the first version I can reproduce it with. With 1.5.7 and below no exception is thrown. It is also still reproducible in 1.6.2. I could try to provide a minimal, reproducible example, but I'm not exactly sure what you need. You refer to HelloController, is that something special a user of springdoc should know? :) |
First follow Contribution Guide. |
Describe the bug How to reproduce
Expected behavior
Actual behavior The result will be a 500 response:
In the swagger ui we will see an error: In the spring logs we will see the exception thrown:
Additional context
|
@bnasslahsen Thanks for clarifying and of course for your work on springdoc :). I've prepared a reproducible demo and additionally tried to summarize all infos about the issue in the same comment. Do you think that is sufficient to re-open the bug? |
This is a bug in the swagger-core and occuring when JsonTypeInfo.As.WRAPPER_OBJECT is identified by name. Here the sample code to confirm it, with only swagger-core classes: val resolvedSchema = ModelConverters.getInstance()
.readAllAsResolvedSchema(
AnnotatedType(HelloResponse::class.java)
.resolveAsRef(true)
)
Assert.isTrue(resolvedSchema.schema.properties.keys.size==1, "Should contain one element HelloResponse");
Assert.notNull(
resolvedSchema.schema.properties.keys.stream().findFirst().isPresent,
"I'd like it to be present!"
)
There is a similar issue for You can add your comments with detailed description to these tickets, so the This is the code line causing the issue: As workaround, use @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.CLASS) |
This is to fix the issue mentioned here springdoc/springdoc-openapi#1266
This is to fix the issue mentioned here springdoc/springdoc-openapi#1266
swagger-core:2.2.1 it is solved |
After upgrading from version 1.5.5 to 1.5.10 the following exception appears when entering swagger UI(/swagger-ui.html):
logs
Spring Boot version: 2.5.4
The text was updated successfully, but these errors were encountered: