feat: better YAML parsing error reporting#5750
feat: better YAML parsing error reporting#5750fbricon wants to merge 1 commit intocontinuedev:mainfrom
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
| event.name, | ||
| schema, | ||
| zodSchema, | ||
| zodSchema as unknown as AnyZodObject, |
There was a problem hiding this comment.
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.
@fbricon Wondering if this is because zod isn't updated in core?
There was a problem hiding this comment.
@RomneyDa you're exactly right, nice catch. I set "zod":"^3.25.13" consistently and could remove
that hack.
RomneyDa
left a comment
There was a problem hiding this comment.
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>
| @@ -0,0 +1,72 @@ | |||
| import { configYamlSchema } from "../schemas/index.js"; | |||
There was a problem hiding this comment.
The import path uses '.js' extension but the actual file has '.ts' extension. This will cause module resolution issues at runtime since the file being imported is 'index.ts' not 'index.js'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
| @@ -0,0 +1,72 @@ | |||
| import { configYamlSchema } from "../schemas/index.js"; | |||
| import { parseConfigYaml } from "./unroll.js"; | |||
There was a problem hiding this comment.
The import path uses '.js' extension but the actual file has '.ts' extension. This will cause module resolution issues at runtime since the file being imported is 'unroll.ts' not 'unroll.js'.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
|
😱 Found 2 issues. Time to roll up your sleeves! 😱 |
|
@fbricon another contributor took a different approach to this and was pushed through, now conflicts. Looks like CLA still failing too? WIll close this for now, let me know if error messages on new prerelease are still looking bad to you! |
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.