Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Change Log

### 2020-xx-xx - 5.3.4
Autorest core version: 3.0.6318

Modelerfour version: 4.15.419

**Bug Fixes**

- Include `content_type` docstrings for LRO and paging operations in the case of multiple media types #778

### 2020-09-17 - 5.3.3
Autorest core version: 3.0.6318

Expand Down
3 changes: 3 additions & 0 deletions autorest/codegen/templates/lro_operation_helper.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{% endfor %}
:type {{ parameter.serialized_name }}: {{ parameter.docstring_type }}
{% endfor %}
{% if (operation.requests | length) > 1 %}
{{ op_tools.content_type_docstring(operation) }}
{% endif %}
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
Expand Down
4 changes: 1 addition & 3 deletions autorest/codegen/templates/operation.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
:type {{ parameter.serialized_name }}: {{ parameter.docstring_type }}
{% endfor %}
{% if (operation.requests | length) > 1 %}
{% set content_type_constant = operation.parameters.constant|selectattr("implementation", "equalto", "Method")|selectattr("original_parameter", "equalto", None)|selectattr("in_method_code") | selectattr("serialized_name", "equalto", "content_type") | first %}
:keyword str content_type: Media type of the body sent to the API. Default value is {{ content_type_constant.constant_declaration }}.
Allowed values are: "{{ operation.requests | map(attribute="media_types") | sum(start = []) | unique | list | join ('", "') }}".
{{ op_tools.content_type_docstring(operation) }}
{% endif %}
:keyword callable cls: A custom type or function that will be passed the direct response
{{ return_docstring(async_mode, return_type=return_type) }}
Expand Down
8 changes: 7 additions & 1 deletion autorest/codegen/templates/operation_tools.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ else ((return_type_wrapper | join("[") + "[") if return_type_wrapper else "") ~
**kwargs # type: Any
):
{% endif %}{% endmacro %}
{# handle response headers/deserialization #}

{# content type docstring #}
{% macro content_type_docstring(operation) %}
{% set content_type_constant = operation.parameters.constant|selectattr("implementation", "equalto", "Method")|selectattr("original_parameter", "equalto", None)|selectattr("in_method_code") | selectattr("serialized_name", "equalto", "content_type") | first %}
:keyword str content_type: Media type of the body sent to the API. Default value is {{ content_type_constant.constant_declaration }}.
Allowed values are: "{{ operation.requests | map(attribute="media_types") | sum(start = []) | unique | list | join ('", "') }}".{% endmacro %}

{# error map handling #}
{% macro error_map(operation, code_model) %}
{%if operation.status_code_exceptions %}
Expand Down
3 changes: 3 additions & 0 deletions autorest/codegen/templates/paging_operation.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
{% endfor %}
:type {{ parameter.serialized_name }}: {{ parameter.docstring_type }}
{% endfor %}
{% if (operation.requests | length) > 1 %}
{{ op_tools.content_type_docstring(operation) }}
{% endif %}
:keyword callable cls: A custom type or function that will be passed the direct response
{{ return_docstring(async_mode) }}
:raises: ~azure.core.exceptions.HttpResponseError
Expand Down