Fix LB failover schemas

LB and amphora failover schemas are explicit null.
Without that generated code fails with `Request must be a JSON dict`.
Change-Id: Ic2a8b46e1c29b0a1e85efe8757d241d3c31b28aa
This commit is contained in:
Artem Goncharov
2024年12月09日 14:38:28 +01:00
parent e306626db0
commit f5b58b5f96

View File

@@ -19,6 +19,7 @@ from unittest import mock
import fixtures
from codegenerator.common.schema import SpecSchema
from codegenerator.common.schema import TypeSchema
from codegenerator.openapi.base import (
OpenStackServerSourceBase,
_convert_wsme_to_jsonschema,
@@ -1169,3 +1170,34 @@ class OctaviaGenerator(OpenStackServerSourceBase):
response_body_schema,
expected_errors,
)
def _get_schema_ref(
self,
openapi_spec,
name,
description=None,
schema_def=None,
action_name=None,
):
schema: None = None
ref: str | None
mime_type: str | None = "application/json"
if name in [
"LbaasLoadbalancersFailoverFailoverRequest",
"OctaviaAmphoraeFailoverFailoverRequest",
]:
schema = openapi_spec.components.schemas.setdefault(
name, TypeSchema(type="null")
)
ref = f"#/components/schemas/{name}"
else:
(ref, mime_type) = super()._get_schema_ref(
openapi_spec,
name,
description,
schema_def=schema_def,
action_name=action_name,
)
return (ref, mime_type)
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.