Fix response models
This commit is contained in:
parent
fb80088286
commit
783e9d86c0
|
@ -8,7 +8,7 @@ abstract class Model
|
||||||
{
|
{
|
||||||
const TYPE_STRING = 'string';
|
const TYPE_STRING = 'string';
|
||||||
const TYPE_INTEGER = 'integer';
|
const TYPE_INTEGER = 'integer';
|
||||||
const TYPE_FLOAT = 'float';
|
const TYPE_FLOAT = 'double';
|
||||||
const TYPE_BOOLEAN = 'boolean';
|
const TYPE_BOOLEAN = 'boolean';
|
||||||
const TYPE_JSON = 'json';
|
const TYPE_JSON = 'json';
|
||||||
|
|
||||||
|
|
|
@ -13,18 +13,18 @@ class AttributeFloat extends Attribute
|
||||||
|
|
||||||
$this
|
$this
|
||||||
->addRule('min', [
|
->addRule('min', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_FLOAT,
|
||||||
'description' => 'Minimum value to enforce for new documents.',
|
'description' => 'Minimum value to enforce for new documents.',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 1,
|
'example' => 1.5,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'require' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
->addRule('max', [
|
->addRule('max', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_FLOAT,
|
||||||
'description' => 'Maximum value to enforce for new documents.',
|
'description' => 'Maximum value to enforce for new documents.',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 10,
|
'example' => 10.5,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'require' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
|
|
|
@ -25,7 +25,7 @@ class AttributeList extends Model
|
||||||
'getNestedType' => function(Document $attribute) {
|
'getNestedType' => function(Document $attribute) {
|
||||||
return match($attribute->getAttribute('type')) {
|
return match($attribute->getAttribute('type')) {
|
||||||
self::TYPE_BOOLEAN => Response::MODEL_ATTRIBUTE_BOOLEAN,
|
self::TYPE_BOOLEAN => Response::MODEL_ATTRIBUTE_BOOLEAN,
|
||||||
self::TYPE_INTEGER=> Response::MODEL_ATTRIBUTE_INTEGER,
|
self::TYPE_INTEGER => Response::MODEL_ATTRIBUTE_INTEGER,
|
||||||
self::TYPE_FLOAT => Response::MODEL_ATTRIBUTE_FLOAT,
|
self::TYPE_FLOAT => Response::MODEL_ATTRIBUTE_FLOAT,
|
||||||
self::TYPE_STRING => match($attribute->getAttribute('format')) {
|
self::TYPE_STRING => match($attribute->getAttribute('format')) {
|
||||||
APP_DATABASE_ATTRIBUTE_EMAIL => Response::MODEL_ATTRIBUTE_EMAIL,
|
APP_DATABASE_ATTRIBUTE_EMAIL => Response::MODEL_ATTRIBUTE_EMAIL,
|
||||||
|
|
Loading…
Reference in a new issue