Description and expected behavior
Line 471 unconditionally calls z.strictObject, but it is expected that the strictness should be respected.
Adjusting this behavior could be considered a breaking change.
|
makeTypeSchema<Type extends GetTypeDefs<Schema>>( |
|
type: Type, |
|
): z.ZodObject<GetTypeDefFieldsShape<Schema, Type>, z.core.$strict> { |
|
const typeDef = this.schema.requireTypeDef(type); |
|
const fields: Record<string, z.ZodType> = {}; |
|
|
|
for (const [fieldName, fieldDef] of Object.entries(typeDef.fields)) { |
|
fields[fieldName] = this.applyDescription(this.makeScalarFieldSchema(fieldDef), fieldDef.attributes); |
|
} |
|
|
|
const shape = z.strictObject(fields); |
|
return this.applyDescription( |
|
addCustomValidation(shape, typeDef.attributes), |
|
typeDef.attributes, |
|
) as unknown as z.ZodObject<GetTypeDefFieldsShape<Schema, Type>, z.core.$strict>; |
|
} |
Description and expected behavior
Line 471 unconditionally calls
z.strictObject, but it is expected that the strictness should be respected.Adjusting this behavior could be considered a breaking change.
zenstack/packages/zod/src/factory.ts
Lines 461 to 476 in b51d33c