openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

Feature Request: Optionally support "extended" query string parsing structures

Open brianphillips opened this issue 3 years ago • 1 comments

I'm working with an OpenAPI spec that uses nested query string parameters (i.e. page[number]=2). By default, this is parsed by Express using the qs module which converts that to a nested object that looks like {"page":{"number":2}} instead of the simple/flat representation that looks like {"page[number]":2}.

To be clear, this is functionality that has not yet made its way to the official OpenAPI spec (discussion here) but given this is the default behavior for Express, I'm wondering whether it might make sense for this project to optionally support expanding the resulting types for query parameters out into their deeply nested form. Without this functionality, we are left with two less than perfect options:

  • change Express to use the "simple" query parsing functionality (and change the app code that currently expects nested query string parameter values), or
  • ignore the typing for the query parameters entirely and use the default types provided by @types/express

Is this something that would make sense to add into openapi-typescript? I can totally understand not wanting to deviate from the official spec so I'm somewhat expecting that to be the outcome but given the default behavior of Express, I would guess this is a fairly common pitfall to experience when trying to wire types in from an existing openapi spec.

Thanks!

brianphillips avatar Nov 12 '21 15:11 brianphillips

I really like the idea of adding it! But I don’t have time at the moment to add it myself. This is something I’d love a PR on and would gladly accept. If anyone is able to provide one it’d be much appreciated

drwpow avatar Jan 24 '22 03:01 drwpow

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Aug 06 '24 12:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Aug 15 '24 02:08 github-actions[bot]