-
-
Notifications
You must be signed in to change notification settings - Fork 228
Support for Free-Form Query Parameters #295
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
Support for Free-Form Query Parameters #295
Comments
@dtkav Any thoughts here? |
Sound right to me. Note that in
There may be some official guidance on what to do in the case that multiple query params are free-form objects. |
Also FYI @bowenwr - OpenAPI 3.1 adds |
So I actually don't know what the generated clients will do with objects in query params right now, my guess is the wrong thing 😁. I think to do this right we want to start supporting and enforcing the The default behavior (what we do today since we don't support style & explode) should technically be More Info
|
Indeed, it has a very weird behavior right now:
From my reading of the
So I'm thinking we want to stop using |
@dbanty @bowenwr Please check out this code plan before I start implementation: Code Plan:
Additionally, I would like to propose calling it out of scope to change the type signature from |
@forest-benchling That should still work for our purposes. Thanks! |
After going down this path, I realized that today we already only generate query params with the behavior of |
Is your feature request related to a problem? Please describe.
Given an API that accepts arbitrarily-named query parameters like:
/my-endpoint/?dynamic_param1=value&dynamic_param2=value2
We'd like to be able to append arbitrary key/values to the query string search.
Given a current YAML snippet like:
The parameter generated is
schema_field: Union[Unset, ModelNameSchemaField] = UNSET
, and it's also sent as the parameter namedschema_field
instead of using the arbitrary keys.Describe the solution you'd like
Generate the parameter above with
additionalProperties
asschema_field: Union[Unset, None, Dict[str, Any]] = UNSET
. Whenschema_field
is adict
, it will then send values for all keys in the query parameters instead of asschema_field
.If multiple parameters are defined having
additionalProperties
, it will treat all of them as arbitrary keys. If two parameters were to define the same dynamically named key, we make no guarantees about which one is sent. I imagine it would be the last parameter encountered withadditionalProperties
. Alternatively, we could raise an exception instead of making silent assumptions about the collision.Describe alternatives you've considered
Rather than modeling the field in Open API, allow every GET method to accept an
additional_properties: Dict[str, str]
parameter which would append all the keys as query parameters. The nameadditional_properties
might need to be configurable to avoid collision with APIs using that parameter name already.The text was updated successfully, but these errors were encountered: