Invalid serialisation of UnionTypeSchema
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start with the attached JacksonUnionTypeSerializationBugTest.java.txt and trace UnionTypeSchema through JsonSchemaIdResolver.idFromValue. The fix is done when a union serializes with a single JSON Schema "type" array and no conflicting "elements" or duplicate "type" properties.
Written by the indexing model from the issue text.
Description
UnionTypeSchema currently cannot be serialised because it returns a null type which is not welcomed by JsonSchemaIdResolver.idFromValue. If you extend UnionTypeSchema and return a type then it serialises this as "type" and serialises the types as "elements". This is not valid JSON Schema. It should serialize the union as a "type" array. See https://tools.ietf.org/html/draft-zyp-json-schema-03#page-8
If I then attempt to further patch UnionTypeSchema to change "elements" into "type" then it serialises with TWO "type" properties which isn't even valid JSON!
If I attempt to annotate UnionTypeSchema to not include type info with @JsonTypeInfo(use = JsonTypeInfo.Id.NONE, property = "type") then it has no effect except when the union type schema is passed directly to ObjectMapper.
A test case is attached.
- Dominant language
- Java
- Stars
- 387
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from FasterXML/jackson-module-jsonSchema
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
FasterXML/jackson-module-jsonSchema#160 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
pr-needed
Difficulty 3/5 1-2 days Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#136 · 10 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#135 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
FasterXML/jackson-module-jsonSchema#134 · 2 comments · 1 reaction ·
All issues in FasterXML/jackson-module-jsonSchema
Similar issues
-
BC remittance upload: a claim MSP refused (S03) is saved with a blank status instead of refused (F)Opentype: bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
carlos-emr/carlos#4933 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Vakore/ZappierGames#147 ·
-
spigotmc
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Dans-Plugins/Wild-Pets#356 ·
Maintainers usually reply within 1 day
-
spigotmc
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Dans-Plugins/Medieval-Roleplay-Engine#371 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
eddyizm/tempus#1220 · 1 comment ·
Maintainers usually reply within 2 days