Skip to content
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

[client] Refactor operation method signature #9

Open
berislavlopac opened this issue Nov 29, 2019 · 1 comment
Open

[client] Refactor operation method signature #9

berislavlopac opened this issue Nov 29, 2019 · 1 comment
Labels
enhancement New feature or request
Projects

Comments

@berislavlopac
Copy link
Owner

berislavlopac commented Nov 29, 2019

Is your feature request related to a problem? Please describe.
Currently, the operation methods attached to the client expect *args for path parameters and **kwargs for query parameters, while there are keyword arguments body_ and headers_ for the respective types of operation parameters. One problem here is that there is no way to update other parameter types (specifically cookies), but also the number of "special" kwargs seems a bit excessive.

Describe the solution you'd like
Instead of separate kwargs for different types we could define a single argument, named extra_, which would accept an arbitrary dictionary. Internally, the method would extract any values that match special keys (namely headers, cookies and body, but also possibly files and others). The *args and **kwargs would remain reserved for path and query parameters, respectively.

Additional context
As part of this enhancement we could also allow for a kwarg value to be an iterable (collections.abc.Iterable), in which case it would be applied to the request by sending the same parameter multiple times, i.e.:

client.foo(bar=[1,2,3])

would send the request as:

/foo?bar=1&bar=2&bar=3
@berislavlopac berislavlopac added the enhancement New feature or request label Nov 29, 2019
@berislavlopac berislavlopac added this to Awaiting triage in Client via automation Nov 29, 2019
@berislavlopac
Copy link
Owner Author

berislavlopac commented Nov 29, 2019

The issue described under "Additional context" actually only needs the activation of the doseq argument on urlencode in ClientOpenAPIRequest.url. A few tests would certainly be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Client
  
Awaiting triage
Development

No branches or pull requests

1 participant