Skip to content

Commit

Permalink
Merge pull request #77 from nextcloud/test/openapitype/int-ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Jan 17, 2024
2 parents bfe4acc + 3d81f26 commit 5c7fe08
Show file tree
Hide file tree
Showing 4 changed files with 716 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
['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#intParameterNonNegative', 'url' => '/api/{apiVersion}/non-negative', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#intParameterPositive', 'url' => '/api/{apiVersion}/positive', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#intParameterNegative', 'url' => '/api/{apiVersion}/negative', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#intParameterNonPositive', 'url' => '/api/{apiVersion}/non-positive', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#listOfIntStringAndOneBool', 'url' => '/api/{apiVersion}/mixed-list-one', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#listOfIntStringAndAllBools', 'url' => '/api/{apiVersion}/mixed-list-all', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
['name' => 'Settings#booleanParameterRequired', 'url' => '/api/{apiVersion}/boolean', 'verb' => 'POST', 'requirements' => ['apiVersion' => '(v2)']],
Expand Down
48 changes: 48 additions & 0 deletions tests/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,54 @@ public function intParameterWithMax(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a non negative integer
*
* @param non-negative-int $limit not negative
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* 200: Admin settings updated
*/
public function intParameterNonNegative(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a positive integer
*
* @param positive-int $limit positive
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* 200: Admin settings updated
*/
public function intParameterPositive(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a negative integer
*
* @param negative-int $limit negative
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* 200: Admin settings updated
*/
public function intParameterNegative(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a non positive integer
*
* @param non-positive-int $limit non positive
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>
*
* 200: Admin settings updated
*/
public function intParameterNonPositive(int $limit): DataResponse {
return new DataResponse();
}

/**
* A route with a list of 2 integers, 2 strings and 1 boolean
*
Expand Down
Loading

0 comments on commit 5c7fe08

Please sign in to comment.