-
Notifications
You must be signed in to change notification settings - Fork 39
feat(loader): support validate with standard schema
#237
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
Signed-off-by: ysknsid25 <[email protected]>
validate with standard schema
Signed-off-by: ysknsid25 <[email protected]>
|
@ysknsid25 i will put more time on this PR before releasing in next minor releases. It is a big feature! |
| await expect( | ||
| loadConfig({ | ||
| configFile: "CUSTOM", | ||
| it("load fixture config with validate for zod - toThrow", async () => { |
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.
We have many new tests. As this feature is based on standard schema, validating against one of them is enough to make maintenance easier
package.json
Outdated
| "test:types": "tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "@standard-schema/spec": "^1.0.0", |
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.
We can copy-paste types (as they suggest) to avoid extra dependency
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.
OK, I fixed it 👍
| configFileRequired?: boolean; | ||
|
|
||
| schema?: S; | ||
| validate?: (schema: S, input: ResolvedConfig<T, MT>) => void; |
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.
Thinking how we could make it simpler. Like setting a schema could be enough (to also cover validate + schema transform)
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.
StandardSchema already has vendor and validate, so it looks like we can look at vendor and isolate the call to validate 👍
Give me more time 🙏
Signed-off-by: ysknsid25 <[email protected]>
define StandardSchema Signed-off-by: ysknsid25 <[email protected]>
define StandardSchema Signed-off-by: ysknsid25 <[email protected]>
define StandardSchema Signed-off-by: ysknsid25 <[email protected]>
attempts to resolve #228