Skip to content

Commit

Permalink
fixup! feat(routing): Support new Route attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin committed Jan 17, 2024
1 parent ff73cff commit a5553b6
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 6 deletions.
6 changes: 4 additions & 2 deletions tests/lib/Controller/RoutingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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();
}
Expand Down
110 changes: 108 additions & 2 deletions tests/openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
Expand Down
110 changes: 108 additions & 2 deletions tests/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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": [
Expand Down

0 comments on commit a5553b6

Please sign in to comment.