axa-group / bauta.js

Bauta.js is an add-on for your Node.js applications such as Express.js or Fastify.
Other
42 stars 3 forks source link

swagger additionalProperties: add test coverage and document current behaviour #70

Open Xavier-Redondo opened 1 year ago

Xavier-Redondo commented 1 year ago

This issue has two parts:

Testing coverage

Add relevant tests to know how bauta behaves in relation to input request fields that are not in the swagger.

This is related to swagger additionalProperties field, which can be true or false, where this is used (top root object or a child object in an array.

The coverage in the tests should take into account this and at least should have coverage for default values (nothing at swagger level) and when that field is set.

At this point we think that this behaviour is common in bautajs-core, but this could be not true, check bautajs-fastify and bautajs-express to be sure.

Documentation

Add a section at the end of validation.md called additionalProperties and extra input fields not in the swagger where the behaviour is explained according to the different values in the swagger of additionalProperties.

Note: in this task the current behaviour of bauta should not be modified. Instead, if a change/improvement has to be done open an issue for version 3.x.