You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to document a query parameter that is given as a JSON structure in order to define complex filter options (e.g. attribute + filter operation in, not-in, eq, lt, gt,...). According to openapi documentation, this should be possible using content specs instead of schema https://swagger.io/docs/specification/describing-parameters/#schema-vs-content
an example for a filter parameter with a nested object
As a solution, I think that the Parameter constructor function should also allow to provide the option to provide the content object. Looking at the current code, it might work to accept the MediaType, which is currently only used to construct body and response components.
Workarounds I tried:
I tried to work around this using kwargs of Parameter constructor or other options using a dict, but at some point the SpecificationBuilder requires presence of schema and forces it to be string, so in the end it does not work
I also tried to simplify the nested object and use deepObject style, but this does not work because sanic-ext cannot understand it. E.g. parameters given like ?captureId[IN]=1,2,3&captureId[NOTIN]=5 are not merged together into an object like captureId={IN:[1,2,3], NOTIN=[5]}
The text was updated successfully, but these errors were encountered:
tglander
changed the title
[Feature Request]
[Feature Request] support content as alternative to schema for parameters
Jun 26, 2023
Usecase
I would like to document a query parameter that is given as a JSON structure in order to define complex filter options (e.g. attribute + filter operation in, not-in, eq, lt, gt,...). According to openapi documentation, this should be possible using content specs instead of schema https://swagger.io/docs/specification/describing-parameters/#schema-vs-content
an example for a filter parameter with a nested object
Envisioned solution
As a solution, I think that the Parameter constructor function should also allow to provide the option to provide the
content
object. Looking at the current code, it might work to accept theMediaType
, which is currently only used to construct body and response components.Workarounds I tried:
Parameter
constructor or other options using a dict, but at some point the SpecificationBuilder requires presence of schema and forces it to be string, so in the end it does not work?captureId[IN]=1,2,3&captureId[NOTIN]=5
are not merged together into an object likecaptureId={IN:[1,2,3], NOTIN=[5]}
The text was updated successfully, but these errors were encountered: