Json Schema transformer is done
Form builder stuck on infinite recurrsion
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace Lucent\Schema\Ui;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\JsonSchema\Property\PropertyType;
|
||||
use Lucent\JsonSchema\Property\TypeProperty;
|
||||
use Lucent\Schema\FieldInfo;
|
||||
use Lucent\Schema\FieldInterface;
|
||||
use Lucent\Schema\FieldType;
|
||||
use Lucent\Schema\Nullable;
|
||||
use Lucent\Schema\Validator\RequiredInterface;
|
||||
use PhpOption\Option;
|
||||
|
||||
class Block implements FieldInterface, RequiredInterface
|
||||
{
|
||||
@@ -43,4 +47,26 @@ class Block implements FieldInterface, RequiredInterface
|
||||
{
|
||||
return empty($value);
|
||||
}
|
||||
|
||||
public function isRequired(): bool
|
||||
{
|
||||
return $this->required;
|
||||
}
|
||||
|
||||
public function toJsonSchema(): Property
|
||||
{
|
||||
return new TypeProperty(
|
||||
type: PropertyType::STRING,
|
||||
id: $this->name,
|
||||
title: Option::fromValue($this->label),
|
||||
description: Option::fromValue($this->help, ""),
|
||||
default: Option::fromValue($this->default, ""),
|
||||
minLength: none(),
|
||||
maxLength: none(),
|
||||
readOnly: Option::fromValue($this->readonly, false),
|
||||
enum: none(),
|
||||
comment: Option::fromValue($this->group, ""),
|
||||
format: none(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user