schmittjoh / serializer

Library for (de-)serializing data of any complexity (supports JSON, and XML)
http://jmsyst.com/libs/serializer
MIT License
2.32k stars 589 forks source link

Ignore enums in TypedPropertiesDriver #1458

Closed ruudk closed 1 year ago

ruudk commented 1 year ago
Q A
Bug fix? yes
New feature? no
Doc updated no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #1457
License MIT

This is handled by the EnumPropertiesDriver.

If the TypedPropertiesDriver sets the type, it will be skipped by the EnumPropertiesDriver and causes deserialization to fail.

ruudk commented 1 year ago

@goetas When you have time, I'd like to know if this is the idea. If so, we should add some tests to guard it. Ideally, the JsonSerializationTest also sets up this TypedPropertiesDriver properly.

ruudk commented 1 year ago

AFAIK the TypedPropertiesDriver is only hit when the type is not defined. In your case, it is because there is a Type attribute?

simPod commented 1 year ago

Yes I believe so. But TBH I don't know how that works in Serializer exactly.

I have a lot of serde tests and only the one with annotation failed. The others where there's native property enum type passed.

ruudk commented 1 year ago

@goetas Could you assist in how to proceed with this PR? Looking at @simPod's comment, I think we're overseeing something.

ruudk commented 1 year ago

@goetas Hope you're feeling better. Do you have time to help us find the problem here? Is my solution correct?

goetas commented 1 year ago

~i have tried to look into this but it is confusing... EnumPropertiesDriver is registered before the TypedPropertiesDriver, thus this should not be a problem at all... is there a way to reproduce the issue?~ nvm i have understood the issue