Skip to content

feat(contracts): validate bulk operations at the boundary (#1196) - #1269

Open
ZacLou wants to merge 2 commits into
Talenttrust:mainfrom
ZacLou:feat/schema-validation-bulk-1196
Open

ZacLou wants to merge 2 commits into
Talenttrust:mainfrom
ZacLou:feat/schema-validation-bulk-1196

Conversation

@ZacLou

@ZacLou ZacLou commented Sep 5, 2026

Copy link
Copy Markdown

Summary

Closes #1196.

This moves validation for the contract bulk API to the request boundary, while preserving the endpoint's existing partial-success behavior.

Changes

  • Added bulkContractItemSchema as a Zod discriminated union over action.
  • create reuses the existing create-contract schema.
  • update reuses the existing update-contract schema and accepts either contractId or id.
  • delete requires version and accepts either contractId or id.
  • Added a superRefine rule requiring an identifier for update and delete.
  • Replaced ad-hoc controller checks with per-item safeParse.
  • Invalid items now return a structured validation_error with field-level details.
  • Valid items continue to be processed, so one invalid item does not reject the entire batch.
  • The outer bulk schema continues to enforce the batch structure before the controller performs per-item validation.

Verification

  • Targeted Jest suites: 3 suites / 16 tests passing.
  • Targeted ESLint: no reported errors.
  • Targeted TypeScript checking on the five changed files: no diagnostics.
  • I did not fold unrelated repository fixes into this PR.

@ZacLou
ZacLou force-pushed the feat/schema-validation-bulk-1196 branch from ef26bf3 to f4ad98d Compare September 6, 2026 10:52
…t#1196)

- Reuse the existing create/update Zod schemas for bulk items

- Enforce field bounds, strip unknown fields, and return per-field errors

- Require a contract identifier for update and delete items

- Map update items through the typed boundary mapper

- Add schema and HTTP integration tests
@ZacLou
ZacLou force-pushed the feat/schema-validation-bulk-1196 branch from f4ad98d to 8140284 Compare September 6, 2026 10:56
@ZacLou ZacLou changed the title feat(contracts): schema-based request validation with bounds for bulk endpoints feat(contracts): validate bulk operations at the boundary (#1196) Sep 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schema-based request validation with bounds for contracts endpoints

1 participant