-
Notifications
You must be signed in to change notification settings - Fork 38
fix(fastify): fix issue with mercurius #53
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
|
@kibertoad ? the repo is dead ? |
|
sorry for the delay, will review today |
src/index.ts
Outdated
| }; | ||
| } | ||
|
|
||
| return ajv.compile(schema); |
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.
I don't think this is correct. You are basically assuming that sometimes you are going to get an ajv schema, and hardcode falling back to using it if there are no zod-specific methods found. This is brittle, and too much hardcoding.
I don't mind a more universal approach that would allow users to pass their own fallback compilers for when zod one is not found, but it shouldn't be hardcoded
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.
Agree with you, but I will keep the default if no fallback is precised. Because by default ajv is used on fastify.
src/index.ts
Outdated
| import type { z, ZodAny, ZodTypeAny } from 'zod'; | ||
| import type { z, ZodAny, ZodError, ZodTypeAny } from 'zod'; | ||
| import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
| import { fromZodError } from 'zod-validation-error'; |
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.
this change might be useful, but it seems to be unrelated to the issue with mercurius. Can you create a separate PR for that?
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.
After this PR, I will do it
|
@kibertoad ready for me |
|
@kibertoad any update ? |
2 similar comments
|
@kibertoad any update ? |
|
@kibertoad any update ? |
|
@kibertoad updated ! |
|
@kibertoad any update ? |
1 similar comment
|
@kibertoad any update ? |
ref #52