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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose schema in request
object
#4149
Comments
Since yesterday you can: https://www.fastify.io/docs/latest/Reference/Request/#getvalidationfunction |
It is not the same request. The request here is retrieve the |
The schema is part of the route context: Line 21 in 95f9fa5
|
Yes, it is. However, the document stated that We need to deprecate the |
Not so sure if deprecate it will be the best approach, but at least expose some public API where the users can take use to understand the route settings |
If deprecation or removal is not possible.
In this case, user is safe to use |
Allowing unvetted access to context enables quite a few plugins (even in our orgs). This was an escape-hatch to enable quick evolution of the framework for with flexibility. I think we can design a new API to a address those cases. I would probably consider it semver-major and be done with it. |
Meanwhile, the user can write:
|
To recap, the agreed solution will be:
I think we can safely land the new API as a minor by exposing it but not hiding the And leverage the context behind a Please let me know if my assumptions are correct, otherwise, let me know if I'm missing something 馃檪 |
Based on past experiences, I'd restrain in landing this change in a minor. This can have unpredictable consequences and unexpected performance drops. There is no hurry to implement this so we can safely do it for the next major. The PR can land in a next branch. |
Perfect, sounds good. Then everything remains the same but with the exception of aiming for next |
Is there a new |
There is a |
Prerequisites
馃殌 Feature Proposal
It would be great if we can access the schema from the request object so that a content parser can use it to correctly populate the request body instead of relying on hacks like you see in line 58 here.
Motivation
Need for having access to request schema for content parsing.
Example
https://github.com/FlameWolf/formzilla/blob/master/index.js
The text was updated successfully, but these errors were encountered: