fix: unwrapSchema calls for libraries supporting open standard schema#313
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| return schema['~standard']?.jsonSchema?.[io]?.({ | ||
| target: "draft-2020-12" | ||
| }) |
There was a problem hiding this comment.
Add the target: "draft-2020-12" parameter to fix Standard Schema compliance.
The change correctly implements the Standard Schema specification requirement for the target parameter. "draft-2020-12" is strongly recommended and widely used, making it the appropriate hardcoded value. Major validation libraries including ArkType, Valibot, and Zod co-authored the Standard Schema specification and already support this target.
🤖 Prompt for AI Agents
In src/openapi.ts around lines 518 to 520, the Standard Schema invocation must
pass the required target parameter; update the call to
schema['~standard']?.jsonSchema?.[io] to include target: "draft-2020-12" in its
options object so the generated JSON Schema conforms to the Standard Schema spec
(use the hardcoded string "draft-2020-12" as the value).
unwrapSchema calls for libraries supporting open standard schemaunwrapSchema calls for libraries supporting open standard schema
Open standard schema requires
targetproperty when callinginputandoutputconversion functions. We didn't do it, and since projects have started implementing the standard, for example, it started breaking: #312.This PR adds the required param to the call, fixing the issue. I tested it with arktype. Other code in the function was left untouched, as we should preserve old compatibility.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.