Skip to content
New issue

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

Query data did not match any variant of untagged enum #991

Open
51yu opened this issue Aug 20, 2022 · 2 comments
Open

Query data did not match any variant of untagged enum #991

51yu opened this issue Aug 20, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@51yu
Copy link

51yu commented Aug 20, 2022

Version
0.3.2

Platform
MacOS

Description
I have query body defined as

#[derive(Deserialize, Serialize)]
#[serde(untagged)]
pub enum MyQuery {
    TypeA {
        foo_id: Uuid,
        bar_id: Uuid,
        buzz_id_maybe: Option<Uuid>,
        limit: i64,
    },
    TypeB {
        buzz_id: Uuid,
        foo_id_maybe: Option<Uuid>,
        limit: i64,
    },
}

I sent request with query string

foo_id=FOO-UUID&bar_id=BAR-UUID&limit=10

or

foo_id=FOO-UUID&bar_id=BAR-UUID&buzz_id_maybe=BUZZ-UUID&limit=10

both return 400

failed to decode query string, Error("data did not match any variant of untagged enum MyQuery")

but both should match TypeA of MyQuery, any suggestion ?

@51yu 51yu added the bug Something isn't working label Aug 20, 2022
@51yu
Copy link
Author

51yu commented Aug 21, 2022

@51yu
Copy link
Author

51yu commented Aug 21, 2022

duplicate to nox/serde_urlencoded#66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant