[PR #2095] [CLOSED] fix: add 0-100 bounds validation for field coordinates #2049

Closed
opened 2026-02-26 20:32:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2095
Author: @ephraimduncan
Created: 10/24/2025
Status: Closed

Base: mainHead: fix/field-coordinate-bounds


📝 Commits (2)

  • 3ba2dd0 fix: add 0-100 bounds validation for field coordinates
  • 1424448 chore: update tests

📊 Changes

4 files changed (+79 additions, -57 deletions)

View changed files

📝 packages/api/v1/schema.ts (+16 -4)
📝 packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts (+41 -41)
📝 packages/lib/types/field.ts (+14 -4)
📝 packages/trpc/server/field-router/schema.ts (+8 -8)

📄 Description

This pull request updates the validation logic for field coordinates and dimensions to enforce that all values for pageX, pageY, pageWidth, and pageHeight must be between 0 and 100, representing percentages of the page. This ensures that field positions and sizes are always within the bounds of the page.

Field coordinate and dimension validation updates:

  • Updated the ZCreateFieldSchema in packages/api/v1/schema.ts to require pageX, pageY, pageWidth, and pageHeight to be numbers between 0 and 100, with descriptive error messages for out-of-range values.
  • Modified ZFieldPageXSchema, ZFieldPageYSchema, ZFieldWidthSchema, and ZFieldHeightSchema in packages/lib/types/field.ts to enforce the 0-100 range and provide clearer error messages and descriptions.

API request schema consistency:

  • Updated both ZSetDocumentFieldsRequestSchema and ZSetFieldsForTemplateRequestSchema in packages/trpc/server/field-router/schema.ts to require pageX, pageY, pageWidth, and pageHeight to be between 0 and 100, ensuring consistent validation in API requests. [1] [2]

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2095 **Author:** [@ephraimduncan](https://github.com/ephraimduncan) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/field-coordinate-bounds` --- ### 📝 Commits (2) - [`3ba2dd0`](https://github.com/documenso/documenso/commit/3ba2dd0613f3df18e4897d5aef9780b91c8ed70b) fix: add 0-100 bounds validation for field coordinates - [`1424448`](https://github.com/documenso/documenso/commit/142444835fa2bce36c8f086c1f13054dd71ee4dc) chore: update tests ### 📊 Changes **4 files changed** (+79 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `packages/api/v1/schema.ts` (+16 -4) 📝 `packages/app-tests/e2e/api/v2/test-unauthorized-api-access.spec.ts` (+41 -41) 📝 `packages/lib/types/field.ts` (+14 -4) 📝 `packages/trpc/server/field-router/schema.ts` (+8 -8) </details> ### 📄 Description This pull request updates the validation logic for field coordinates and dimensions to enforce that all values for `pageX`, `pageY`, `pageWidth`, and `pageHeight` must be between 0 and 100, representing percentages of the page. This ensures that field positions and sizes are always within the bounds of the page. **Field coordinate and dimension validation updates:** * Updated the `ZCreateFieldSchema` in `packages/api/v1/schema.ts` to require `pageX`, `pageY`, `pageWidth`, and `pageHeight` to be numbers between 0 and 100, with descriptive error messages for out-of-range values. * Modified `ZFieldPageXSchema`, `ZFieldPageYSchema`, `ZFieldWidthSchema`, and `ZFieldHeightSchema` in `packages/lib/types/field.ts` to enforce the 0-100 range and provide clearer error messages and descriptions. **API request schema consistency:** * Updated both `ZSetDocumentFieldsRequestSchema` and `ZSetFieldsForTemplateRequestSchema` in `packages/trpc/server/field-router/schema.ts` to require `pageX`, `pageY`, `pageWidth`, and `pageHeight` to be between 0 and 100, ensuring consistent validation in API requests. [[1]](diffhunk://#diff-4141c083d1df0b1d4583f457ea720743277d658aaac3233bb52a83d76b9024acL118-R121) [[2]](diffhunk://#diff-4141c083d1df0b1d4583f457ea720743277d658aaac3233bb52a83d76b9024acL140-R143) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:32:12 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2049
No description provided.