From 27e2ec04eebe39a44d88895c07122a8fc3da3c46 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 4 Sep 2025 16:59:18 +0530 Subject: [PATCH] chore: keep it as a json string --- src/Appwrite/SDK/Specification/Format/OpenAPI3.php | 5 +---- src/Appwrite/SDK/Specification/Format/Swagger2.php | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 6271ae7006..39b03030fb 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -433,10 +433,7 @@ class OpenAPI3 extends Format case 'Utopia\Validator\Assoc': $param['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; $node['schema']['type'] = 'object'; - - $example = $param['example'] ?? '{}'; - $decodedExample = json_decode($example, true); - $node['schema']['x-example'] = json_last_error() === JSON_ERROR_NONE ? $decodedExample : $example; + $node['schema']['x-example'] = $param['example'] ?? '{}'; break; case 'Utopia\Storage\Validator\File': $consumes = ['multipart/form-data']; diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index 63b9f763f8..96271ef89c 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -467,10 +467,7 @@ class Swagger2 extends Format case 'Utopia\Validator\Assoc': $node['type'] = 'object'; $node['default'] = (empty($param['default'])) ? new \stdClass() : $param['default']; - - $example = $param['example'] ?? '{}'; - $decodedExample = json_decode($example, true); - $node['schema']['x-example'] = json_last_error() === JSON_ERROR_NONE ? $decodedExample : $example; + $node['schema']['x-example'] = $param['example'] ?? '{}'; break; case 'Utopia\Storage\Validator\File': $consumes = ['multipart/form-data'];