exegesis-js / exegesis

Tools for implementing server-side OpenAPI 3.0.0
MIT License
139 stars 36 forks source link

feat: Add lazyCompileValidationSchemas option #497

Closed psznm closed 3 months ago

psznm commented 3 months ago

Added lazyCompileValidationSchemas option which enables to compile validation schemas when actually needing them. This may speed up application startup dramatically depending on the API size.

I implemented this by wrapping the validate function in a getter. I could not just replace the validate function because ajv does some weird stuff with having properties on a function. I am not confident replacing that with anything, so wrapping it in getter seemed like only reasonable option.

The option is disabled by default, as to not change behavior for existing users, so that it can be released as minor or even patch version.

jwalton commented 3 months ago

Thanks for this!

github-actions[bot] commented 3 months ago

:tada: This PR is included in version 4.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: