From a5553b68c61a484de10276e3ad1637f6d40a582c Mon Sep 17 00:00:00 2001 From: provokateurin Date: Wed, 17 Jan 2024 11:08:12 +0100 Subject: [PATCH] fixup! feat(routing): Support new Route attribute --- tests/lib/Controller/RoutingController.php | 6 +- tests/openapi-administration.json | 110 ++++++++++++++++++++- tests/openapi-full.json | 110 ++++++++++++++++++++- 3 files changed, 220 insertions(+), 6 deletions(-) diff --git a/tests/lib/Controller/RoutingController.php b/tests/lib/Controller/RoutingController.php index 620a7bc..2e86511 100644 --- a/tests/lib/Controller/RoutingController.php +++ b/tests/lib/Controller/RoutingController.php @@ -15,7 +15,8 @@ class RoutingController extends OCSController { * * 200: Success */ - #[Route(Route::TYPE_OCS, verb: 'GET', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'postfix')] + #[Route(Route::TYPE_API, verb: 'GET', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'Route')] + #[ApiRoute(verb: 'POST', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'ApiRoute')] public function attributeOCS() { return DataResponse(); } @@ -28,7 +29,8 @@ public function attributeOCS() { * * 200: Success */ - #[Route(Route::TYPE_INDEX, verb: 'GET', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'postfix')] + #[Route(Route::TYPE_FRONTPAGE, verb: 'GET', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'Route')] + #[FrontpageRoute(verb: 'POST', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'FrontpageRoute')] public function attributeIndex() { return DataResponse(); } diff --git a/tests/openapi-administration.json b/tests/openapi-administration.json index a3b9c86..4d3e134 100644 --- a/tests/openapi-administration.json +++ b/tests/openapi-administration.json @@ -1832,7 +1832,75 @@ }, "/ocs/v2.php/tests/attribute-ocs/{param}": { "get": { - "operationId": "routing-attributeocs-postfix", + "operationId": "routing-attributeocs-route", + "summary": "OCS Route with attribute", + "description": "This endpoint requires admin access", + "tags": [ + "routing" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "param", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[a-z]+$", + "default": "abc" + } + }, + { + "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": "Success", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "routing-attributeocs-apiroute", "summary": "OCS Route with attribute", "description": "This endpoint requires admin access", "tags": [ @@ -1902,7 +1970,45 @@ }, "/index.php/tests/attribute-index/{param}": { "get": { - "operationId": "routing-attribute-index-postfix", + "operationId": "routing-attribute-index-route", + "summary": "Index Route with attribute", + "description": "This endpoint requires admin access", + "tags": [ + "routing" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "param", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[a-z]+$", + "default": "abc" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": {} + } + } + } + } + }, + "post": { + "operationId": "routing-attribute-index-frontpageroute", "summary": "Index Route with attribute", "description": "This endpoint requires admin access", "tags": [ diff --git a/tests/openapi-full.json b/tests/openapi-full.json index b012133..71a7c2e 100644 --- a/tests/openapi-full.json +++ b/tests/openapi-full.json @@ -1959,7 +1959,75 @@ }, "/ocs/v2.php/tests/attribute-ocs/{param}": { "get": { - "operationId": "routing-attributeocs-postfix", + "operationId": "routing-attributeocs-route", + "summary": "OCS Route with attribute", + "description": "This endpoint requires admin access", + "tags": [ + "routing" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "param", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[a-z]+$", + "default": "abc" + } + }, + { + "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": "Success", + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "ocs" + ], + "properties": { + "ocs": { + "type": "object", + "required": [ + "meta", + "data" + ], + "properties": { + "meta": { + "$ref": "#/components/schemas/OCSMeta" + }, + "data": {} + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "routing-attributeocs-apiroute", "summary": "OCS Route with attribute", "description": "This endpoint requires admin access", "tags": [ @@ -2029,7 +2097,45 @@ }, "/index.php/tests/attribute-index/{param}": { "get": { - "operationId": "routing-attribute-index-postfix", + "operationId": "routing-attribute-index-route", + "summary": "Index Route with attribute", + "description": "This endpoint requires admin access", + "tags": [ + "routing" + ], + "security": [ + { + "bearer_auth": [] + }, + { + "basic_auth": [] + } + ], + "parameters": [ + { + "name": "param", + "in": "path", + "required": true, + "schema": { + "type": "string", + "pattern": "^[a-z]+$", + "default": "abc" + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/json": { + "schema": {} + } + } + } + } + }, + "post": { + "operationId": "routing-attribute-index-frontpageroute", "summary": "Index Route with attribute", "description": "This endpoint requires admin access", "tags": [