Skip to content
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

Ajv configuration #343

Closed
djbeckett opened this issue Feb 5, 2019 · 6 comments
Closed

Ajv configuration #343

djbeckett opened this issue Feb 5, 2019 · 6 comments

Comments

@djbeckett
Copy link

The Validation feature uses Ajv and Foal uses a baseline configuration that includes:

removeAdditional: true

For my purposes, I need this to be false. Other than monkey patching* Foal to change this setting (which I've done and it does now do what I need it to), how can I set this Ajv config value?

* monkey patched here: @foal/core/lib/common/utils/get-ajv-instance.js

By the way, I've spend the last few weeks looking into every Express framework and boilerplate I can find and FoalTS is BY FAR the best of them all. Better in every way: features, clarity of docs, accuracy of docs, responsive support, ongoing development, not bloated, clearly understands the needs of api developers, etc. We're doing a proof-of-concept now with Foal for an open api, which is why I'm focusing on the details of data validation. Thank you so much for this excellent framework!

dan

@LoicPoullain LoicPoullain added this to Backlog in Issue tracking via automation Feb 6, 2019
@LoicPoullain
Copy link
Member

By the way, I've spend the last few weeks looking into every Express framework and boilerplate I can find and FoalTS is BY FAR the best of them all. Better in every way: features, clarity of docs, accuracy of docs, responsive support, ongoing development, not bloated, clearly understands the needs of api developers, etc. We're doing a proof-of-concept now with Foal for an open api, which is why I'm focusing on the details of data validation. Thank you so much for this excellent framework!

Thank so much for this feedback @djbeckett! I really appreciate.

Regarding the AJV configuration, there's currently no way to change the setting without this monkey patch (expect if you implement your own hook).

But adding this fix shouldn't complicated. I'll publish a new version this week to incorporate this feature. You'll be able to change the three baseline configuration properties in config/ajv.json or through env variables.

ajv.json (all properties are optional)

{
  "coerceTypes": true,
  "removeAdditional": true,
  "useDefaults": true
}

Does it sound good?

@LoicPoullain LoicPoullain moved this from Backlog to February 2019 in Issue tracking Feb 6, 2019
@djbeckett
Copy link
Author

That sounds perfect! Thank you, thank you.

@LoicPoullain
Copy link
Member

Feature added in v0.7.7.

Issue tracking automation moved this from February 2019 to Done Feb 7, 2019
@LoicPoullain
Copy link
Member

@djbeckett I released v0.7.7 👍

@djbeckett
Copy link
Author

Awesome! That was really fast. Thank you for these great improvements.

Also did you get my note sent to your email at centraliens.net?

@LoicPoullain
Copy link
Member

Yes, I just answered. Thank you so much for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Issue tracking
  
Done / Closed This Release
Development

No branches or pull requests

2 participants