skooma icon indicating copy to clipboard operation
skooma copied to clipboard

Perhaps add the option to prevent additional fields?

Open monkybrain opened this issue 7 years ago • 0 comments

I've recently started using Skooma and love the clean syntax but I miss the option to prevent additional fields that you can find in other data validation libraries (e.g. json-schema). I've solved this by adding the extra step of asserting that Map.keys(data) == Map.keys(schema) but thought maybe this could be added as an option, e.g.

Skooma.valid? data, schema, additional_fields: false

Essentially adding Skooma.valid?/3 with this and potentially other options as the third argument.

If you like, I can also submit a PR with this feature.

monkybrain avatar Sep 20 '18 18:09 monkybrain