From 3281b8bbd4b96b5c3750b25b2fc6853785eb7963 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 3 Oct 2022 15:06:44 +0000 Subject: [PATCH 1/2] Add meaningful Phone number examples to specs --- src/Appwrite/Specification/Format/OpenAPI3.php | 5 +++++ src/Appwrite/Specification/Format/Swagger2.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 9aa25fcde7..fb7208c569 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -368,6 +368,11 @@ class OpenAPI3 extends Format $node['schema']['format'] = 'password'; $node['schema']['x-example'] = 'password'; break; + case 'Appwrite\Auth\Validator\Phone': + $node['schema']['type'] = $validator->getType(); + $node['schema']['format'] = 'phone'; + $node['schema']['x-example'] = '+12065550100'; // In the US, 555 is reserved like example.com + break; case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ $node['schema']['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index fc296b17a2..49a5a2757c 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -305,7 +305,7 @@ class Swagger2 extends Format case 'Appwrite\Network\Validator\Email': $node['type'] = $validator->getType(); $node['format'] = 'email'; - $node['x-example'] = 'email@example.com'; + $node['x-example'] = 'email@examples.com'; break; case 'Appwrite\Network\Validator\URL': $node['type'] = $validator->getType(); @@ -365,6 +365,11 @@ class Swagger2 extends Format $node['format'] = 'password'; $node['x-example'] = 'password'; break; + case 'Appwrite\Auth\Validator\Phone': + $node['type'] = $validator->getType(); + $node['format'] = 'phone'; + $node['x-example'] = '+12065550100'; + break; case 'Utopia\Validator\Range': /** @var \Utopia\Validator\Range $validator */ $node['type'] = $validator->getType() === Validator::TYPE_FLOAT ? 'number' : $validator->getType(); From 207941558f361d645fc355cdee18e66b125ee838 Mon Sep 17 00:00:00 2001 From: "Vincent (Wen Yu) Ge" Date: Mon, 3 Oct 2022 15:13:04 +0000 Subject: [PATCH 2/2] fix typo in email examples --- src/Appwrite/Specification/Format/Swagger2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 49a5a2757c..6eb27a11aa 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -305,7 +305,7 @@ class Swagger2 extends Format case 'Appwrite\Network\Validator\Email': $node['type'] = $validator->getType(); $node['format'] = 'email'; - $node['x-example'] = 'email@examples.com'; + $node['x-example'] = 'email@example.com'; break; case 'Appwrite\Network\Validator\URL': $node['type'] = $validator->getType();