swagger-api / swagger-api/swagger-core
[Bug]: JsonSchema fails with JSON round-trip
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.5k
- Forks
- 2.3k
- Avg merge
- 18h 1m
- Merged PRs (30d)
- 10
Description
Description of the problem/issue
JsonSchema type field is asymmetric since there is a custom serializer that does not have a matching deserializer. This leads to a JSON round-trip failing when a single type is set.
Affected Version
2.2.53
Steps to Reproduce
- Create an instance of
JsonSchemawhere there is a singletypedefined - Serialize it
- Deserialize it, and see that it fails with reading
type: Xintotypes
Expected Behavior
Deserialization should work.
Actual Behavior
Deserialization does not work.
Logs / Stack Traces
Additional Context
Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided sufficient information for maintainers to reproduce the issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with JsonSchema and the custom serializer in modules/swagger-core/src/main/java/io/swagger/v3/core/jackson/mixin/Schema31Mixin.java around line 65. Reproduce the single-type serialize/deserialize round trip and inspect the deserialization path; done means a JsonSchema with one type serializes and deserializes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100