Prepare jsonschema replacement for identity.{group,user}

Change-Id: I2569fe4e6685f14d57699e51ccaf9d4ef8cefd43
This commit is contained in:
Artem Goncharov
2025-01-09 12:16:36 +01:00
parent f4fe3bd80a
commit 9cbf8d9c2b

View File

@@ -19,43 +19,43 @@ from codegenerator.common.schema import TypeSchema
USER_LIST_PARAMETERS: dict[str, Any] = { USER_LIST_PARAMETERS: dict[str, Any] = {
"domain_id": { "users_domain_id": {
"in": "query", "in": "query",
"name": "domain_id", "name": "domain_id",
"description": "Filters the response by a domain ID.", "description": "Filters the response by a domain ID.",
"schema": {"type": "string", "format": "uuid"}, "schema": {"type": "string", "format": "uuid"},
}, },
"enabled": { "users_enabled": {
"in": "query", "in": "query",
"name": "enabled", "name": "enabled",
"description": "If set to true, then only enabled projects will be returned. Any value other than 0 (including no value) will be interpreted as true.", "description": "If set to true, then only enabled projects will be returned. Any value other than 0 (including no value) will be interpreted as true.",
"schema": {"type": "boolean"}, "schema": {"type": "boolean"},
}, },
"idp_id": { "users_idp_id": {
"in": "query", "in": "query",
"name": "idp_id", "name": "idp_id",
"description": "Filters the response by IDP ID.", "description": "Filters the response by IDP ID.",
"schema": {"type": "string", "format": "uuid"}, "schema": {"type": "string", "format": "uuid"},
}, },
"name": { "users_name": {
"in": "query", "in": "query",
"name": "name", "name": "name",
"description": "Filters the response by a resource name.", "description": "Filters the response by a resource name.",
"schema": {"type": "string"}, "schema": {"type": "string"},
}, },
"password_expires_at": { "users_password_expires_at": {
"in": "query", "in": "query",
"name": "password_expires_at", "name": "password_expires_at",
"description": "Filter results based on which user passwords have expired. The query should include an operator and a timestamp with a colon (:) separating the two, for example: `password_expires_at={operator}:{timestamp}`.\nValid operators are: `lt`, `lte`, `gt`, `gte`, `eq`, and `neq`.\nValid timestamps are of the form: YYYY-MM-DDTHH:mm:ssZ.", "description": "Filter results based on which user passwords have expired. The query should include an operator and a timestamp with a colon (:) separating the two, for example: `password_expires_at={operator}:{timestamp}`.\nValid operators are: `lt`, `lte`, `gt`, `gte`, `eq`, and `neq`.\nValid timestamps are of the form: YYYY-MM-DDTHH:mm:ssZ.",
"schema": {"type": "string", "format": "date-time"}, "schema": {"type": "string", "format": "date-time"},
}, },
"protocol_id": { "users_protocol_id": {
"in": "query", "in": "query",
"name": "protocol_id", "name": "protocol_id",
"description": "Filters the response by a protocol ID.", "description": "Filters the response by a protocol ID.",
"schema": {"type": "string", "format": "uuid"}, "schema": {"type": "string", "format": "uuid"},
}, },
"unique_id": { "users_unique_id": {
"in": "query", "in": "query",
"name": "unique_id", "name": "unique_id",
"description": "Filters the response by a unique ID.", "description": "Filters the response by a unique ID.",
@@ -74,12 +74,36 @@ USER_SCHEMA: dict[str, Any] = {
USER_CREATE_SCHEMA: dict[str, Any] = { USER_CREATE_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"properties": {"user": identity_schema.user_create}, "properties": {
"user": {
"type": "object",
"properties": {
"password": {"type": ["string", "null"]},
**identity_schema._user_properties,
},
"required": ["name"],
"additionalProperties": True,
}
},
"required": ["user"],
"additionalProperties": False,
} }
USER_PATCH_SCHEMA: dict[str, Any] = { USER_PATCH_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"properties": {"user": identity_schema.user_update}, "properties": {
"user": {
"type": "object",
"properties": {
"password": {"type": ["string", "null"]},
**identity_schema._user_properties,
},
"minProperties": 1,
"additionalProperties": True,
}
},
"required": ["user"],
"additionalProperties": False,
} }