fix: add 0-100 bounds validation for field coordinates

This commit is contained in:
Ephraim Atta-Duncan
2025-10-24 12:11:11 +00:00
parent 47bdcd833f
commit 3ba2dd0613
3 changed files with 38 additions and 16 deletions

View File

@ -57,17 +57,27 @@ export const ZFieldPageNumberSchema = z
export const ZFieldPageXSchema = z
.number()
.min(0)
.min(0, 'Must be between 0-100 (percentage of page width)')
.max(100, 'Must be between 0-100 (percentage of page width)')
.describe('The X coordinate of where the field will be placed.');
export const ZFieldPageYSchema = z
.number()
.min(0)
.min(0, 'Must be between 0-100 (percentage of page height)')
.max(100, 'Must be between 0-100 (percentage of page height)')
.describe('The Y coordinate of where the field will be placed.');
export const ZFieldWidthSchema = z.number().min(1).describe('The width of the field.');
export const ZFieldWidthSchema = z
.number()
.min(0, 'Must be between 0-100 (percentage of page width)')
.max(100, 'Must be between 0-100 (percentage of page width)')
.describe('The width of the field.');
export const ZFieldHeightSchema = z.number().min(1).describe('The height of the field.');
export const ZFieldHeightSchema = z
.number()
.min(0, 'Must be between 0-100 (percentage of page height)')
.max(100, 'Must be between 0-100 (percentage of page height)')
.describe('The height of the field.');
// ---------------------------------------------