Skip to content

[BUG] Backward compatibility issues due to positional args #898

@nathaliellenaa

Description

@nathaliellenaa

What is the bug?

The code generation process is incorrectly adding new arguments to function signatures, causing backwards compatibility issues. Specifically, new arguments are not being added as the last parameter in function signatures. This breaks existing code that uses positional arguments, as the order of arguments matters for positional calls.

Example: The search_shards method now expects a body parameter, but it's not added as the last argument, causing test failures. See this PR for reference.

How can one reproduce the bug?

Run the test suite, specifically: test_opensearchpy/test_server/test_rest_api_spec.py::test_rest_api_spec[OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/search_shards/20_slice[0]]
Observe the following error: TypeError: OpenSearch.search_shards() got an unexpected keyword argument 'body'

What is the expected behavior?

New arguments (e.g. body) should be added as the last parameter in function signatures.
The method should support both positional and keyword argument calls:

Existing positional call (should still work):
client.search_shards('books', {})

New keyword call (should now be supported):
client.search_shards(index='books', params={}, body={})

What is your host/environment?

Operating system, version.

Do you have any screenshots?

If applicable, add screenshots to help explain your problem.

Do you have any additional context?

Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions