for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace JsonSchema\Schema;
use JsonSchema\Keyword\FormatKeyword;
use JsonSchema\Keyword\MaxLengthKeyword;
use JsonSchema\Keyword\MinLengthKeyword;
use JsonSchema\Keyword\PatternKeyword;
use JsonSchema\Keyword\TypeKeyword;
class StringSchema extends AbstractSchema
{
public function __construct()
parent::__construct(
new TypeKeyword('string')
);
}
/**
* @return static
*/
public function nullable(bool $nullable = true): self
if (!$nullable) {
return $this->with(
new TypeKeyword(['string', 'null'])
public function minLength(?int $minLength): self
new MinLengthKeyword($minLength)
public function maxLength(?int $maxLength): self
new MaxLengthKeyword($maxLength)
public function pattern(?string $pattern): self
new PatternKeyword($pattern)
public function format(?string $format): self
new FormatKeyword($format)