pooyamb / serde-querystring

A query string parser for rust with support for different parsing methods
Apache License 2.0
10 stars 3 forks source link

Order & unknown parameter causes an error #1

Closed xamgore closed 1 year ago

xamgore commented 1 year ago

Hi, thanks for the package! 👍

#[derive(Debug, Deserialize)]
pub struct PostsParams {
  #[serde(default)]
  first: Option<u8>,

  deal_type: Vec<String>,
}

dbg!(serde_querystring::from_str::<PostsParams>("..."));

After further investigation, it seems like a=1 parameter drops the following deal_type[]=str out of the list. If you put it dn the first place a=1&first=2&deal_type[]=str, first will be lost.

serde-querystring = "0.0.8"

With serde_querystring::de::ParseMode::Brackets on the latest beta everything is parsed correctly.

pooyamb commented 1 year ago

Hi @xamgore The parsing method in 0.0.x releases had some inconsistencies as I was trying to support as many kinds of querystrings as possible, I'm glad it is fixed in the latest beta with separate scopes for different kinds of qs. I'm planning to release a 0.1 soon with some more docs and a little improvement to error handling/reporting.