Comments (7)
Switching the ajv version is as easy as writing:
const factoryValidator = require('@fastify/ajv-compiler')()
const app = fastify({
schemaController: {
compilersFactory: {
buildValidator: factoryValidator
}
}
})
Since changing the default would be a massive breaking change for the user (as it should rewrite all its schemas) - we could just ship a new @fastify/ajv-compiler
major with ajv/2020
and let those users that want the new standard set the buildValidator
option accordingly.
from fastify.
It's also important to note that, and this is what changed my mind on this, the AJV docs recommend sticking with 07 if we don't need the two new properties as all schemas will be affected by the reduced performance required to support them
fastify/ajv-compiler#105 (comment)
https://ajv.js.org/guide/schema-language.html#draft-2019-09-and-draft-2020-12
So it seems logical for me to keep the default 7 and let the user configure the setting
from fastify.
Draft 7 and Draft 2020-12 is great different.
It also provides a large set of incompatibility.
from fastify.
@climba03003 Do you mean that existing Draft 7 schemas will stop working under Draft 2020?
from fastify.
Do you mean that existing Draft 7 schemas will stop working under Draft 2020?
Mostly, yes. If it can works, I don't see a reason why, ajv
would split into different version.
https://json-schema.org/draft/2019-09/release-notes
https://json-schema.org/draft/2020-12/release-notes
from fastify.
Draft-2020 is also marked as non-backwards compatible
by ajv
: https://ajv.js.org/json-schema.html#draft-2020-12
It would be nice but a lot of schemas uses mostly the 2019-draft, and doing this make them prone to break and cause friction with the adoption of Fastify v5.
Might be better to allow them do it if they want or still use 2019's draft
from fastify.
I think we would need fast-json-stringify to support it first.
from fastify.
Related Issues (20)
- `disableRequestLogging` should disable logs in default error handler HOT 6
- incorrect plugin identified for timeout HOT 1
- Backport webdav methods from next to current branch HOT 7
- OPTIONS HTTP method body processing HOT 3
- Dependency update for v5 HOT 1
- Merge main into next HOT 4
- Scoped FastifyRequest Customization via Generic Parameter in FastifyInstance HOT 1
- Flaky test on N|Solid 20 MacOS HOT 2
- Implement simple B-Tree for faster string comparisons HOT 6
- Throwing error in setErrorHandler after a JSON parse SyntaxError causes app to crash
- Where is the documentation for <Reply>.sendFile? HOT 2
- Fastify v5 coordination HOT 6
- Does Validation-and-Serialization document's outdated?
- Should we drop Node.js v18 for v5? HOT 11
- `disableErrorLogging` option HOT 1
- Request hangs if you `await reply.status` in an async handler. HOT 15
- querystring with property of type number fails HOT 7
- onError hook is called before errorHandler when error is thrown in onRequest hook HOT 6
- Approval Request for Future State Proposal HOT 17
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastify.