API Platform provides an infrastructure to generate JSON Schemas for any resource, represented in any format (including JSON-LD). The generated schema can be used with libraries such as react-json-schema-form to build forms for the documented resources, or to be used for validation.
To export the schema corresponding to an API Resource, run the following command:
$ docker-compose exec php bin/console api:json-schema:generate 'App\Entity\Book'
To see all options available, try:
$ docker-compose exec php bin/console help api:json-schema:generate
To generate JSON Schemas programmatically, use the
API Platform provides a PHPUnit assertion to test if a response is valid according to a given Schema:
Refer to the testing documentation for more details.