Closed gbuisson closed 6 years ago
https://github.com/threatgrid/flanders/blob/master/src/flanders/utils.cljc#L73
An interesting side effect of optionalize-all is that it makes schemas like:
optionalize-all
(schema.core/defschema foo {(s/optional-key schema.core/Keyword) schema.core/Str})
this fails to validate any data, any keyword is then forbidden:
ctia.main=> (schema.core/defschema foo {(schema.core/optional-key schema.core/Keyword) schema.core/Str}) #'ctia.main/foo ctia.main=> (schema.core/validate foo {:boom "bar"}) ExceptionInfo Value does not match schema: {:boom disallowed-key} schema.core/validator/fn--2177 (core.clj:155)
No QA required.
https://github.com/threatgrid/flanders/blob/master/src/flanders/utils.cljc#L73
An interesting side effect of
optionalize-all
is that it makes schemas like:this fails to validate any data, any keyword is then forbidden: