Closed dblock closed 1 year ago
Merging #549 (f7cbc6b) into main (627e717) will increase coverage by
0.13%
. The diff coverage is50.76%
.
@@ Coverage Diff @@
## main #549 +/- ##
==========================================
+ Coverage 70.68% 70.81% +0.13%
==========================================
Files 83 85 +2
Lines 7862 7793 -69
==========================================
- Hits 5557 5519 -38
+ Misses 2305 2274 -31
Files | Coverage Δ | |
---|---|---|
opensearchpy/_async/client/cat.py | 65.78% <ø> (ø) |
|
opensearchpy/_async/client/cluster.py | 51.76% <100.00%> (ø) |
|
opensearchpy/_async/client/dangling_indices.py | 53.33% <ø> (ø) |
|
opensearchpy/_async/client/indices.py | 46.22% <ø> (+0.51%) |
:arrow_up: |
opensearchpy/_async/client/ingest.py | 50.00% <ø> (ø) |
|
opensearchpy/_async/client/nodes.py | 63.15% <ø> (ø) |
|
opensearchpy/_async/client/snapshot.py | 40.67% <100.00%> (+0.05%) |
:arrow_up: |
opensearchpy/_async/client/tasks.py | 64.28% <ø> (ø) |
|
opensearchpy/client/cat.py | 65.78% <ø> (ø) |
|
opensearchpy/client/cluster.py | 56.47% <100.00%> (ø) |
|
... and 13 more |
@saimedhi When running the generator we end up with 1 failing test that calls put_mapping
with an index name that is not optional extracted from the path. Looks like OpenSearch supports _all
, and the Python code gladly facilitates that by overriding the implementation and setting the value. We also need to override the method definition so that index = None
. I couldn't find a way to do it, so I came up with patching the OpenAPI spec. Not sure whether this is the right approach?
@saimedhi When running the generator we end up with 1 failing test that calls
put_mapping
with an index name that is not optional extracted from the path. Looks like OpenSearch supports_all
, and the Python code gladly facilitates that by overriding the implementation and setting the value. We also need to override the method definition so thatindex = None
. I couldn't find a way to do it, so I came up with patching the OpenAPI spec. Not sure whether this is the right approach?
Thank you @dblock, for working on this. Can I take it from here? For put_mapping, alternative approach is to use the below code in the generator.
if namespace == "indices" and name == "put_mapping":
api["url"]["paths"][0]["parts"]["index"].update({"required": False})
@saimedhi When running the generator we end up with 1 failing test that calls
put_mapping
with an index name that is not optional extracted from the path. Looks like OpenSearch supports_all
, and the Python code gladly facilitates that by overriding the implementation and setting the value. We also need to override the method definition so thatindex = None
. I couldn't find a way to do it, so I came up with patching the OpenAPI spec. Not sure whether this is the right approach?Thank you @dblock, for working on this. Can I take it from here? For put_mapping, alternative approach is to use the below code in the generator.
if namespace == "indices" and name == "put_mapping": api["url"]["paths"][0]["parts"]["index"].update({"required": False})
Yes of course. I think my version of patching the API definition is a bit more generic :)
Will close this one, feel free to take any parts of it @saimedhi into #543.
Description
Finishes #434 and https://github.com/opensearch-project/opensearch-py/pull/543.
Introduces a way to override API spec.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.