Closed ghost closed 5 years ago
I just tried this.
My tests generate an exception when deserializing polymorphic objects and the '__type' is not the first key in the object.
Can you provide a simple test that reproduces the problem.
Note: If the type is not polymorphic. Then having '__type' as one of the keys will be ignored unless you specify the ParserInterface::ParseType::Strict
in the constructor for Parser you are using.
Closing issue as it seems to work correctly in the tests. OP has not provided a specific use case that causes failure.
I am also not able to reproduce it. In case it happens again. I will prepare an example.
The documentation states that "__type" has to be the first property when polymorphic types are used: https://github.com/Loki-Astari/ThorsSerializer/blob/master/doc/full.md#example-3-see-docexample3cpp
I noticed that a partner using the REST webservice we provide uses a JSON client that automatically sorts members and it thinks "__type" should be sorted as "type". Thus, it does not appear as the first property of the JSON anymore. But there is no exception from ThorsSerializer.
Is it not required any more that it has to be the first property?