Validating package payload
The API is not tied to a specific application tier nor programming model.It is specifically not tied to either web or persistence tier, and is available for both server-side application programming, as well as rich client Swing application developers.Validating user input is crucial to your application and you should never trust the incoming request data.Please make sure you’re validating the provided user data before sending it to your database. Within the related tutorials, you can see the usage of validation on each individual type: query parameters, path parameters, request payload and request headers.In this case we are passing blank value to mandatory fields.Even though blank flag is set as false but it will check for it because it is mandatory field.Its called “payload-validator” and it does the validation of your JSON structure for API’s.
Your production API key is also available on the Developer Settings page. By default this array should be empty , so it's optional.Payload is an interface, we can provide an implementation of this interface as an element for 'payload' to provide some additional metadata information in a typed-safe way (as compare to some string literal) or we can even invoke some dynamic code with it. This example idea is taken from the spec documents This example shows how payload can be used to invoke some dynamic code using reflection.Please find more information in the linked joi documentation.This tutorial walked you through the setup of multiple types of validation to an individual route.
Search for validating package payload:
JSON API validation in nodejs is quite a over head work because we expect different kind of payload and data in API’s.