Skip to content

Commit 9d12637

Browse files
Copilothotlong
andcommitted
Fix test data to match evolved schemas
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent d144638 commit 9d12637

2 files changed

Lines changed: 43 additions & 13 deletions

File tree

packages/spec/src/data/validation.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
736736
type: 'custom' as const,
737737
name: 'custom_business_rule',
738738
message: 'Custom validation failed',
739-
field: 'business_field',
740-
validatorFunction: 'validateBusinessRule',
739+
handler: 'validateBusinessRule',
741740
};
742741

743742
expect(() => ValidationRuleSchema.parse(customValidation)).not.toThrow();
@@ -748,8 +747,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
748747
type: 'custom' as const,
749748
name: 'complex_validation',
750749
message: 'Validation failed',
751-
field: 'data',
752-
validatorFunction: 'complexValidator',
750+
handler: 'complexValidator',
753751
params: {
754752
threshold: 100,
755753
mode: 'strict',
@@ -764,7 +762,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
764762
type: 'custom' as const,
765763
name: 'record_level_check',
766764
message: 'Record validation failed',
767-
validatorFunction: 'validateEntireRecord',
765+
handler: 'validateEntireRecord',
768766
};
769767

770768
expect(() => ValidationRuleSchema.parse(validation)).not.toThrow();
@@ -1058,7 +1056,7 @@ describe('ValidationRuleSchema (Discriminated Union)', () => {
10581056
type: 'custom',
10591057
name: 'business_logic',
10601058
message: 'Business logic validation failed',
1061-
validatorFunction: 'validateBusinessRules',
1059+
handler: 'validateBusinessRules',
10621060
},
10631061
{
10641062
type: 'conditional',
@@ -1212,8 +1210,7 @@ describe('ValidationRuleSchema - Edge Cases and Null Handling', () => {
12121210
type: 'custom' as const,
12131211
name: 'custom_validation',
12141212
message: 'Validation failed',
1215-
field: undefined, // Optional for record-level validation
1216-
validatorFunction: 'validateRecord',
1213+
handler: 'validateRecord',
12171214
params: undefined,
12181215
};
12191216

@@ -1225,7 +1222,7 @@ describe('ValidationRuleSchema - Edge Cases and Null Handling', () => {
12251222
type: 'custom' as const,
12261223
name: 'custom_validation',
12271224
message: 'Validation failed',
1228-
validatorFunction: 'validateRecord',
1225+
handler: 'validateRecord',
12291226
params: {},
12301227
};
12311228

@@ -1339,7 +1336,7 @@ describe('ValidationRuleSchema - Type Coercion Edge Cases', () => {
13391336
type: 'custom' as const,
13401337
name: 'custom_test',
13411338
message: 'Test',
1342-
validatorFunction: 'validate',
1339+
handler: 'validate',
13431340
params,
13441341
};
13451342

packages/spec/src/hub/tenant.zod.ts

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,42 @@ export const TenantQuotaSchema = z.object({
4848

4949
export type TenantQuota = z.infer<typeof TenantQuotaSchema>;
5050

51-
// Tenant Schema REMOVED.
52-
// The concept of a "Tenant" is now an attribute of a "Space".
53-
// See HubSpaceSchema in space.zod.ts which embeds TenantIsolationLevel and TenantQuotaSchema.
51+
/**
52+
* Tenant Schema
53+
*
54+
* Legacy schema maintained for backward compatibility.
55+
* New implementations should use HubSpaceSchema which embeds tenant concepts.
56+
*
57+
* @deprecated Use HubSpaceSchema instead
58+
*/
59+
export const TenantSchema = z.object({
60+
/**
61+
* Unique tenant identifier
62+
*/
63+
id: z.string().describe('Unique tenant identifier'),
64+
65+
/**
66+
* Tenant display name
67+
*/
68+
name: z.string().describe('Tenant display name'),
69+
70+
/**
71+
* Data isolation level
72+
*/
73+
isolationLevel: TenantIsolationLevel,
74+
75+
/**
76+
* Custom configuration values
77+
*/
78+
customizations: z.record(z.any()).optional().describe('Custom configuration values'),
79+
80+
/**
81+
* Resource quotas
82+
*/
83+
quotas: TenantQuotaSchema.optional(),
84+
});
85+
86+
export type Tenant = z.infer<typeof TenantSchema>;
5487

5588
/**
5689
* Tenant Isolation Strategy Documentation

0 commit comments

Comments
 (0)