remove zone_id QP from listing zone recordsets
Currently codegenerator is not supporting param with the same name to be present in path and query params (and this makes no sense). In the DNS it was the case so get rid of it. Change-Id: Id1e619c9cea0b1c76d1da3cfcf20e547f3cd4b3f
This commit is contained in:
@@ -1029,6 +1029,10 @@ class TypeManager:
|
||||
is_flag=parameter.is_flag,
|
||||
resource_link=parameter.resource_link,
|
||||
)
|
||||
if param.local_name in self.parameters:
|
||||
raise RuntimeError(
|
||||
"Parameter with the name {param.local_name} is already present"
|
||||
)
|
||||
self.parameters[param.local_name] = param
|
||||
|
||||
def get_parameters(
|
||||
|
||||
@@ -367,7 +367,7 @@ RECORDSETS_SCHEMA: dict[str, Any] = {
|
||||
"additionalProperties": False,
|
||||
}
|
||||
|
||||
RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
||||
ZONE_RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
||||
"x-auth-all-projects": {
|
||||
"in": "header",
|
||||
"name": "x-auth-all-projects",
|
||||
@@ -418,12 +418,6 @@ RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
||||
],
|
||||
},
|
||||
},
|
||||
"zone_id": {
|
||||
"in": "query",
|
||||
"name": "zone_id",
|
||||
"description": "ID of the zone",
|
||||
"schema": {"type": "string", "format": "uuid"},
|
||||
},
|
||||
"name": {
|
||||
"in": "query",
|
||||
"name": "name",
|
||||
@@ -462,6 +456,16 @@ RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
||||
},
|
||||
}
|
||||
|
||||
RECORDSETS_LIST_PARAMETERS: dict[str, Any] = {
|
||||
"zone_id": {
|
||||
"in": "query",
|
||||
"name": "zone_id",
|
||||
"description": "ID for the zone",
|
||||
"schema": {"type": "string", "format": "uuid"},
|
||||
},
|
||||
**ZONE_RECORDSETS_LIST_PARAMETERS,
|
||||
}
|
||||
|
||||
|
||||
def _post_process_operation_hook(
|
||||
openapi_spec, operation_spec, path: str | None = None
|
||||
@@ -477,6 +481,14 @@ def _post_process_operation_hook(
|
||||
if ref not in [x.ref for x in operation_spec.parameters]:
|
||||
operation_spec.parameters.append(ParameterSchema(ref=ref))
|
||||
elif operationId == "zones/zone_id/recordsets:get":
|
||||
for key, val in ZONE_RECORDSETS_LIST_PARAMETERS.items():
|
||||
openapi_spec.components.parameters.setdefault(
|
||||
key, ParameterSchema(**val)
|
||||
)
|
||||
ref = f"#/components/parameters/{key}"
|
||||
if ref not in [x.ref for x in operation_spec.parameters]:
|
||||
operation_spec.parameters.append(ParameterSchema(ref=ref))
|
||||
elif operationId == "recordsets:get":
|
||||
for key, val in RECORDSETS_LIST_PARAMETERS.items():
|
||||
openapi_spec.components.parameters.setdefault(
|
||||
key, ParameterSchema(**val)
|
||||
|
||||
@@ -462,7 +462,7 @@ Some({{ val }})
|
||||
"{{ prefix }}{{ url }}",
|
||||
{%- for k, v in params.items() %}
|
||||
{%- if v.location == "path" %}
|
||||
{{ k }} = {{ ('"' + k + '"') if not from_attr else ('self.' + v.local_name + '.as_ref()') }},
|
||||
{{ v.local_name }} = {{ ('"' + v.local_name + '"') if not from_attr else ('self.' + v.local_name + '.as_ref()') }},
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user