[x] I have run npm test locally and all tests are passing.
[x] I have added/updated tests for any new behavior.
[x] I have added/updated documentation for any new behavior.
Context
This is a PR whose goal is to fix issues #134 and #135. While this issues were open we were not sure if they were bugs or not.
After a bit of investigation there is no bug related to them but we have detected that documentation is sparse on this topic (Which is normal because it is a very edge case).
Thus we have added small changes that do not change the behaviour of bauta.js but we have added a bit of documentation whose goal is to reduce the timing invested in troubleshooting possible issues with schema request validations.
Summary
bautajs-core
Separate the default values used by AJV initialization to a specific constant. This is to make documentation a bit easier.
bautajs-fastify
Add a trace log when a request validation fails. This is done to indicate that this is the point where the request validation error comes from and to allow for better error detection when implementing.
bautajs-fastify-example
We have added an endpoint that illustrates how to proceed if you need to have a GET with query params as array using the default method (using multi and indicating the field name for each value).
~We have added an endpoint similar to the previous one but that uses a query param as array using csv (comma separated values).~ --> Removed to avoid using directly qs library as dependency in bauta.js project.
Documentation
We have added a small section in validation.md that details a bit more about request validation and request parsing.
We have added a guide to help troubleshooting issues with request schema validation.
PR Checklist
npm test
locally and all tests are passing.Context
This is a PR whose goal is to fix issues #134 and #135. While this issues were open we were not sure if they were bugs or not.
After a bit of investigation there is no bug related to them but we have detected that documentation is sparse on this topic (Which is normal because it is a very edge case).
Thus we have added small changes that do not change the behaviour of bauta.js but we have added a bit of documentation whose goal is to reduce the timing invested in troubleshooting possible issues with schema request validations.
Summary
bautajs-core
bautajs-fastify
bautajs-fastify-example
We have added an endpoint that illustrates how to proceed if you need to have a GET with query params as array using the default method (using multi and indicating the field name for each value).
~We have added an endpoint similar to the previous one but that uses a query param as array using csv (comma separated values).~ --> Removed to avoid using directly
qs
library as dependency in bauta.js project.Documentation
validation.md
that details a bit more about request validation and request parsing.