Update attribute response models
This commit is contained in:
parent
4c79462313
commit
10e4297652
|
@ -35,7 +35,7 @@ abstract class Model
|
||||||
/**
|
/**
|
||||||
* Filter Document Structure
|
* Filter Document Structure
|
||||||
*
|
*
|
||||||
* @return string
|
* @return Document
|
||||||
*/
|
*/
|
||||||
public function filter(Document $document): Document
|
public function filter(Document $document): Document
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Attribute extends Model
|
||||||
'description' => 'Is attribute an array?',
|
'description' => 'Is attribute an array?',
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'example' => false,
|
'example' => false,
|
||||||
'required' => false
|
'require' => false
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class AttributeBoolean extends Model
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => false,
|
'example' => false,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@ class AttributeEmail extends AttributeString
|
||||||
->addRule('format', [
|
->addRule('format', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'String format.',
|
'description' => 'String format.',
|
||||||
'default' => 'email',
|
'default' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_EMAIL]),
|
||||||
'example' => 'email',
|
'example' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_EMAIL]),
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => true,
|
'require' => true,
|
||||||
])
|
])
|
||||||
->addRule('default', [
|
->addRule('default', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
|
@ -24,7 +24,7 @@ class AttributeEmail extends AttributeString
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 'default@example.com',
|
'example' => 'default@example.com',
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,17 @@ class AttributeFloat extends Attribute
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addRule('min', [
|
->addRule('format', [
|
||||||
'type' => self::TYPE_FLOAT,
|
'type' => self::TYPE_FLOAT,
|
||||||
'description' => 'Minimum value to enforce on new documents.',
|
'description' => 'Float format.',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 0.5,
|
'example' => \json_encode([
|
||||||
|
'name' => APP_DATABASE_ATTRIBUTE_FLOAT_RANGE,
|
||||||
|
'min' => 1.5,
|
||||||
|
'max' => 2.5,
|
||||||
|
]),
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
|
||||||
->addRule('max', [
|
|
||||||
'type' => self::TYPE_FLOAT,
|
|
||||||
'description' => 'Minimum value to enforce on new documents.',
|
|
||||||
'default' => null,
|
|
||||||
'example' => 2.5,
|
|
||||||
'array' => false,
|
|
||||||
'required' => false,
|
|
||||||
])
|
])
|
||||||
->addRule('default', [
|
->addRule('default', [
|
||||||
'type' => self::TYPE_FLOAT,
|
'type' => self::TYPE_FLOAT,
|
||||||
|
@ -32,7 +28,7 @@ class AttributeFloat extends Attribute
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 2.5,
|
'example' => 2.5,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@ class AttributeIP extends AttributeString
|
||||||
->addRule('format', [
|
->addRule('format', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'String format.',
|
'description' => 'String format.',
|
||||||
'default' => 'ip',
|
'default' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_IP]),
|
||||||
'example' => 'ip',
|
'example' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_IP]),
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => true,
|
'require' => true,
|
||||||
])
|
])
|
||||||
->addRule('default', [
|
->addRule('default', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
|
@ -24,7 +24,7 @@ class AttributeIP extends AttributeString
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => '192.0.2.0',
|
'example' => '192.0.2.0',
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,17 @@ class AttributeInteger extends Attribute
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->addRule('min', [
|
->addRule('format', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'Minimum value to enforce on new documents.',
|
'description' => 'Integer format.',
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 0,
|
'example' => \json_encode([
|
||||||
|
'name' => APP_DATABASE_ATTRIBUTE_INT_RANGE,
|
||||||
|
'min' => 0,
|
||||||
|
'max' => 10,
|
||||||
|
]),
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
|
||||||
->addRule('max', [
|
|
||||||
'type' => self::TYPE_INTEGER,
|
|
||||||
'description' => 'Minimum value to enforce on new documents.',
|
|
||||||
'default' => null,
|
|
||||||
'example' => 10,
|
|
||||||
'array' => false,
|
|
||||||
'required' => false,
|
|
||||||
])
|
])
|
||||||
->addRule('default', [
|
->addRule('default', [
|
||||||
'type' => self::TYPE_INTEGER,
|
'type' => self::TYPE_INTEGER,
|
||||||
|
@ -32,7 +28,7 @@ class AttributeInteger extends Attribute
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 10,
|
'example' => 10,
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ class AttributeString extends Attribute
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 'default',
|
'example' => 'default',
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ class AttributeURL extends AttributeString
|
||||||
->addRule('format', [
|
->addRule('format', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_STRING,
|
||||||
'description' => 'String format.',
|
'description' => 'String format.',
|
||||||
'default' => 'url',
|
'default' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_URL]),
|
||||||
'example' => 'url',
|
'example' => \json_encode(['name'=>APP_DATABASE_ATTRIBUTE_URL]),
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => true,
|
'required' => true,
|
||||||
])
|
])
|
||||||
|
@ -24,7 +24,7 @@ class AttributeURL extends AttributeString
|
||||||
'default' => null,
|
'default' => null,
|
||||||
'example' => 'http://example.com',
|
'example' => 'http://example.com',
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'required' => false,
|
'require' => false,
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue