From 2234cc0d88ee154fa670a3dd0170e21748348e35 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 8 Dec 2023 11:07:53 +0400 Subject: [PATCH] Fix FieldRule * `username` can also be a list, * `realm.name` is the field name, using an intermediate `realm` object does not work. * `metadata` is not a key: keys are of the form `metadata.key = value` --- output/schema/schema.json | 63 +++++++++---------- output/typescript/types.ts | 13 ++-- .../security/_types/RoleMappingRule.ts | 14 ++--- 3 files changed, 40 insertions(+), 50 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index af1ae3d844..c0631d60df 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -171090,6 +171090,29 @@ "specLocation": "security/_types/CreatedStatus.ts#L20-L22" }, { + "attachedBehaviors": [ + "AdditionalProperties" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + { + "kind": "user_defined_value" + } + ], + "type": { + "name": "AdditionalProperties", + "namespace": "_spec_utils" + } + } + ], "kind": "interface", "name": { "name": "FieldRule", @@ -171102,7 +171125,7 @@ "type": { "kind": "instance_of", "type": { - "name": "Name", + "name": "Names", "namespace": "_types" } } @@ -171130,25 +171153,18 @@ } }, { - "name": "metadata", - "required": false, - "type": { - "kind": "user_defined_value" - } - }, - { - "name": "realm", + "name": "realm.name", "required": false, "type": { "kind": "instance_of", "type": { - "name": "Realm", - "namespace": "security._types" + "name": "Name", + "namespace": "_types" } } } ], - "specLocation": "security/_types/RoleMappingRule.ts#L33-L42", + "specLocation": "security/_types/RoleMappingRule.ts#L34-L42", "variants": { "kind": "container" } @@ -171432,27 +171448,6 @@ ], "specLocation": "security/_types/Privileges.ts#L197-L199" }, - { - "kind": "interface", - "name": { - "name": "Realm", - "namespace": "security._types" - }, - "properties": [ - { - "name": "name", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Name", - "namespace": "_types" - } - } - } - ], - "specLocation": "security/_types/RoleMappingRule.ts#L44-L46" - }, { "kind": "interface", "name": { @@ -171884,7 +171879,7 @@ } } ], - "specLocation": "security/_types/RoleMappingRule.ts#L23-L31", + "specLocation": "security/_types/RoleMappingRule.ts#L24-L32", "variants": { "kind": "container" } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4bc6d799f3..fd94ad1e9a 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -16071,13 +16071,14 @@ export interface SecurityCreatedStatus { created: boolean } -export interface SecurityFieldRule { - username?: Name +export interface SecurityFieldRuleKeys { + username?: Names dn?: Names groups?: Names - metadata?: any - realm?: SecurityRealm + 'realm.name'?: Name } +export type SecurityFieldRule = SecurityFieldRuleKeys + & { [property: string]: any } export interface SecurityFieldSecurity { except?: Fields @@ -16106,10 +16107,6 @@ export interface SecurityManageUserPrivileges { applications: string[] } -export interface SecurityRealm { - name: Name -} - export interface SecurityRealmInfo { name: Name type: string diff --git a/specification/security/_types/RoleMappingRule.ts b/specification/security/_types/RoleMappingRule.ts index b373fb4eb0..7b143d2e39 100644 --- a/specification/security/_types/RoleMappingRule.ts +++ b/specification/security/_types/RoleMappingRule.ts @@ -17,6 +17,7 @@ * under the License. */ +import { AdditionalProperties } from '@spec_utils/behaviors' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { Name, Names } from '@_types/common' @@ -33,14 +34,11 @@ export class RoleMappingRule { /** * @variants container */ -export class FieldRule { - username?: Name +export class FieldRule + implements AdditionalProperties +{ + username?: Names dn?: Names groups?: Names - metadata?: UserDefinedValue - realm?: Realm -} - -export class Realm { - name: Name + 'realm.name'?: Name }