You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the ormsgpack with the OPT_SORT_KEYS option in combination with OPT_SERIALIZE_PYDANTIC, the serialized output does not appear to sort keys as expected. This inconsistency can lead to differences in serialized output and hash values for equivalent data structures, depending on the order of the attributes in the model.
Steps to Reproduce
Define two pydantic models with the same fields but in a different order.
Serialize instances of these models using ormsgpack.packb with the OPT_SORT_KEYS | OPT_SERIALIZE_PYDANTIC options.
Observe that the order of the keys in the serialized output differs, indicating that OPT_SORT_KEYS is not applied.
The serialized output for both instances should have keys in sorted order, as specified by the OPT_SORT_KEYS option. Therefore, the output and the resulting hash should be identical for both models.
The issue seems to occur only when OPT_SORT_KEYS is used alongside OPT_SERIALIZE_PYDANTIC. When OPT_SORT_KEYS is used independently, it works as expected.
This bug may lead to inconsistent behavior when using hashed serialized data for caching or deduplication. Please investigate and resolve this issue to ensure compatibility between the OPT_SORT_KEYS and OPT_SERIALIZE_PYDANTIC options.
The text was updated successfully, but these errors were encountered:
Description
When using the
ormsgpack
with theOPT_SORT_KEYS
option in combination withOPT_SERIALIZE_PYDANTIC
, the serialized output does not appear to sort keys as expected. This inconsistency can lead to differences in serialized output and hash values for equivalent data structures, depending on the order of the attributes in the model.Steps to Reproduce
pydantic
models with the same fields but in a different order.ormsgpack.packb
with theOPT_SORT_KEYS | OPT_SERIALIZE_PYDANTIC
options.OPT_SORT_KEYS
is not applied.Reproducible Code
Actual Output
Expected Output
The serialized output for both instances should have keys in sorted order, as specified by the OPT_SORT_KEYS option. Therefore, the output and the resulting hash should be identical for both models.
Environment
Additional Context
The issue seems to occur only when OPT_SORT_KEYS is used alongside OPT_SERIALIZE_PYDANTIC. When OPT_SORT_KEYS is used independently, it works as expected.
This bug may lead to inconsistent behavior when using hashed serialized data for caching or deduplication. Please investigate and resolve this issue to ensure compatibility between the OPT_SORT_KEYS and OPT_SERIALIZE_PYDANTIC options.
The text was updated successfully, but these errors were encountered: