-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[core][Python] rest client: handle multiple response types #2134
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
Changes from all commits
151e850
10bba49
abe6927
377855d
85dbe42
1a1e2db
f8f22bc
bfdcca2
75c98f6
e4de560
2c49d2e
6610f45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,6 +222,13 @@ class {{classname}}(object): | |
| # Authentication setting | ||
| auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501 | ||
|
|
||
| # multiple potential response types | ||
| response_types = { | ||
| {{#responses}} | ||
| {{code}}: {{#dataType}}'{{dataType}}'{{/dataType}}{{^dataType}}None{{/dataType}}{{#hasMore}},{{/hasMore}} | ||
|
||
| {{/responses}} | ||
| } | ||
|
|
||
| return self.api_client.call_api( | ||
| '{{{path}}}', '{{httpMethod}}', | ||
| path_params, | ||
|
|
@@ -230,7 +237,7 @@ class {{classname}}(object): | |
| body=body_params, | ||
| post_params=form_params, | ||
| files=local_var_files, | ||
| response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501 | ||
| response_types=response_types, | ||
| auth_settings=auth_settings, | ||
| async_req=local_var_params.get('async_req'), | ||
| _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rienafairefr why are you setting the response's dataType equal to the CodegenProperty dataType here? What is incorrect about how fromResponse is setting response.dataType higher up?