Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Untagged variant will make tagged ones unparsable #409

Open
ImUrX opened this issue Jan 29, 2024 · 1 comment
Open

Untagged variant will make tagged ones unparsable #409

ImUrX opened this issue Jan 29, 2024 · 1 comment

Comments

@ImUrX
Copy link

ImUrX commented Jan 29, 2024

If you have an enum like this:

#[derive(Serialize, Deserialize, Debug)]
enum Enum {
	Tagged(String),
	#[serde(untagged)]
	Untagged(usize),
}

will fail to parse this yml:

- !Tagged example

Message: called `Result::unwrap()` on an `Err` value: Error(".[0]: untagged and internally tagged enums do not support enum input", line: 2, column: 3)
but if you remove the #[serde(untagged)] then it will be parsable

@ImUrX
Copy link
Author

ImUrX commented Jan 29, 2024

Does this happen because of serde-rs/serde#1183?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant