From 44fb6f815d733820817ad011054fa3904bb96cc4 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Wed, 9 Jun 2021 17:10:19 -0400 Subject: [PATCH] Correct response models --- .../Utopia/Response/Model/Attribute.php | 12 +++++++++++- src/Appwrite/Utopia/Response/Model/Index.php | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Utopia/Response/Model/Attribute.php b/src/Appwrite/Utopia/Response/Model/Attribute.php index 523dc7acb2..fc48d7c1ee 100644 --- a/src/Appwrite/Utopia/Response/Model/Attribute.php +++ b/src/Appwrite/Utopia/Response/Model/Attribute.php @@ -10,6 +10,12 @@ class Attribute extends Model public function __construct() { $this + ->addRule('$collection', [ + 'type' => self::TYPE_STRING, + 'description' => 'Collection ID.', + 'default' => '', + 'example' => '', + ]) ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Attribute ID.', @@ -39,18 +45,22 @@ class Attribute extends Model 'description' => 'Is attribute signed?', 'default' => true, 'example' => true, + 'required' => false, ]) ->addRule('array', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Is attribute an array?', 'default' => false, 'example' => false, + 'required' => false ]) ->addRule('filters', [ - 'type' => self::TYPE_JSON, + 'type' => self::TYPE_STRING, 'description' => 'Attribute filters.', 'default' => [], 'example' => [], + 'array' => true, + 'required' => false, ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/Index.php b/src/Appwrite/Utopia/Response/Model/Index.php index a3212fd8e4..f67637a26b 100644 --- a/src/Appwrite/Utopia/Response/Model/Index.php +++ b/src/Appwrite/Utopia/Response/Model/Index.php @@ -10,6 +10,12 @@ class Index extends Model public function __construct() { $this + ->addRule('$collection', [ + 'type' => self::TYPE_STRING, + 'description' => 'Collection ID.', + 'default' => '', + 'example' => '', + ]) ->addRule('$id', [ 'type' => self::TYPE_STRING, 'description' => 'Index ID.', @@ -23,22 +29,27 @@ class Index extends Model 'example' => '', ]) ->addRule('attributes', [ - 'type' => self::TYPE_JSON, + 'type' => self::TYPE_STRING, 'description' => 'Index attributes.', 'default' => [], 'example' => [], + 'array' => true, ]) ->addRule('lengths', [ - 'type' => self::TYPE_JSON, + 'type' => self::TYPE_STRING, 'description' => 'Index lengths.', 'default' => [], 'example' => [], + 'array' => true, + 'required' => false, ]) ->addRule('orders', [ - 'type' => self::TYPE_JSON, + 'type' => self::TYPE_STRING, 'description' => 'Index orders.', 'default' => [], 'example' => [], + 'array' => true, + 'required' => false, ]) ; }