Skip to content

Commit

Permalink
feat(test): Add a test for mixed literals
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Dec 21, 2023
1 parent d157214 commit 7591a26
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
['name' => 'Settings#intParameterWithMinAndMax', 'url' => '/api/{apiVersion}/min-max', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#intParameterWithMin', 'url' => '/api/{apiVersion}/min', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#intParameterWithMax', 'url' => '/api/{apiVersion}/max', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#listOfIntStringAndBool', 'url' => '/api/{apiVersion}/mixed-list', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
],
];
12 changes: 12 additions & 0 deletions tests/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,16 @@ public function intParameterWithMin(int $limit): DataResponse {
public function intParameterWithMax(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a list of 2 integers, 2 strings and 1 boolean
*
* @param 0|1|'yes'|'no'|true $weird Weird list
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* 200: Admin settings updated
*/
public function listOfIntStringAndBool($weird): DataResponse {
return new DataResponse();
}
}
99 changes: 99 additions & 0 deletions tests/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,105 @@
}
}
}
},
"/ocs/v2.php/apps/notifications/api/{apiVersion}/mixed-list": {
"post": {
"operationId": "settings-list-of-int-string-and-bool",
"summary": "A route with a list of 2 integers, 2 strings and 1 boolean",
"description": "This endpoint requires admin access",
"tags": [
"settings"
],
"security": [
{
"bearer_auth": []
},
{
"basic_auth": []
}
],
"parameters": [
{
"name": "weird",
"in": "query",
"description": "Weird list",
"required": true,
"schema": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "integer",
"enum": [
0,
1
]
},
{
"type": "string",
"enum": [
"yes",
"no"
]
}
]
}
},
{
"name": "apiVersion",
"in": "path",
"required": true,
"schema": {
"type": "string",
"enum": [
"v2"
],
"default": "v2"
}
},
{
"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": "Admin settings updated",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"ocs"
],
"properties": {
"ocs": {
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
}
}
}
}
}
}
}
}
}
}
},
"tags": []
Expand Down

0 comments on commit 7591a26

Please sign in to comment.