This gets even wilder as the non-CDI TCK test has the correct behaviour:

https://github.com/jakartaee/jsonb-api/blob/master/tck/src/main/java/ee/jakarta/tck/json/bind/customizedmapping/serializers/model/serializer/AnimalListDeserializer.java#L40


So the JSON-B TCK test for native deserialisers assumes different behaviour 
than the TCK test for deserialisers which use CDI? Should not be imo!

LieGrue,
strub

> Am 19.09.2023 um 13:42 schrieb Mark Struberg <[email protected]>:
> 
> hi!
> 
> Trying to work on the few TCK tests which still fail in Johnzon.
> 
> Does anyone understand why the following deserializer is expecting to see a 
> START_OBJECT of the actual items instead of the actual current JsonValue 
> event which is a START_ARRAY?
> 
> https://github.com/jakartaee/jsonb-api/blob/master/tck/src/main/java/ee/jakarta/tck/json/bind/cdi/customizedmapping/serializers/model/serializer/AnimalListDeserializerInjected.java#L44
> 
> 
> The value to parse is 
> { "animals" : [ { "type" : "cat", "cuddly" : true, "age" : 5, "furry" : true, 
> "name" : "Garfield" , "weight" : 10.5}, { "type" : "dog", "barking" : true, 
> "age" : 3, "furry" : false, "name" : "Milo", "weight" : 5.5}, { "type" : 
> "animal", "age" : 6, "furry" : false, "name" : "Tweety", "weight" : 0.5} ] }
> 
> This is from the TCK test 
> ee.jakarta.tck.json.bind.cdi.customizedmapping.serializers.SerializersCustomizationCDITest
> 
> My problem is that a List<X> or X[] in Java can be represented as json object 
> which is more complicated, e.g.
> 
> {
> "animals": 
>       {
>       "size":3,
>       "values": [ { "type" : "cat", "cuddly" : true, "age" : 5, "furry" : 
> true, "name" : "Garfield" , "weight" : 10.5}, { "type" : "dog", "barking" : 
> true, "age" : 3, "furry" : false, "name" : "Milo", "weight" : 5.5}, { "type" 
> : "animal", "age" : 6, "furry" : false, "name" : "Tweety", "weight" : 0.5} ]
>       }
> }
> 
> I don't see how the approach implemented by Yasson will allow to deserialise 
> such a JSON string.
> 
> Or do I miss something?
> 
> LieGrue,
> strub
> 

Reply via email to