PHP classes to help create json schemas
composer require luca-rath/php-json-schema
use JsonSchema\Keyword\FormatKeyword;
use JsonSchema\Property\Property;
use JsonSchema\Schema\IntegerSchema;
use JsonSchema\Schema\ObjectSchema;
use JsonSchema\Schema\StringSchema;
ObjectSchema::create()
->title('Registration form')
->properties([
Property::create('email', true, StringSchema::create()
->format(FormatKeyword::FORMAT_EMAIL)
->examples(['admin@example.org'])),
Property::create('password', true, StringSchema::create()
->minLength(8)
->description('The password must be at least eight characters long')),
Property::create('age', false, IntegerSchema::create()
->nullable()
->minimum(18)),
]);