Fix role_assignments command

In the cli generation it was assumed that the first element in the
response schema is the object itself. That is used to check whether the
response is list or not. Now the role_assignment schema return `links`
object first breaking that assumption. Extend the check to first look at
the `response_key` that we identified previously.
Change-Id: Ib2cf6e394486ebd0a475ed3d9bba97feefcd5205
This commit is contained in:
Artem Goncharov
2025年05月17日 12:25:57 +02:00
parent d201f9a6d9
commit d3f1f124e5

View File

@@ -901,7 +901,7 @@ class RustCliGenerator(BaseGenerator):
)
if response:
response_key: str
response_key: str | None
if args.response_key:
response_key = (
args.response_key
@@ -910,7 +910,7 @@ class RustCliGenerator(BaseGenerator):
)
else:
response_key = resource_name
response_def, _ = common.find_resource_schema(
response_def, response_key = common.find_resource_schema(
response, None, response_key
)
@@ -960,9 +960,15 @@ class RustCliGenerator(BaseGenerator):
)
response_props = response.get("properties", {})
if (
response_props
and response_props[
if response_props and (
(
response_key
and response_props.get(response_key, {}).get(
"type"
)
== "array"
)
or response_props[
list(response_props.keys())[0]
].get("type")
== "array"
Reference in New Issue
openstack/codegenerator
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.