Download the PHP package nayzo/json-schema-validator-bundle without Composer
On this page you can find all versions of the php package nayzo/json-schema-validator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package json-schema-validator-bundle
JsonSchemaValidatorBundle
The JsonSchemaValidatorBundle is a Symfony bundle that validate request payload and response with Json Schema for PSR7 & PSR17.
This Bundle is compatible with Symfony >= 5.0
Installation
Install the bundle:
Usage
Configuration:
Define the Validation Support (mandatory):
Note that if no validation support is found (exp: MyAccountValidationSupport), no request/response validation subscriber will be triggered or executed.
Use default the request/response validation subscribers:
The JsonSchemaValidatorBundle defines two default validation subscribers: one for requests and another for responses.
These subscribers are responsible for validating request and response schemas.
To activate them, you must enable the corresponding flags: enable_default_request_validation_subscriber and enable_default_response_validation_subscriber, by setting their values to true.
If you prefer to use your own custom validation subscriber instead of the default ones provided by the bundle, you must disable the default subscribers by setting the enable_default_request_validation_subscriber flag to false, and then define the custom validation subscriber you wish to use.
Below is an example of usage without the default request/response validation subscribers.
Contract Service Dependency Injection:
Exceptions
By default, the value of the enable_default_validation_exception_subscriber flag is set to false. If activated (set to true), the default validation exception subscriber will be triggered and executed.
To use your own custom validation exception subscriber, you must disable the enable_default_validation_exception_subscriber flag by setting its value to false and implement a subscriber that listens to kernel.exception events.
Be aware that when an exception is thrown Before the validation of the request or response implemented by the JsonSchemaValidatorBundle (for example, an access denied), it will be directly intercepted by the application's or framework's kernel.exception and will not be captured by the bundle's validation workflow.
OpenAPI
Official OpenAPI documentation here:
OpenAPI Specification (official): ➡️ https://spec.openapis.org/oas/v3.0.1.html
OpenAPI Guide (Swagger): ➡️ https://swagger.io/specification
Example of openapi implementation:
All versions of json-schema-validator-bundle with dependencies
ext-json Version *
ext-mbstring Version *
league/openapi-psr7-validator Version ^0.22
nyholm/psr7 Version ^1.0
symfony/event-dispatcher Version ^5.4 || ^6.0 || ^7.0 || ^8.0
symfony/framework-bundle Version ^5.4 || ^6.0 || ^7.0 || ^8.0
symfony/psr-http-message-bridge Version ^2.0 || ^7.0 || ^8.0
symfony/string Version ^5.4 || ^6.0 || ^7.0 || ^8.0