Files
Jeppe Fihl-PearsonandGitHub e26f3fc28c Add override for code generator to change indices.put_alias argument order (#804)
* Add currently-failing test to validate the original argument order

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>

* Add workaround for breaking API change inadvertently added in v2.7.0

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>

* Generate new version of the client code with the correct argument order

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>

---------

Signed-off-by: Jeppe Fihl-Pearson <[email protected]>
2024-08-22 08:33:55 -04:00

25 lines
911 B
Plaintext

{# Work around for https://github.com/opensearch-project/opensearch-py/issues/803 #}
{% set first_params = ["index", "name"] %}
{% for p, info in api.all_parts.items() %}
{% if info.required %}{{ p }}: {{ info.type }}, {% endif %}
{% endfor %}
{% for p, info in api.all_parts.items() if p in first_params %}
{% if not info.type == 'Any' %}{{ p }}: Optional[{{ info.type }}]=None, {% endif %}
{% if info.type == 'Any' %}{{ p }}: {{ info.type }}=None, {% endif %}
{% endfor %}
{% if api.body %}
body{% if not api.body.required %}: Any=None{% else %}: Any{% endif %},
{% endif %}
{% for p, info in api.all_parts.items() if p not in first_params %}
{% if not info.required and not info.type == 'Any' %}{{ p }}: Optional[{{ info.type }}]=None, {% endif %}
{% if not info.required and info.type == 'Any' %}{{ p }}: {{ info.type }}=None, {% endif %}
{% endfor %}
params: Any=None,
headers: Any=None,