Skip to content

Commit 7591a26

Browse files
committed
feat(test): Add a test for mixed literals
Signed-off-by: Joas Schilling <[email protected]>
1 parent d157214 commit 7591a26

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

tests/appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
['name' => 'Settings#intParameterWithMinAndMax', 'url' => '/api/{apiVersion}/min-max', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
4343
['name' => 'Settings#intParameterWithMin', 'url' => '/api/{apiVersion}/min', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
4444
['name' => 'Settings#intParameterWithMax', 'url' => '/api/{apiVersion}/max', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
45+
['name' => 'Settings#listOfIntStringAndBool', 'url' => '/api/{apiVersion}/mixed-list', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
4546
],
4647
];

tests/lib/Controller/SettingsController.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,16 @@ public function intParameterWithMin(int $limit): DataResponse {
209209
public function intParameterWithMax(int $limit): DataResponse {
210210
return new DataResponse();
211211
}
212+
213+
/**
214+
* A route with a list of 2 integers, 2 strings and 1 boolean
215+
*
216+
* @param 0|1|'yes'|'no'|true $weird Weird list
217+
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
218+
*
219+
* 200: Admin settings updated
220+
*/
221+
public function listOfIntStringAndBool($weird): DataResponse {
222+
return new DataResponse();
223+
}
212224
}

tests/openapi.json

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,105 @@
12721272
}
12731273
}
12741274
}
1275+
},
1276+
"/ocs/v2.php/apps/notifications/api/{apiVersion}/mixed-list": {
1277+
"post": {
1278+
"operationId": "settings-list-of-int-string-and-bool",
1279+
"summary": "A route with a list of 2 integers, 2 strings and 1 boolean",
1280+
"description": "This endpoint requires admin access",
1281+
"tags": [
1282+
"settings"
1283+
],
1284+
"security": [
1285+
{
1286+
"bearer_auth": []
1287+
},
1288+
{
1289+
"basic_auth": []
1290+
}
1291+
],
1292+
"parameters": [
1293+
{
1294+
"name": "weird",
1295+
"in": "query",
1296+
"description": "Weird list",
1297+
"required": true,
1298+
"schema": {
1299+
"oneOf": [
1300+
{
1301+
"type": "boolean"
1302+
},
1303+
{
1304+
"type": "integer",
1305+
"enum": [
1306+
0,
1307+
1
1308+
]
1309+
},
1310+
{
1311+
"type": "string",
1312+
"enum": [
1313+
"yes",
1314+
"no"
1315+
]
1316+
}
1317+
]
1318+
}
1319+
},
1320+
{
1321+
"name": "apiVersion",
1322+
"in": "path",
1323+
"required": true,
1324+
"schema": {
1325+
"type": "string",
1326+
"enum": [
1327+
"v2"
1328+
],
1329+
"default": "v2"
1330+
}
1331+
},
1332+
{
1333+
"name": "OCS-APIRequest",
1334+
"in": "header",
1335+
"description": "Required to be true for the API request to pass",
1336+
"required": true,
1337+
"schema": {
1338+
"type": "boolean",
1339+
"default": true
1340+
}
1341+
}
1342+
],
1343+
"responses": {
1344+
"200": {
1345+
"description": "Admin settings updated",
1346+
"content": {
1347+
"application/json": {
1348+
"schema": {
1349+
"type": "object",
1350+
"required": [
1351+
"ocs"
1352+
],
1353+
"properties": {
1354+
"ocs": {
1355+
"type": "object",
1356+
"required": [
1357+
"meta",
1358+
"data"
1359+
],
1360+
"properties": {
1361+
"meta": {
1362+
"$ref": "#/components/schemas/OCSMeta"
1363+
},
1364+
"data": {}
1365+
}
1366+
}
1367+
}
1368+
}
1369+
}
1370+
}
1371+
}
1372+
}
1373+
}
12751374
}
12761375
},
12771376
"tags": []

0 commit comments

Comments
 (0)