Skip elements with titles. (#777)

* Skip elements with titles.

Signed-off-by: dblock <dblock@amazon.com>

* Simplify and just skip by ref.

Signed-off-by: dblock <dblock@amazon.com>

* Re-generate API spec.

Signed-off-by: dblock <dblock@amazon.com>

* Do not skip alias tests.

Signed-off-by: dblock <dblock@amazon.com>

* Actually skip node_id_or_metric.

Signed-off-by: dblock <dblock@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
This commit is contained in:
Daniel (dB.) Doubrovkine
2024-07-18 15:24:38 -05:00
committed by GitHub
parent 04b870d68a
commit 1ef788a55a
5 changed files with 31 additions and 25 deletions
+1
View File
@@ -10,6 +10,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fixed Search helper to ensure proper retention of the _collapse attribute in chained operations. ([#771](https://github.com/opensearch-project/opensearch-py/pull/771))
### Updated APIs
- Updated opensearch-py APIs to reflect [opensearch-api-specification@0453dbe](https://github.com/opensearch-project/opensearch-api-specification/commit/0453dbe35080bf31eebac1d75f8022667d019e9f)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@0b033a9](https://github.com/opensearch-project/opensearch-api-specification/commit/0b033a92cac4cb20ec3fb51350c139afc753b089)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@d5ca873](https://github.com/opensearch-project/opensearch-api-specification/commit/d5ca873d20ff54be16ec48e7bd629cda7c4a6332)
- Updated opensearch-py APIs to reflect [opensearch-api-specification@7452827](https://github.com/opensearch-project/opensearch-api-specification/commit/745282767026703ea27967d2705633c3e2661c97)
+7 -8
View File
@@ -592,6 +592,7 @@ class IndicesClient(NamespacedClient):
@query_params(
"allow_no_indices",
"cluster_manager_timeout",
"error_trace",
"expand_wildcards",
"filter_path",
@@ -619,6 +620,8 @@ class IndicesClient(NamespacedClient):
if any wildcard expression, index alias, or `_all` value targets only
missing or closed indices.This behavior applies even if the request
targets other open indices. Default is false.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg expand_wildcards: Type of index that wildcard patterns can
@@ -861,9 +864,9 @@ class IndicesClient(NamespacedClient):
)
async def put_alias(
self,
index: Any,
name: Any,
body: Any = None,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
@@ -871,13 +874,13 @@ class IndicesClient(NamespacedClient):
Creates or updates an alias.
:arg body: The settings for the alias, such as `routing` or
`filter`
:arg index: Comma-separated list of data streams or indices to
add. Supports wildcards (`*`). Wildcard patterns that match both data
streams and indices return an error.
:arg name: Alias to update. If the alias doesn't exist, the
request creates it. Index alias names support date math.
:arg body: The settings for the alias, such as `routing` or
`filter`
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
@@ -898,10 +901,6 @@ class IndicesClient(NamespacedClient):
received before the timeout expires, the request fails and returns an
error.
"""
for param in (index, name):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return await self.transport.perform_request(
"PUT",
_make_path(index, "_alias", name),
+7 -8
View File
@@ -592,6 +592,7 @@ class IndicesClient(NamespacedClient):
@query_params(
"allow_no_indices",
"cluster_manager_timeout",
"error_trace",
"expand_wildcards",
"filter_path",
@@ -619,6 +620,8 @@ class IndicesClient(NamespacedClient):
if any wildcard expression, index alias, or `_all` value targets only
missing or closed indices.This behavior applies even if the request
targets other open indices. Default is false.
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
errors.
:arg expand_wildcards: Type of index that wildcard patterns can
@@ -861,9 +864,9 @@ class IndicesClient(NamespacedClient):
)
def put_alias(
self,
index: Any,
name: Any,
body: Any = None,
index: Any = None,
name: Any = None,
params: Any = None,
headers: Any = None,
) -> Any:
@@ -871,13 +874,13 @@ class IndicesClient(NamespacedClient):
Creates or updates an alias.
:arg body: The settings for the alias, such as `routing` or
`filter`
:arg index: Comma-separated list of data streams or indices to
add. Supports wildcards (`*`). Wildcard patterns that match both data
streams and indices return an error.
:arg name: Alias to update. If the alias doesn't exist, the
request creates it. Index alias names support date math.
:arg body: The settings for the alias, such as `routing` or
`filter`
:arg cluster_manager_timeout: Operation timeout for connection
to cluster-manager node.
:arg error_trace: Whether to include the stack trace of returned
@@ -898,10 +901,6 @@ class IndicesClient(NamespacedClient):
received before the timeout expires, the request fails and returns an
error.
"""
for param in (index, name):
if param in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument.")
return self.transport.perform_request(
"PUT",
_make_path(index, "_alias", name),
@@ -79,9 +79,8 @@ SKIP_TESTS = {
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/cluster/put_settings/10_basic[2]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/cluster/put_settings/10_basic[3]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/index/90_unsigned_long[1]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/put_alias/10_basic[0]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/put_alias/10_basic[8]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/put_alias/10_basic[9]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/put_alias/all_path_options[5]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/put_alias/all_path_options[6]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/indices/stats/50_noop_update[0]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/search/340_doc_values_field[0]",
"OpenSearch-main/rest-api-spec/src/main/resources/rest-api-spec/test/search/340_doc_values_field[1]",
+13 -5
View File
@@ -72,6 +72,11 @@ GLOBAL_QUERY_PARAMS = {
"api_key": "Optional[Union[str, Tuple[str, str]]]",
}
IGNORED_PARAM_REFS = [
# https://github.com/opensearch-project/opensearch-api-specification/pull/416
"#/components/parameters/nodes.info::path.node_id_or_metric",
]
jinja_env = Environment(
autoescape=select_autoescape(["html", "xml"]),
loader=FileSystemLoader([CODE_ROOT / "utils" / "templates"]),
@@ -584,9 +589,13 @@ def read_modules() -> Any:
# Iterate over the list of parameters and update them
for param_ref in endpoint["parameters"]:
param = data["components"]["parameters"][
param_ref["$ref"].split("/")[-1]
]
if param_ref["$ref"] in IGNORED_PARAM_REFS:
continue
param_ref = param_ref["$ref"].split("/")[-1]
param = data["components"]["parameters"][param_ref]
if "schema" in param and "$ref" in param["schema"]:
schema_path_ref = param["schema"]["$ref"].split("/")[-1]
param["schema"] = data["components"]["schemas"][schema_path_ref]
@@ -597,8 +606,7 @@ def read_modules() -> Any:
param["schema"] = data["components"]["schemas"][
common_schema_path_ref
]
params.append(param)
else:
params.append(param)
# Iterate over the list of updated parameters to separate "parts" from "params"