Apigility field accepting an array of inline objects?

I would like to create an Apigility REST service that accepts a POST, for example, a custom object that has a field containing an array of address objects. I can define a field without validators and handle raw JSON in my code, but I wonder if there is a better way to do this when nested objects can also be checked by Apigility?

+8
json zend-framework2 apigility
source share
1 answer

Apigility has a module called content-validation - it allows you to configure input filters for your services, and data requests are transmitted through the input filter for verification, and the corresponding ApiProblem response is returned when the verification is not performed. (see https://apigility.org/documentation/api-primer/content-validation )

This still leaves you with the responsibility of setting up an input filter that will suit your needs.

I would like to check packagist.org for a JSON Schema authentication library that can accept JSON schema and JSON payload and verify that the payload is well formed according to the schema. Then you can easily implement a custom InputFilter and bind it at your service. This will give you confirmation that the main object and auxiliary objects are well formed (i.e.: username, email address, date of birth and address field contain objects, all of which have the address / street / zip / etc).

0
source share

All Articles