diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 5429211e86..214b9d858f 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -275,6 +275,9 @@ class OpenAPI3 extends Format $node['schema']['x-example'] = false; break; case 'Utopia\Database\Validator\UID': + $node['schema']['type'] = $validator->getType(); + $node['schema']['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; + break; case 'Appwrite\Utopia\Database\Validator\CustomId': if($route->getLabel('sdk.methodType', '') === 'upload') { $node['schema']['x-upload-id'] = true; @@ -375,9 +378,13 @@ class OpenAPI3 extends Format $body['content'][$consumes[0]]['schema']['properties'][$name] = [ 'type' => $node['schema']['type'], 'description' => $node['description'], - 'x-example' => $node['x-example'] ?? null, + 'x-example' => $node['schema']['x-example'] ?? null ]; + if($node['schema']['x-upload-id'] ?? false) { + $body['content'][$consumes[0]]['schema']['properties'][$name]['x-upload-id'] = $node['schema']['x-upload-id']; + } + if(isset($node['default'])) { $body['content'][$consumes[0]]['schema']['properties'][$name]['default'] = $node['default']; } diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index a2a09e14e8..e24030ea7e 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -262,7 +262,6 @@ class Swagger2 extends Format $node['type'] = $validator->getType(); $node['x-example'] = false; break; - case 'Utopia\Database\Validator\UID': case 'Appwrite\Utopia\Database\Validator\CustomId': if($route->getLabel('sdk.methodType', '') === 'upload') { $node['x-upload-id'] = true; @@ -270,6 +269,10 @@ class Swagger2 extends Format $node['type'] = $validator->getType(); $node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; break; + case 'Utopia\Database\Validator\UID': + $node['type'] = $validator->getType(); + $node['x-example'] = '['.\strtoupper(Template::fromCamelCaseToSnake($node['name'])).']'; + break; case 'Appwrite\Network\Validator\Email': $node['type'] = $validator->getType(); $node['format'] = 'email';