Skip to content

Conversation

@ysknsid25
Copy link
Contributor

attempts to resolve #228

@pi0 pi0 changed the title feat(loader): implements validation by standard schema feat(loader): support validate with standard schema Mar 26, 2025
@ysknsid25 ysknsid25 requested a review from pi0 March 26, 2025 13:31
@pi0
Copy link
Member

pi0 commented Jul 30, 2025

@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 () => {
Copy link
Member

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",
Copy link
Member

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

Copy link
Contributor Author

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;
Copy link
Member

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)

Copy link
Contributor Author

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 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support validation

2 participants