From 87b3c984330f5e03466445c05264a5281cfd20b6 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Tue, 10 Dec 2024 14:53:29 +0100 Subject: [PATCH] Adapt identity schemas - change description of the idp_id user list param - drop domain schemas since they are integrated in keystone. Change-Id: Ic83561234e4d2ba9f520aa3c3f8b21dc4f9ce80b --- .../openapi/keystone_schemas/domain.py | 74 +------------------ .../openapi/keystone_schemas/user.py | 2 +- 2 files changed, 2 insertions(+), 74 deletions(-) diff --git a/codegenerator/openapi/keystone_schemas/domain.py b/codegenerator/openapi/keystone_schemas/domain.py index ab682ca..12b5630 100644 --- a/codegenerator/openapi/keystone_schemas/domain.py +++ b/codegenerator/openapi/keystone_schemas/domain.py @@ -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", diff --git a/codegenerator/openapi/keystone_schemas/user.py b/codegenerator/openapi/keystone_schemas/user.py index f7b0836..bb72862 100644 --- a/codegenerator/openapi/keystone_schemas/user.py +++ b/codegenerator/openapi/keystone_schemas/user.py @@ -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": {