Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bb350d5
feat(v4): implement intersection faker
soc221b Dec 28, 2025
f64e6b5
feat: implement v4 intersection infrastructure
soc221b Dec 28, 2025
055a8ab
feat: implement never intersection handler with TDD
soc221b Dec 28, 2025
81e9d0a
feat: implement literal intersection handler with TDD
soc221b Dec 28, 2025
3831d00
feat: implement v4 intersection constant type handlers
soc221b Dec 28, 2025
2e98d1e
feat: implement v4 intersection enum handler
soc221b Dec 28, 2025
9086742
Task 7.1: Add failing tests for string intersection handler
soc221b Dec 28, 2025
7842cbd
Task 7.2: Implement basic string intersection handler (Green phase)
soc221b Dec 28, 2025
408ee62
feat: complete Task 7 - String intersection handler with constraint m…
soc221b Dec 28, 2025
95eabc6
chore: update task completion status and cleanup debug files
soc221b Dec 28, 2025
1e1f065
feat(v4): complete Task 8 - number intersection handler
soc221b Dec 28, 2025
d042657
feat(v4): complete Task 9 - bigint intersection handler
soc221b Dec 28, 2025
e78bc26
feat: implement v4 boolean intersection handler
soc221b Dec 29, 2025
04dc0da
feat: implement v4 date intersection handler
soc221b Dec 29, 2025
4b3dca6
feat: implement v4 symbol intersection handler
soc221b Dec 29, 2025
2a4cc46
feat: implement Property 2 constraint merging correctness test
soc221b Dec 29, 2025
fc9337e
feat: implement tuple intersection handler (Task 14)
soc221b Dec 29, 2025
aa4cc1e
feat: implement object intersection handler with any/unknown support
soc221b Dec 29, 2025
ecda325
feat: implement array intersection handler with constraint merging
soc221b Dec 29, 2025
1b55f43
feat: implement record intersection handler with key/value type merging
soc221b Dec 29, 2025
f5b8771
feat: implement map intersection handler with key/value type merging
soc221b Dec 29, 2025
b401399
feat: implement set intersection handler with size constraint merging
soc221b Dec 29, 2025
998625b
feat(v4): implement Task 20 - Property test for recursive intersectio…
soc221b Dec 29, 2025
b8388da
feat(v4): implement union intersection handler (Task 22)
soc221b Dec 29, 2025
f61e04d
feat(v4): implement lazy intersection handler (Task 23)
soc221b Dec 29, 2025
d23331a
feat(v4): implement pipe intersection handler (Task 24)
soc221b Dec 29, 2025
8ac39e3
feat(v4): implement optional intersection handler (Task 25)
soc221b Dec 29, 2025
8bd4c33
feat(v4): implement readonly intersection handler (Task 28)
soc221b Dec 29, 2025
d40d0c8
feat(v4): implement nonoptional intersection handler (Task 29)
soc221b Dec 29, 2025
6f1075d
feat: implement catch intersection handler
soc221b Dec 30, 2025
253d9b5
feat: implement function intersection handler (task 33)
soc221b Dec 31, 2025
f26d99b
feat: complete promise intersection handler (task 34)
soc221b Dec 31, 2025
0a5c4ef
feat: implement file intersection handler (task 35)
soc221b Dec 31, 2025
44e0487
feat: implement custom intersection handler (task 36)
soc221b Dec 31, 2025
e2ab6a1
feat: implement unknown and any intersection handlers (tasks 37-38)
soc221b Dec 31, 2025
8d9cc51
feat: complete Task 40 - implement recursion protection for v4 inters…
soc221b Dec 31, 2025
c260d47
feat: complete Tasks 41-42 - add property tests for error handling an…
soc221b Dec 31, 2025
70b18da
feat(v4-intersection): complete Task 43 - optimization features
soc221b Dec 31, 2025
98e5fbd
feat(v4-intersection): complete Task 44 - future v4 type support
soc221b Dec 31, 2025
508130d
feat(v4-intersection): complete Task 45 - integration tests
soc221b Dec 31, 2025
9fd11da
feat(v4-intersection): complete Task 46 - final checkpoint
soc221b Dec 31, 2025
50e66a8
Clean up intersection implementation
soc221b Dec 31, 2025
1a7f966
feat: gap detection
soc221b Jan 1, 2026
9aa33c5
Complete v4 intersection discovery system implementation
soc221b Jan 1, 2026
9c73f22
Clean up unnecessary files and code
soc221b Jan 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
564 changes: 564 additions & 0 deletions .kiro/specs/v4-intersection/design.md

Large diffs are not rendered by default.

83 changes: 83 additions & 0 deletions .kiro/specs/v4-intersection/requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Requirements Document

## Introduction

This specification defines the requirements for implementing Zod v4 intersection schema support in the zod-schema-faker
library. The intersection type combines two schemas where the generated fake data must satisfy both schemas
simultaneously.

## Glossary

- **Intersection_Schema**: A Zod schema created using `z.intersection(left, right)` that combines two schemas
- **Left_Schema**: The first schema in an intersection operation
- **Right_Schema**: The second schema in an intersection operation
- **Fake_Generator**: The v4 function-based system that generates fake data from schemas
- **Schema_Resolver**: The algorithm that determines how to combine intersected schemas
- **Discovery_System**: The property-based testing system that generates random Zod schemas and tests intersection
support
- **Gap_Analysis**: The process of identifying unsupported intersection combinations by comparing Zod validation with
faker generation
- **Schema_Generator**: A property-based test generator that creates valid Zod v4 built-in schemas with all their checks
for intersection testing

## Requirements

### Requirement 1: Basic Intersection Support

**User Story:** As a developer using Zod v4, I want to generate fake data from intersection schemas, so that I can test
code that uses combined schema types.

#### Acceptance Criteria

1. WHEN an intersection schema is provided to the fake generator, THE Fake_Generator SHALL produce data that passes both
the Left_Schema and Right_Schema parse functions
2. WHEN the intersection of two schemas results in a non-never type, THE Fake_Generator SHALL generate valid data for
that intersection
3. WHEN the intersection of two schemas results in an impossible combination, THE Fake_Generator SHALL throw a
descriptive TypeError
4. THE Fake_Generator SHALL integrate seamlessly with the existing v4 function-based architecture

### Requirement 2: Schema Combination Logic

**User Story:** As a developer, I want the intersection resolver to handle all schema type combinations, so that I can
intersect any compatible schemas.

#### Acceptance Criteria

1. WHEN intersecting schemas of the same type, THE Schema_Resolver SHALL merge their constraints appropriately
2. WHEN intersecting schemas of different types, THE Schema_Resolver SHALL find valid combinations where output types
overlap
3. WHEN intersecting wrapper schemas (optional, nullable, default, etc.), THE Schema_Resolver SHALL handle the wrapper
logic correctly
4. WHEN intersecting complex schemas (objects, arrays, unions, etc.), THE Schema_Resolver SHALL recursively resolve
nested intersections

### Requirement 3: Error Handling and Integration

**User Story:** As a developer, I want clear error messages and good performance, so that intersection support is
reliable and efficient.

#### Acceptance Criteria

1. WHEN schemas cannot be intersected, THE Fake_Generator SHALL throw a TypeError with a descriptive message
2. THE Schema_Resolver SHALL avoid infinite recursion when processing self-referential schemas
3. THE Fake_Generator SHALL reuse the existing v4 context system for configuration and random generation
4. THE intersection implementation SHALL follow the same patterns as other v4 schema handlers

### Requirement 4: Intersection Discovery and Gap Analysis

**User Story:** As a library maintainer, I want to systematically discover what Zod intersection combinations are
accepted by Zod but not supported by the faker, so that I can identify and prioritize implementation gaps.

#### Acceptance Criteria

1. WHEN running property-based discovery tests, THE Discovery_System SHALL generate random Zod v4 built-in intersection
schemas with all their checks that are valid according to Zod's parser
2. WHEN a generated intersection schema is valid in Zod but fails in the faker, THE Discovery_System SHALL capture the
schema structure and error details for analysis
3. WHEN analyzing discovered gaps, THE Discovery_System SHALL categorize failures by schema type combinations and error
patterns
4. WHEN reporting discovery results, THE Discovery_System SHALL provide actionable information about which intersection
types need implementation or fixes
5. THE Discovery_System SHALL use property-based testing to systematically explore the intersection space of all Zod v4
built-in schema types and their checks rather than relying on manual test cases
Loading
Loading