From f8ff329936e1b33f4854b0945ca2d4345dcb9aa1 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Tue, 26 Nov 2024 17:48:29 +0100 Subject: [PATCH] Re-enable building of nova openapi specs as a voting job Few schemas changed in nova so that the code is again broken so adapt templates. Change-Id: I129cd24c63cb7cbb996bb4c9b95e0c9fdb6a2c14 --- codegenerator/rust_cli.py | 2 +- codegenerator/tests/unit/test_rust_cli.py | 2 +- zuul.d/project.yaml | 6 ++---- zuul.d/rust.yaml | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/codegenerator/rust_cli.py b/codegenerator/rust_cli.py index 21d1d23..2e5d8c0 100644 --- a/codegenerator/rust_cli.py +++ b/codegenerator/rust_cli.py @@ -250,7 +250,7 @@ class StructFieldResponse(common_rust.StructField): operation_type: str, ): macros = set() - if self.is_optional: + if self.is_optional or self.data_type.type_hint.startswith("Option<"): macros.add("optional") if self.local_name != self.remote_name: macros.add(f'title="{self.remote_name}"') diff --git a/codegenerator/tests/unit/test_rust_cli.py b/codegenerator/tests/unit/test_rust_cli.py index c24213d..dcd3c37 100644 --- a/codegenerator/tests/unit/test_rust_cli.py +++ b/codegenerator/tests/unit/test_rust_cli.py @@ -37,7 +37,7 @@ struct ResponseData { /// aoaos /// #[serde()] - #[structable(pretty)] + #[structable(optional,pretty)] foo: Option, } """ diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 943b0c5..69b9574 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -8,8 +8,7 @@ - openstack-tox-py311 - codegenerator-openapi-baremetal-tips-with-api-ref - codegenerator-openapi-block-storage-tips-with-api-ref - - codegenerator-openapi-compute-tips-with-api-ref: - voting: false + - codegenerator-openapi-compute-tips-with-api-ref - codegenerator-openapi-dns-tips-with-api-ref - codegenerator-openapi-identity-tips-with-api-ref - codegenerator-openapi-image-tips-with-api-ref @@ -26,8 +25,7 @@ - openstack-tox-py311 - codegenerator-openapi-baremetal-tips-with-api-ref - codegenerator-openapi-block-storage-tips-with-api-ref - - codegenerator-openapi-compute-tips-with-api-ref: - voting: false + - codegenerator-openapi-compute-tips-with-api-ref - codegenerator-openapi-dns-tips-with-api-ref - codegenerator-openapi-identity-tips-with-api-ref - codegenerator-openapi-image-tips-with-api-ref diff --git a/zuul.d/rust.yaml b/zuul.d/rust.yaml index b84c0a1..6fab1a4 100644 --- a/zuul.d/rust.yaml +++ b/zuul.d/rust.yaml @@ -53,8 +53,8 @@ dependencies: - name: codegenerator-openapi-block-storage-tips-with-api-ref soft: true - # - name: codegenerator-openapi-compute-tips-with-api-ref - # soft: true + - name: codegenerator-openapi-compute-tips-with-api-ref + soft: true - name: codegenerator-openapi-dns-tips-with-api-ref soft: true - name: codegenerator-openapi-identity-tips-with-api-ref