diff --git a/app/config/specs/open-api3-1.6.x-client.json b/app/config/specs/open-api3-1.6.x-client.json index fc967c13a6..f1b247a70f 100644 --- a/app/config/specs/open-api3-1.6.x-client.json +++ b/app/config/specs/open-api3-1.6.x-client.json @@ -9405,7 +9405,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/open-api3-1.6.x-console.json b/app/config/specs/open-api3-1.6.x-console.json index 8527e27630..1e3c1a21c4 100644 --- a/app/config/specs/open-api3-1.6.x-console.json +++ b/app/config/specs/open-api3-1.6.x-console.json @@ -35589,7 +35589,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/open-api3-1.6.x-server.json b/app/config/specs/open-api3-1.6.x-server.json index 7d199f1919..1a394f6def 100644 --- a/app/config/specs/open-api3-1.6.x-server.json +++ b/app/config/specs/open-api3-1.6.x-server.json @@ -25966,7 +25966,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index fc967c13a6..f1b247a70f 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -9405,7 +9405,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index 8527e27630..1e3c1a21c4 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -35589,7 +35589,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 7d199f1919..1a394f6def 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -25966,7 +25966,7 @@ "responseBody": { "type": "string", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-1.6.x-client.json b/app/config/specs/swagger2-1.6.x-client.json index 66b272bea7..cf001af0e8 100644 --- a/app/config/specs/swagger2-1.6.x-client.json +++ b/app/config/specs/swagger2-1.6.x-client.json @@ -9589,9 +9589,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-1.6.x-console.json b/app/config/specs/swagger2-1.6.x-console.json index 58c81422a9..d9037abc55 100644 --- a/app/config/specs/swagger2-1.6.x-console.json +++ b/app/config/specs/swagger2-1.6.x-console.json @@ -36104,9 +36104,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-1.6.x-server.json b/app/config/specs/swagger2-1.6.x-server.json index 1e70715a7e..42cf3ff2c7 100644 --- a/app/config/specs/swagger2-1.6.x-server.json +++ b/app/config/specs/swagger2-1.6.x-server.json @@ -26458,9 +26458,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index 66b272bea7..cf001af0e8 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -9589,9 +9589,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 58c81422a9..d9037abc55 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -36104,9 +36104,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index 1e70715a7e..42cf3ff2c7 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -26458,9 +26458,9 @@ "format": "int32" }, "responseBody": { - "type": "string", + "type": "payload", "description": "HTTP response body. This will return empty unless execution is created as synchronous.", - "x-example": "Developers are awesome." + "x-example": "" }, "responseHeaders": { "type": "array", diff --git a/src/Appwrite/GraphQL/Types/Mapper.php b/src/Appwrite/GraphQL/Types/Mapper.php index 36b246b28b..d8f1d7da09 100644 --- a/src/Appwrite/GraphQL/Types/Mapper.php +++ b/src/Appwrite/GraphQL/Types/Mapper.php @@ -50,6 +50,7 @@ class Mapper $defaults = [ 'boolean' => Type::boolean(), 'string' => Type::string(), + 'payload' => Type::string(), 'integer' => Type::int(), 'double' => Type::float(), 'datetime' => Type::string(), diff --git a/src/Appwrite/Specification/Format/OpenAPI3.php b/src/Appwrite/Specification/Format/OpenAPI3.php index 3074d59b7c..f7430ec70e 100644 --- a/src/Appwrite/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/Specification/Format/OpenAPI3.php @@ -549,6 +549,7 @@ class OpenAPI3 extends Format switch ($rule['type']) { case 'string': case 'datetime': + case 'payload': $type = 'string'; break; diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 2eab7807b3..0dac729358 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -585,6 +585,10 @@ class Swagger2 extends Format $type = 'boolean'; break; + case 'payload': + $type = 'payload'; + break; + default: $type = 'object'; $rule['type'] = ($rule['type']) ?: 'none'; diff --git a/src/Appwrite/Utopia/Response/Model.php b/src/Appwrite/Utopia/Response/Model.php index 8a0bb78cba..d14d1be0c1 100644 --- a/src/Appwrite/Utopia/Response/Model.php +++ b/src/Appwrite/Utopia/Response/Model.php @@ -14,6 +14,7 @@ abstract class Model public const TYPE_DATETIME = 'datetime'; public const TYPE_DATETIME_EXAMPLE = '2020-10-15T06:38:00.000+00:00'; public const TYPE_RELATIONSHIP = 'relationship'; + public const TYPE_PAYLOAD = 'payload'; /** * @var bool diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index 90fbdc9689..dc5d41c02c 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -81,10 +81,9 @@ class Execution extends Model 'example' => 200, ]) ->addRule('responseBody', [ - 'type' => self::TYPE_STRING, + 'type' => self::TYPE_PAYLOAD, 'description' => 'HTTP response body. This will return empty unless execution is created as synchronous.', 'default' => '', - 'example' => 'Developers are awesome.', ]) ->addRule('responseHeaders', [ 'type' => Response::MODEL_HEADERS, diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index 0881966365..fe600cd0f8 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -133,7 +133,7 @@ class HTTPTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); // looks like recent change in the validator - $this->assertTrue(empty($response['body']['schemaValidationMessages'])); + $this->assertEmpty($response['body']['schemaValidationMessages'], 'Schema validation failed for ' . $file . ': ' . json_encode($response['body']['schemaValidationMessages'], JSON_PRETTY_PRINT)); } }