Skip to content

Commit 5978fb3

Browse files
committed
fixup! feat(routing): Support new Route attribute
1 parent b6ebdaa commit 5978fb3

3 files changed

Lines changed: 220 additions & 6 deletions

File tree

tests/lib/Controller/RoutingController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class RoutingController extends OCSController {
1515
*
1616
* 200: Success
1717
*/
18-
#[Route(Route::TYPE_OCS, verb: 'GET', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'postfix')]
18+
#[Route(Route::TYPE_API, verb: 'GET', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'Route')]
19+
#[ApiRoute(verb: 'POST', url: '/attribute-ocs/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'ApiRoute')]
1920
public function attributeOCS() {
2021
return DataResponse();
2122
}
@@ -28,7 +29,8 @@ public function attributeOCS() {
2829
*
2930
* 200: Success
3031
*/
31-
#[Route(Route::TYPE_INDEX, verb: 'GET', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'postfix')]
32+
#[Route(Route::TYPE_FRONTPAGE, verb: 'GET', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'Route')]
33+
#[FrontpageRoute(verb: 'POST', url: '/attribute-index/{param}', requirements: ['param' => '[a-z]+'], defaults: ['param' => 'abc'], root: '/tests', postfix: 'FrontpageRoute')]
3234
public function attributeIndex() {
3335
return DataResponse();
3436
}

tests/openapi-administration.json

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,75 @@
21642164
},
21652165
"/ocs/v2.php/tests/attribute-ocs/{param}": {
21662166
"get": {
2167-
"operationId": "routing-attributeocs-postfix",
2167+
"operationId": "routing-attributeocs-route",
2168+
"summary": "OCS Route with attribute",
2169+
"description": "This endpoint requires admin access",
2170+
"tags": [
2171+
"routing"
2172+
],
2173+
"security": [
2174+
{
2175+
"bearer_auth": []
2176+
},
2177+
{
2178+
"basic_auth": []
2179+
}
2180+
],
2181+
"parameters": [
2182+
{
2183+
"name": "param",
2184+
"in": "path",
2185+
"required": true,
2186+
"schema": {
2187+
"type": "string",
2188+
"pattern": "^[a-z]+$",
2189+
"default": "abc"
2190+
}
2191+
},
2192+
{
2193+
"name": "OCS-APIRequest",
2194+
"in": "header",
2195+
"description": "Required to be true for the API request to pass",
2196+
"required": true,
2197+
"schema": {
2198+
"type": "boolean",
2199+
"default": true
2200+
}
2201+
}
2202+
],
2203+
"responses": {
2204+
"200": {
2205+
"description": "Success",
2206+
"content": {
2207+
"application/json": {
2208+
"schema": {
2209+
"type": "object",
2210+
"required": [
2211+
"ocs"
2212+
],
2213+
"properties": {
2214+
"ocs": {
2215+
"type": "object",
2216+
"required": [
2217+
"meta",
2218+
"data"
2219+
],
2220+
"properties": {
2221+
"meta": {
2222+
"$ref": "#/components/schemas/OCSMeta"
2223+
},
2224+
"data": {}
2225+
}
2226+
}
2227+
}
2228+
}
2229+
}
2230+
}
2231+
}
2232+
}
2233+
},
2234+
"post": {
2235+
"operationId": "routing-attributeocs-apiroute",
21682236
"summary": "OCS Route with attribute",
21692237
"description": "This endpoint requires admin access",
21702238
"tags": [
@@ -2234,7 +2302,45 @@
22342302
},
22352303
"/index.php/tests/attribute-index/{param}": {
22362304
"get": {
2237-
"operationId": "routing-attribute-index-postfix",
2305+
"operationId": "routing-attribute-index-route",
2306+
"summary": "Index Route with attribute",
2307+
"description": "This endpoint requires admin access",
2308+
"tags": [
2309+
"routing"
2310+
],
2311+
"security": [
2312+
{
2313+
"bearer_auth": []
2314+
},
2315+
{
2316+
"basic_auth": []
2317+
}
2318+
],
2319+
"parameters": [
2320+
{
2321+
"name": "param",
2322+
"in": "path",
2323+
"required": true,
2324+
"schema": {
2325+
"type": "string",
2326+
"pattern": "^[a-z]+$",
2327+
"default": "abc"
2328+
}
2329+
}
2330+
],
2331+
"responses": {
2332+
"200": {
2333+
"description": "Success",
2334+
"content": {
2335+
"application/json": {
2336+
"schema": {}
2337+
}
2338+
}
2339+
}
2340+
}
2341+
},
2342+
"post": {
2343+
"operationId": "routing-attribute-index-frontpageroute",
22382344
"summary": "Index Route with attribute",
22392345
"description": "This endpoint requires admin access",
22402346
"tags": [

tests/openapi-full.json

Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,75 @@
22912291
},
22922292
"/ocs/v2.php/tests/attribute-ocs/{param}": {
22932293
"get": {
2294-
"operationId": "routing-attributeocs-postfix",
2294+
"operationId": "routing-attributeocs-route",
2295+
"summary": "OCS Route with attribute",
2296+
"description": "This endpoint requires admin access",
2297+
"tags": [
2298+
"routing"
2299+
],
2300+
"security": [
2301+
{
2302+
"bearer_auth": []
2303+
},
2304+
{
2305+
"basic_auth": []
2306+
}
2307+
],
2308+
"parameters": [
2309+
{
2310+
"name": "param",
2311+
"in": "path",
2312+
"required": true,
2313+
"schema": {
2314+
"type": "string",
2315+
"pattern": "^[a-z]+$",
2316+
"default": "abc"
2317+
}
2318+
},
2319+
{
2320+
"name": "OCS-APIRequest",
2321+
"in": "header",
2322+
"description": "Required to be true for the API request to pass",
2323+
"required": true,
2324+
"schema": {
2325+
"type": "boolean",
2326+
"default": true
2327+
}
2328+
}
2329+
],
2330+
"responses": {
2331+
"200": {
2332+
"description": "Success",
2333+
"content": {
2334+
"application/json": {
2335+
"schema": {
2336+
"type": "object",
2337+
"required": [
2338+
"ocs"
2339+
],
2340+
"properties": {
2341+
"ocs": {
2342+
"type": "object",
2343+
"required": [
2344+
"meta",
2345+
"data"
2346+
],
2347+
"properties": {
2348+
"meta": {
2349+
"$ref": "#/components/schemas/OCSMeta"
2350+
},
2351+
"data": {}
2352+
}
2353+
}
2354+
}
2355+
}
2356+
}
2357+
}
2358+
}
2359+
}
2360+
},
2361+
"post": {
2362+
"operationId": "routing-attributeocs-apiroute",
22952363
"summary": "OCS Route with attribute",
22962364
"description": "This endpoint requires admin access",
22972365
"tags": [
@@ -2361,7 +2429,45 @@
23612429
},
23622430
"/index.php/tests/attribute-index/{param}": {
23632431
"get": {
2364-
"operationId": "routing-attribute-index-postfix",
2432+
"operationId": "routing-attribute-index-route",
2433+
"summary": "Index Route with attribute",
2434+
"description": "This endpoint requires admin access",
2435+
"tags": [
2436+
"routing"
2437+
],
2438+
"security": [
2439+
{
2440+
"bearer_auth": []
2441+
},
2442+
{
2443+
"basic_auth": []
2444+
}
2445+
],
2446+
"parameters": [
2447+
{
2448+
"name": "param",
2449+
"in": "path",
2450+
"required": true,
2451+
"schema": {
2452+
"type": "string",
2453+
"pattern": "^[a-z]+$",
2454+
"default": "abc"
2455+
}
2456+
}
2457+
],
2458+
"responses": {
2459+
"200": {
2460+
"description": "Success",
2461+
"content": {
2462+
"application/json": {
2463+
"schema": {}
2464+
}
2465+
}
2466+
}
2467+
}
2468+
},
2469+
"post": {
2470+
"operationId": "routing-attribute-index-frontpageroute",
23652471
"summary": "Index Route with attribute",
23662472
"description": "This endpoint requires admin access",
23672473
"tags": [

0 commit comments

Comments
 (0)