json-schema icon indicating copy to clipboard operation
json-schema copied to clipboard

coerce

Open dvv opened this issue 14 years ago • 2 comments

Hi!

Wouldn't it be better to apply coercion (if defined in the schema and available in exports) only if the value hadn't passed type test, and not unconditionally?

Best regards, --Vladimir

dvv avatar Jan 08 '11 09:01 dvv

This is fixed in your pull, right?

kriszyp avatar Jan 14 '11 19:01 kriszyp

Not really. I didn't get how to achieve that. In pull I added support to validate objects in arrays, plus changed validate() signature to support options hash (since a bunch of options are added).

I introduced existingOnly option which control whether only existing in instance properties will be validating (very useful for validating partial updates), and filter option which controls whether non-specified in the schema properties should add errors when additionalProperties is false (this is useful to validate only a subset of instance properties)

dvv avatar Jan 14 '11 19:01 dvv