Closed goetas closed 1 year ago
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
Doc updated | yes |
BC breaks? | maybe?? |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #1393 #1392 #1373 |
License | MIT |
Im thinking if is worth trying to make it backward compatible or just make a major release..., of course the alternative is to make it an opt-in feature
@Einenlum
It seems like using enum<'Color'> makes it use the name of the enum and not its value, according to what you wrote before (line 382), so I'm a bit confused.
I have updated the documentation.
BackedEnum
, buy default it will be serialized using its value
name
it prefersBackedEnum
, it will be serialized using its name
Despite the fact that the RFC suggests that non-backed enums should not be serialized, I do not see anything wrong with offering such possibility.
Regarding the integer
option, TBH is an overkill, i can remove it. I've dealt with some "weird" systems in which the backed enum was a string but containing integers... but maybe is not worth solving
ok, I think that this is ready for a new round.
I made it an opt-in feature
Thanks @goetas ! The implementation sounds way better and simple to me this way. For the integer option, sounds indeed overkill to me since it's probably to solve some edge case that shouldn't happen in most codebases.
One thing that I don't really get though (but probably a misunderstanding on my side): why make it opt-in and not do the same as with other drivers here ?
Sounds strange to make that opt-in since it sounds like a normal behavior that should work out of the box.
One thing that I don't really get though (but probably a misunderstanding on my side): why make it opt-in and not do the same as with other drivers here ?
the issue is that some people might be using already the serializer with the default enum serialization, see testEnumDisabledByDefault
. the serializer was already able to serialize enums... and with this PR the format would change...
Would be great to have this tagged so that we can start using it 💙
:tada: Thanks a lot for you work @goetas ! Great news for JMS Serializer users.