-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
[Help] How to access the underlying instance of ajv #942
Labels
help wanted
Extra attention is needed
Comments
It is null when you don't have any schema - it creates only if necessary Thanks to these utilities: https://fastify.dev/docs/latest/Reference/Request/#validateinputdata-schema--httpstatus-httpstatus I wonder if you really need access it |
Ok, thank you.. I'll try that method but I'm probably going to decorate
fastify with a custom ajv instance at this point.
I need this in order to validate payload in some parts of the application
not strictly relative the HTTP handling (socket.io handlers, meta-schema
validation, and some other cases). In all this cases I cannot rely on the
"native" schema validation capabilities of fastify.
Il mer 4 ott 2023, 18:03 Manuel Spigolon ***@***.***> ha
scritto:
… It is null when you don't have any schema - it creates only if necessary
Thanks to these utilities:
https://fastify.dev/docs/latest/Reference/Request/#validateinputdata-schema--httpstatus-httpstatus
I wonder if you really need access it
—
Reply to this email directly, view it on GitHub
<#942 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP77QBSKJWSTD445C6LPYNDX5WCF5AVCNFSM6AAAAAA5SZE5J2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONBXGIYTANRQGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
1 task
@Eomm I've added a pull request for better documenting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
💬 Question here
How to access the underlying instance of ajv in a plugin or a route without having to call setValidatorCompiler()?
For many reason this issue is similar to the one I opened here some years ago: #374, but somehow I keep fighting with this question. I want to access to the underlying fastify ajv instance (supposingly through the
fastify.validatorCompiler
decorator) but, upgrading fastify from3.x
to4.x
, that decorator is always null. I've tried by waiting the server to be ready but the field is always falsey. Is there any way to access ajv without setting a custom validator?Your Environment
The text was updated successfully, but these errors were encountered: