krakenjs / hapi-openapi

Build design-driven apis with OpenAPI (formerly swagger) 2.0 and hapi.
Other
211 stars 75 forks source link

fix(validation): respect `allowUnknown` route property #169

Closed sommestad closed 4 years ago

sommestad commented 4 years ago

This ensures it is possible to allow unknown properties in request bodies (Postel’s Law), by respecting the x-hapi-options option.


Discussion

In general, one could consider making allowUnknown: true the default behavior, but I guess that would be considered a breaking change.

Some notes from the thought processes around this change:

If there's a better way to solve this, I'm all ears, but this was fairly straightforward and did solve the issue.

tlivings commented 4 years ago

Build seems to be failing.

sommestad commented 4 years ago

@tlivings Sorry, had accidentally removed options.validate = v.validate;. Builds successfully now.

sommestad commented 4 years ago

Ping @tlivings... 🙏