kin-openapi icon indicating copy to clipboard operation
kin-openapi copied to clipboard

Bug: Default values still count as properties even if setting them is disabled.

Open orshlom opened this issue 3 years ago • 0 comments

https://github.com/getkin/kin-openapi/blob/ecb06bc5c05b010b9c1322486ff74f2178f7927c/openapi3/schema.go#L1774-L1816

In visitJSONObject, if value[propName] is nil, it is assigned with the default value regardless of the setting (line 1794).

This counts towards lenValue (line 1813) and can falsely pass validations like minProperties that way.

I will add a PR to fix this bug.

orshlom avatar Feb 13 '23 14:02 orshlom