diff --git a/src/ResponseType.php b/src/ResponseType.php index da9da47c..164a32dd 100644 --- a/src/ResponseType.php +++ b/src/ResponseType.php @@ -135,6 +135,14 @@ public static function getAll(): array { null, null, ), + new ResponseType( + 'StreamTraversableResponse', + false, + false, + null, + null, + null, + ), new ResponseType( 'TemplateResponse', false, diff --git a/tests/lib/Controller/StreamingController.php b/tests/lib/Controller/StreamingController.php new file mode 100644 index 00000000..8a0c004e --- /dev/null +++ b/tests/lib/Controller/StreamingController.php @@ -0,0 +1,32 @@ + + * + * 200: Export OK + */ + #[ApiRoute(verb: 'GET', url: '/streaming/traversable')] + public function traversable(): StreamTraversableResponse { + return new StreamTraversableResponse($this->generator()); + } + + private function generator(): \Generator { + yield from []; + } +} diff --git a/tests/openapi-administration.json b/tests/openapi-administration.json index 4bc36595..76ffb3dc 100644 --- a/tests/openapi-administration.json +++ b/tests/openapi-administration.json @@ -9648,6 +9648,97 @@ } } }, + "/ocs/v2.php/apps/notifications/streaming/traversable": { + "get": { + "operationId": "streaming-traversable", + "summary": "Use StreamTraversableResponse response type", + "description": "This endpoint requires admin access", + "tags": [ + "streaming" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Export OK" + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, "/index.php/tests/attribute-index/{param}": { "get": { "operationId": "routing-attribute-index-route", diff --git a/tests/openapi-full.json b/tests/openapi-full.json index afb019c4..a6a30974 100644 --- a/tests/openapi-full.json +++ b/tests/openapi-full.json @@ -9848,6 +9848,97 @@ } } }, + "/ocs/v2.php/apps/notifications/streaming/traversable": { + "get": { + "operationId": "streaming-traversable", + "summary": "Use StreamTraversableResponse response type", + "description": "This endpoint requires admin access", + "tags": [ + "streaming" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "OCS-APIRequest", + "in": "header", + "description": "Required to be true for the API request to pass", + "required": true, + "schema": { + "type": "boolean", + "default": true + } + } + ], + "responses": { + "200": { + "description": "Export OK" + }, + "401": { + "description": "Current user is not logged in", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + }, + "403": { + "description": "Logged in account must be an admin", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + } + }, "/index.php/tests/attribute-index/{param}": { "get": { "operationId": "routing-attribute-index-route",