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:
@@ -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
Block a user