samchon / typia

Super-fast/easy runtime validators and serializers via transformation
https://typia.io/
MIT License
4.62k stars 159 forks source link

Support for nested query string parameters #1363

Open ramiroaisen opened 6 hours ago

ramiroaisen commented 6 hours ago

Feature Request

We are using typa.http.assertQuery for an API we are using. We need to be able to use nested query parameters in the query string. An example of this would be a query like this: ?nested[param1]=1&nested[param2]=foo Which should match with a type like this.

type Query = {
  nested: {
    param1: number
    param2: string
  }
}
sunrabbit123 commented 3 hours ago

good idea, but is this a standard spec?

https://jsonapi.org/format/#query-parameters-families:~:text=Therefore%2C%20JSON%3AAPI%20provides%20its%20own%20definition%20of%20a%20query%20parameter. https://url.spec.whatwg.org/#urlencoded-parsing

samchon commented 1 hour ago

No standard spec.

Also, typia is using URLSearchParams of JS standard, and it does not support the nested property either.