Adapt identity schemas

- change description of the idp_id user list param
- drop domain schemas since they are integrated in keystone.

Change-Id: Ic83561234e4d2ba9f520aa3c3f8b21dc4f9ce80b
This commit is contained in:
Artem Goncharov 2024-12-10 14:53:29 +01:00
parent f5b58b5f96
commit 87b3c98433
2 changed files with 2 additions and 74 deletions

View File

@ -17,52 +17,6 @@ from codegenerator.common.schema import ParameterSchema
from codegenerator.common.schema import TypeSchema
DOMAIN_SCHEMA: dict[str, Any] = {
"type": "object",
"description": "A domain object",
"properties": {
"id": {"type": "string", "format": "uuid", "readOnly": True},
"name": {
"type": "string",
"description": "The name of the domain.",
"minLength": 1,
"maxLength": 255,
"pattern": r"[\S]+",
},
"description": {
"type": "string",
"description": "The description of the domain.",
},
"enabled": {
"type": "boolean",
"description": "If set to true, domain is enabled. If set to false, domain is disabled.",
},
"tags": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[^,/]*$",
"minLength": 1,
"maxLength": 255,
},
},
"options": {
"type": "object",
"description": "The resource options for the domain. Available resource options are immutable.",
},
},
}
DOMAIN_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object",
"properties": {"domain": DOMAIN_SCHEMA},
}
DOMAINS_SCHEMA: dict[str, Any] = {
"type": "object",
"properties": {"domains": {"type": "array", "items": DOMAIN_SCHEMA}},
}
DOMAIN_CONFIGS_SCHEMA: dict[str, Any] = {
"type": "object",
"properties": {
@ -125,14 +79,6 @@ def _post_process_operation_hook(
"""Hook to allow service specific generator to modify details"""
operationId = operation_spec.operationId
if operationId == "domains:get":
for key, val in DOMAIN_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))
def _get_schema_ref(
@ -140,26 +86,8 @@ def _get_schema_ref(
) -> tuple[str | None, str | None, bool]:
mime_type: str = "application/json"
ref: str
# Domains
if name in [
"DomainsPostRequest",
"DomainsPostResponse",
"DomainGetResponse",
"DomainPatchRequest",
"DomainPatchResponse",
]:
openapi_spec.components.schemas.setdefault(
"Domain", TypeSchema(**DOMAIN_CONTAINER_SCHEMA)
)
ref = "#/components/schemas/Domain"
elif name == "DomainsGetResponse":
openapi_spec.components.schemas.setdefault(
name, TypeSchema(**DOMAINS_SCHEMA)
)
ref = f"#/components/schemas/{name}"
# Domain Config
elif name in [
if name in [
"DomainsConfigDefaultGetResponse",
"DomainsConfigGetResponse",
"DomainsConfigPutRequest",

View File

@ -34,7 +34,7 @@ USER_LIST_PARAMETERS: dict[str, Any] = {
"idp_id": {
"in": "query",
"name": "idp_id",
"description": "Filters the response by a domain ID.",
"description": "Filters the response by IDP ID.",
"schema": {"type": "string", "format": "uuid"},
},
"name": {