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
We ues a Dialect with special Handling for the date Type. We don't want to get it serialized to string. Therefore we use the
pass_throug serialization strategy. But this strategy is only used for the first appeareance of the configured typ.
In this case the cache does not hold an SerializationStrategyValueType Object, which is returend in subsequent calls. It holds an generator_function object. So each corresponding call of __iter_serialization_strategies with the same type parameter tries to iterate the generator_object. If this has reached its end no further value is returned.
In our case this means that the pass_through serialization strategy for date is only used for the fist time __iter_serialization_strategies is called. In all other cases the default serialization strategy for date is used - which means it is converted to iso date string.
If I omit the lru_cache decorator from __iter_serialization_strategies it works as expected.
Could you please check this.
Thank You
The text was updated successfully, but these errors were encountered:
Description
We ues a Dialect with special Handling for the date Type. We don't want to get it serialized to string. Therefore we use the
pass_throug serialization strategy. But this strategy is only used for the first appeareance of the configured typ.
What I Did
Output:
{'from_date': datetime.date(2023, 1, 10), 'to_date': '2023-01-10'}
Expected Output: :
{'from_date': datetime.date(2023, 1, 10), 'to_date': datetime.date(2023, 1, 10)}
I debugged into the mashumaro sourcecode and found out that in builder.py CodeBuilder you use an lru_cache() decorator for this generator function.
In this case the cache does not hold an SerializationStrategyValueType Object, which is returend in subsequent calls. It holds an generator_function object. So each corresponding call of
__iter_serialization_strategies
with the same type parameter tries to iterate the generator_object. If this has reached its end no further value is returned.In our case this means that the pass_through serialization strategy for date is only used for the fist time
__iter_serialization_strategies
is called. In all other cases the default serialization strategy for date is used - which means it is converted to iso date string.If I omit the lru_cache decorator from __iter_serialization_strategies it works as expected.
Could you please check this.
Thank You
The text was updated successfully, but these errors were encountered: