-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Update default ajv instance to include all errors #1398
Conversation
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.
LGTM, I’m in favor of this change.
(only for v2) |
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.
Out of curiosity, can you also post a benchmark?
I don't trust myself or my environment with benchmarks so would be great if someone double check this. 😄 There seems to be no change but it also depends on the size and complexity of the schema I guess. Using sample 'use strict'
const fastify = require('../fastify')()
const schema = {
body: {
type: 'object',
properties: {
name: { type: 'string' },
work: { type: 'string' }
},
required: ['name', 'work']
}
}
fastify.post('/', { schema }, function (req, reply) {
reply.send({ hello: 'world' })
})
fastify.listen(3000) Before
After
|
You should test a case where you have multiple schema failures :) |
@delvedor I was not kidding when I said you shouldn't trust me 😄 Updated the previous comment |
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 is a good idea 👍
I would prefer to run benchmakrs myself before landing |
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.
LGTM this is not regressing anything
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Closes #1397
Set
allErrors: true
in default AJV instance to catch all errorsChecklist
npm run test
npm run benchmark