I'm working on a web app and use Ajv to validate my api responses.
For both adding the schema and compiling it to a validation function, the Ajv guide describes doing it at startup or on demand (when making the api calls). The tradoff here is faster startup with slower api calls or faster api calls with slower startup.
Since my schema's only change when updating the api, it makes sense to me to both add and compile the schema to a validation function in the build process insead of at runtime. The guide also states the validation function can be used independently from an Ajv instance.
So my question is, is it possible to save (write to file) the validation function?