We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alias
list
Hi there,
Back again with another potential bug. Using [email protected], I've run into deserialization failures for two situations I think should be valid:
[email protected]
@serde @dataclass class Foo: a: Optional[list[int]] = field(alias=["b"], default=None) x = from_json(Foo, '{"b": [1]}') assert x.a == [1] 💥
@serde @dataclass class Foo: a: list[int] = field(alias=["b"], default_factory=list) x = from_json(Foo, '{"b": [1]}') assert x.a == [1] 💥
Both fail with serde.compat.SerdeError: 'a', I wish I could give you a more useful error message.
serde.compat.SerdeError: 'a'
The text was updated successfully, but these errors were encountered:
Hi @opeik
Sorry, I don't have bandwidth to look into this issue. If you're interested in contributing, I am happy to assist you.
Sorry, something went wrong.
Hey @yukinarit, don't stress. I would never demand maintainers fix my problems. Thanks for taking a look 🙇♀️
Just wanted to add to this:
Also doesn't seem to work for nested types
@serde @dataclass class Bar: e: int f: str @serde @dataclass class Foo: a: Bar | None = field(default=None, alias=["b"]) # works s = '{"a": {"e": 5, "f": "baz"}}' print(f"From Json: {from_json(Foo, s)}") # works s = '{"b": null}' print(f"From Json: {from_json(Foo, s)}") # doesnt work s = '{"b": {"e": 5, "f": "baz"}}' print(f"From Json: {from_json(Foo, s)}")
yukinarit
No branches or pull requests
Hi there,
Back again with another potential bug. Using
[email protected]
, I've run into deserialization failures for two situations I think should be valid:Both fail with
serde.compat.SerdeError: 'a'
, I wish I could give you a more useful error message.The text was updated successfully, but these errors were encountered: