Closed floratmin closed 4 months ago
I solved this issue for me with the current fastify version by using a function with the name formatsPlugin
. But it seems hacky to me. As an user I would expect that my preferences are not overwritten. On the other side a user who did not realize that their own formats are not used could get a broken system whit this change.
As an user I would expect that my preferences are not overwritten. On the other side a user who did not realize that their own formats are not used could get a broken system whit this change.
How do you implement the proposed behaviour in pure AJV starting from this use case?
const ajv = new AJV({ formats: { date: /foo/ } })
addFormats(ajv)
I see these options:
addFormats
properlyformats
options and write ajv.addFormat()
methodFor this example, I think the best approach to this issue is not to force the if()do
logic here, but we can do a step forward and:
ajv.addFormat
by themself (MISSING)My rationale here is that a callback is generic and easy to use compared to check all the conflict that we can face in the ajv's plugins and its configuration.
Thank you very much for your support. But I think that I do not want to implement any design decisions. I can live with my solution.
Checklist
npm run test
Issue: Custom format for ajv gets overwritten by ajv-formats