Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Coder.decode_as_type version history #460

Open
vicchi opened this issue Nov 9, 2024 · 1 comment
Open

Coder.decode_as_type version history #460

vicchi opened this issue Nov 9, 2024 · 1 comment
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@vicchi
Copy link
Collaborator

vicchi commented Nov 9, 2024

@long2ice As part of #459 I've been looking at the revision history for the Coder.decode_as_type method. Support for decoding JSON to a custom return type was added in commit f78a599 by @mjpieters in May 2023 but then removed again in commit 19c4d02 by John Lyu (whose GitHub account doesn't seem to exist anymore).

Was this intentional?

As it stands right now, the current JsonCoder unit tests will never pass in their current form for a dataclass or a Pydantic model because decoding to a custom return type is no longer implemented and the type_ parameter is never used.

Unless I'm missing something which is entirely possible. For now I'll comment out those specific test values and focus on the failing test for the @cache decorator but it would be good to know the history behind this.

@vicchi
Copy link
Collaborator Author

vicchi commented Nov 9, 2024

The same applies to decoding back to a tuple as the closest JSON analogue is an array, so both a Python list and a tuple will always encode to an array and decode back to a list.

@vicchi vicchi added help wanted Extra attention is needed question Further information is requested labels Jan 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant