Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Feat/unique items validation fixed#1

Draft
itaysabato wants to merge 10 commits intomainfrom
feat/unique-items-validation-fixed
Draft

Feat/unique items validation fixed#1
itaysabato wants to merge 10 commits intomainfrom
feat/unique-items-validation-fixed

Conversation

@itaysabato
Copy link
Copy Markdown

No description provided.

- Add uniqueItems validation using fast-deep-equal for deep comparison
- Fix array validation by adding array-level getZodChain that preserves isRequired
- Prevent object property processing from double-chaining arrays
- Add comprehensive tests for uniqueItems validation scenarios
- Add fast-deep-equal dependency for reliable deep equality checks

The uniqueItems validation is applied last in the validation chain since .refine()
returns ZodEffects which doesn't support further method chaining.

Arrays now properly handle both required and optional status while supporting
uniqueItems validation without duplication.
@itaysabato itaysabato marked this pull request as draft July 24, 2025 09:03
Comment thread lib/tests/validations.test.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
itaysabato and others added 4 commits July 24, 2025 12:38
- Return false immediately when duplicate found instead of processing entire array
- Functionally equivalent but more efficient for arrays with duplicates
- Updated test snapshots to reflect optimized logic
Comment thread lib/src/openApiToZod.ts Outdated
Comment thread lib/src/openApiToZod.ts Outdated
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant