-
Notifications
You must be signed in to change notification settings - Fork 1.2k
patch handling for non object extract #1295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 2fb7c42 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile OverviewGreptile SummaryFixed zod v3/v4 compatibility issue when extracting non-object schemas by using
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ExtractHandler
participant getZFactory
participant ZodFactory
participant transformSchema
User->>ExtractHandler: extract(params with non-object schema)
ExtractHandler->>ExtractHandler: check if schema is object
alt Schema is not object
ExtractHandler->>getZFactory: getZFactory(baseSchema)
getZFactory->>getZFactory: check isZod4Schema(schema)
alt Zod v4
getZFactory-->>ExtractHandler: return zFactories.v4
else Zod v3
getZFactory-->>ExtractHandler: return zFactories.v3
end
ExtractHandler->>ZodFactory: factory.object({ value: baseSchema })
ZodFactory-->>ExtractHandler: wrapped object schema
else Schema is object
ExtractHandler->>ExtractHandler: use baseSchema directly
end
ExtractHandler->>transformSchema: transformUrlStringsToNumericIds(objectSchema)
transformSchema-->>ExtractHandler: [transformedSchema, urlFieldPaths]
ExtractHandler->>User: return extracted data
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
…n-object-extract # Conflicts: # packages/core/tests/public-types.test.ts
This reverts commit b48c4b0.
why
currently when importing zod vrom zod/v3, and extracting a non object, it will throw an error "def is undefined"
what changed
replace static z.object with factory.object, to ensure we always wrap it in correct zod versions schema
test plan
tested locally