jhthorsen / mojolicious-plugin-openapi

OpenAPI / Swagger plugin for Mojolicious
54 stars 44 forks source link

"additionalProperties": false is ignored #210

Closed abraxxa closed 3 years ago

abraxxa commented 3 years ago

When an object specifies "additionalProperties": false the request is still considered valid even if there are additional properties passed.

jhthorsen commented 3 years ago

Can you please provide a failing test? Or at least details about your setup?

I do find it hard to believe, since this functionality is tested: https://github.com/jhthorsen/json-validator/blob/49de68974b18f89091624b3a169898f60b8fe74a/t/jv-object.t#L29

Either way, I’m going to close this issue since if it is a bug, it’s related to JSON::Validator

abraxxa commented 3 years ago

My OpenAPI definition has a schema called 'Role' which is referenced from an array property called 'roles' in schema 'User' which in turn is referenced by a POST API endpoint in the requestBody. I've added "additionalProperties": false to the 'Role' schema and sent a POST request where the roles array contained an object with an additional property.