-
-
Notifications
You must be signed in to change notification settings - Fork 253
add iso 8601 duration action #1102
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you very much! It may take me a while to review this PR as it is very important to me to check the validation closely. I hope to get back to you next week. |
Yeah, this one is quite biggish. There's still also a question of whether 8601 (current), 8601-1 (allows to use Week designator with Year/Month/Day) or 8601-2 (allows +- before P, to determine if it's positive or negative value) should be supported. |
I will focus on reviewing and merging other actions first. If users want to see this PR merged, please give a 👍. |
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.
Pull Request Overview
This PR adds support for ISO8601 durations by introducing a new action, issue, and corresponding type definitions along with documentation and tests.
- Added new API routes in the documentation for isoDuration actions and issues
- Created type definitions for IsoDurationIssue and IsoDurationAction in the API types folder
- Implemented the isoDuration action, its validation function, and added comprehensive tests
Reviewed Changes
Copilot reviewed 10 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
website/src/routes/api/menu.md | Updated API menu with isoDuration and related entries |
website/src/routes/api/(types)/IsoDurationIssue/properties.ts | Added property definitions for IsoDurationIssue |
website/src/routes/api/(types)/IsoDurationAction/properties.ts | Added property definitions for IsoDurationAction |
website/src/routes/api/(actions)/isoDuration/properties.ts | Added property definitions for the isoDuration action |
library/src/actions/isoDuration/isoDuration.ts | Implemented the isoDuration action and overloads |
library/src/actions/isoDuration/isoDuration.test.ts | Provided tests covering valid and invalid ISO duration cases |
library/src/actions/isoDuration/isoDuration.test-d.ts | Added type tests for the isoDuration action |
library/src/actions/isoDuration/isISO8601Duration.ts | Implemented the validation function for ISO8601 durations |
library/src/actions/isoDuration/index.ts | Exported the isoDuration action |
library/src/actions/index.ts | Included exports for the new isoDuration action |
Files not reviewed (8)
- website/src/routes/api/(actions)/isoDuration/index.mdx: Language not supported
- website/src/routes/api/(methods)/pipe/index.mdx: Language not supported
- website/src/routes/api/(schemas)/any/index.mdx: Language not supported
- website/src/routes/api/(schemas)/custom/index.mdx: Language not supported
- website/src/routes/api/(schemas)/string/index.mdx: Language not supported
- website/src/routes/api/(schemas)/unknown/index.mdx: Language not supported
- website/src/routes/api/(types)/IsoDurationAction/index.mdx: Language not supported
- website/src/routes/api/(types)/IsoDurationIssue/index.mdx: Language not supported
commit: |
This schema is very niche, and I wouldn’t expect many people to need it. This is more of to have better compatibility with JSON Schemas. with that in mind, this PR misses adjustments for to-json-schema package, so that this gets transformed to string’s format. Same for |
I will try to release it with Valibot v1.2 |
ISO8601 Duration (https://en.wikipedia.org/wiki/ISO_8601#Durations) - used (primarly) by
string()
schema