-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: better YAML parsing error reporting #5750
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
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
✅ Deploy Preview for continuedev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
core/data/log.ts
Outdated
@@ -146,7 +146,7 @@ export class DataLogger { | |||
event.data, | |||
event.name, | |||
schema, | |||
zodSchema, | |||
zodSchema as unknown as AnyZodObject, |
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.
With zod 3.24.4, required by zod-validation-error, compilation fails with:
Argument of type 'ZodObject<Pick<{ eventName: ZodString; schema: ZodString; userId: ZodString; userAgent: ZodString; selectedProfileId: ZodString; } & { ...; }, "timestamp" | ... 29 more ... | "disableInFiles">, "strip", ZodTypeAny, { ...; }, { ...; }> | ... 7 more ... | ZodObject<...>' is not assignable to parameter of type 'AnyZodObject'.
Type 'ZodObject<Pick<{ eventName: ZodString; schema: ZodString; userId: ZodString; userAgent: ZodString; selectedProfileId: ZodString; } & { ...; }, "timestamp" | ... 29 more ... | "disableInFiles">, "strip", ZodTypeAny, { ...; }, { ...; }>' is not assignable to type 'ZodObject<any, any, any, { [x: string]: any; }, { [x: string]: any; }>'.
Types have separate declarations of a private property '_cached'.
If someone can come up with a better solution than this fugly hack, I'll be glad to apply it.
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.
@fbricon Wondering if this is because zod isn't updated in core?
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.
@RomneyDa you're exactly right, nice catch. I set "zod":"^3.25.13"
consistently and could remove
that hack.
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.
looks good, appreciate the tests. See comment!
b6835fb
to
7f60f16
Compare
@fbricon it seems like this is actually failing tests, something with the updated package locks maybe? |
Signed-off-by: Fred Bricon <fbricon@gmail.com>
Description
When config.yaml doesn't conform to the expected schema, the reported error is somewhat cryptic. This PR adds zod-validation-error to render more user-friendly error messages (until prettifyError() becomes available in the next zod 4.0)
Checklist
Screenshots
Before:

After:

Tests
Summary by cubic
Improved YAML config error messages by using zod-validation-error, making validation issues easier to understand.