Closed SleepWalker closed 3 years ago
I personally do not think it is a good idea to implement the shortcut, because it create a bunch of problem when other plugins need to make use of the input schema. e.g. fastify-swagger
.
But, free feel to send an PR for the feature you want. Remember to add an unit test.
This shortcut is officially documented way to declare schemas so I think any plugin should actually support this format
Would you like to send a Pull Request to address this issue? Remember to add unit tests.
🚀 Feature Proposal
It is possible to drop wrapping object with
type
/properties
keys and pass aproperties
directly (see 201 response schema):https://www.fastify.io/docs/latest/Validation-and-Serialization/#serialization
Unfortunately
fastify-response-validation
won't pickup such syntax.onRoute
is called beforefastify
will normalize schema definition thereforebuildHook
will be called with unexpected data: https://github.com/fastify/fastify-response-validation/blob/master/index.js#L22-L23Example