FasterXML / FasterXML/jackson-module-jsonSchema

Invalid serialisation of UnionTypeSchema

Aberta
#90 6 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Java
Estrelas
387
Forks
136
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

[JacksonUnionTypeSerializationBugTest.java.txt](https://github.com/FasterXML/jackson-module-jsonSchema/files/62387/JacksonUnionTypeSerializationBugTest.java.txt)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.