Skip to content

Commit

Permalink
fix openapi specs
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Dec 22, 2024
1 parent 92c0a11 commit 4831b98
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 138 deletions.
64 changes: 34 additions & 30 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

$requirements = [
'apiVersion' => '(v1)',
];

$publicRequirements = [
'apiVersion' => '(v1)',
'token' => '^[a-zA-Z0-9]{4,64}$',
];

Expand Down Expand Up @@ -123,12 +127,12 @@
['name' => 'api#autoSettlement', 'url' => '/api/{apiVersion}/projects/{projectId}/auto-settlement', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'api#exportCsvSettlement', 'url' => '/api/{apiVersion}/projects/{projectId}/export-csv-settlement', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'api#getPublicFileShare', 'url' => '/api/{apiVersion}/public-file-share', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteProject', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicEditProject', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicGetProjectInfo', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicGetProjectStatistics', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/statistics', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicGetProjectSettlement', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/settlement', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicAutoSettlement', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/auto-settlement', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteProject', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditProject', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicGetProjectInfo', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicGetProjectStatistics', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/statistics', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicGetProjectSettlement', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/settlement', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicAutoSettlement', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/auto-settlement', 'verb' => 'GET', 'requirements' => $publicRequirements],
// bills
['name' => 'api#createBill', 'url' => '/api/{apiVersion}/projects/{projectId}/bills', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#getBill', 'url' => '/api/{apiVersion}/projects/{projectId}/bills/{billId}', 'verb' => 'GET', 'requirements' => $requirements],
Expand All @@ -140,24 +144,24 @@
['name' => 'api#editBills', 'url' => '/api/{apiVersion}/projects/{projectId}/bills', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#moveBill', 'url' => '/api/{apiVersion}/projects/{projectId}/bills/{billId}/move', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#repeatBill', 'url' => '/api/{apiVersion}/projects/{projectId}/bills/{billId}/repeat', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicRepeatBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}/repeat', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicGetBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicGetBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicClearTrashBin', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/trash-bin', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicEditBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicEditBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'POST', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicRepeatBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}/repeat', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicGetBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicGetBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicClearTrashBin', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/trash-bin', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeleteBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeleteBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditBill', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills/{billId}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditBills', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/bills', 'verb' => 'PUT', 'requirements' => $publicRequirements],
// members
['name' => 'api#getMembers', 'url' => '/api/{apiVersion}/projects/{projectId}/members', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'api#createMember', 'url' => '/api/{apiVersion}/projects/{projectId}/members', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#editMember', 'url' => '/api/{apiVersion}/projects/{projectId}/members/{memberId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#deleteMember', 'url' => '/api/{apiVersion}/projects/{projectId}/members/{memberId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicGetMembers', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members', 'verb' => 'GET', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicEditMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members/{memberId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members/{memberId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicGetMembers', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members', 'verb' => 'GET', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicCreateMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members', 'verb' => 'POST', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members/{memberId}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeleteMember', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/members/{memberId}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
// shares
['name' => 'api#createUserShare', 'url' => '/api/{apiVersion}/projects/{projectId}/user-share', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#deleteUserShare', 'url' => '/api/{apiVersion}/projects/{projectId}/user-share/{shId}', 'verb' => 'DELETE', 'requirements' => $requirements],
Expand All @@ -175,26 +179,26 @@
['name' => 'api#createCurrency', 'url' => '/api/{apiVersion}/projects/{projectId}/currency', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#editCurrency', 'url' => '/api/{apiVersion}/projects/{projectId}/currency/{currencyId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#deleteCurrency', 'url' => '/api/{apiVersion}/projects/{projectId}/currency/{currencyId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicEditCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency/{currencyId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency/{currencyId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency', 'verb' => 'POST', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency/{currencyId}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeleteCurrency', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/currency/{currencyId}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
// payment modes
['name' => 'api#createPaymentMode', 'url' => '/api/{apiVersion}/projects/{projectId}/paymentmode', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#editPaymentMode', 'url' => '/api/{apiVersion}/projects/{projectId}/paymentmode/{pmId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#savePaymentModeOrder', 'url' => '/api/{apiVersion}/projects/{projectId}/paymentmode-order', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#deletePaymentMode', 'url' => '/api/{apiVersion}/projects/{projectId}/paymentmode/{pmId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreatePaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicEditPaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode/{pmId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicSavePaymentModeOrder', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode-order', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicDeletePaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode/{pmId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreatePaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode', 'verb' => 'POST', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditPaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode/{pmId}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicSavePaymentModeOrder', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode-order', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeletePaymentMode', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/paymentmode/{pmId}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
// categories
['name' => 'api#createCategory', 'url' => '/api/{apiVersion}/projects/{projectId}/category', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'api#editCategory', 'url' => '/api/{apiVersion}/projects/{projectId}/category/{categoryId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#saveCategoryOrder', 'url' => '/api/{apiVersion}/projects/{projectId}/category-order', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'api#deleteCategory', 'url' => '/api/{apiVersion}/projects/{projectId}/category/{categoryId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category', 'verb' => 'POST', 'requirements' => $requirements],
['name' => 'publicApi#publicEditCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category/{categoryId}', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicSaveCategoryOrder', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category-order', 'verb' => 'PUT', 'requirements' => $requirements],
['name' => 'publicApi#publicDeleteCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category/{categoryId}', 'verb' => 'DELETE', 'requirements' => $requirements],
['name' => 'publicApi#publicCreateCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category', 'verb' => 'POST', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicEditCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category/{categoryId}', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicSaveCategoryOrder', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category-order', 'verb' => 'PUT', 'requirements' => $publicRequirements],
['name' => 'publicApi#publicDeleteCategory', 'url' => '/api/{apiVersion}/public/projects/{token}/{password}/category/{categoryId}', 'verb' => 'DELETE', 'requirements' => $publicRequirements],
],
];
20 changes: 10 additions & 10 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function createProject(string $id, string $name): DataResponse {
/**
* Get local project list
*
* @return DataResponse<Http::STATUS_OK, CospendFullProjectInfo[], array{}>
* @return DataResponse<Http::STATUS_OK, list<CospendFullProjectInfo>, array{}>

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.1, OCP 30

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.2, OCP 30

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.3, OCP 30

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.2, OCP dev-master

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.1, OCP dev-master

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)

Check failure on line 147 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / Psalm, PHP 8.3, OCP dev-master

MoreSpecificReturnType

lib/Controller/ApiController.php:147:13: MoreSpecificReturnType: The declared return type 'OCP\AppFramework\Http\DataResponse<200, list<array{active_members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, archived_ts: int, autoexport: string, balance: array<string, float>, categories: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, categorysort: string, currencies: list<array{exchange_rate: float, id: int, name: string, projectid: string}>, currencyname: string, deletiondisabled: bool, email: null|string, id: int, lastchanged: int, members: list<array{activated: bool, color: array{b: int, g: int, r: int}, id: int, lastchanged: int, name: string, userid: null|string, weight: float}>, myaccesslevel: int, name: string, nb_bills: int, nb_trashbin_bills: int, paymentmodes: array<string, array{color: null|string, icon: null|string, id: int, name: null|string, order: int, projectid: string}>, paymentmodesort: string, shares: list<array{accesslevel: 0|1|2|3|4, circleid?: string, groupid?: string, id: int, label?: null|string, manually_added?: bool, name?: string, password?: null|string, token?: string, type: 'c'|'g'|'l'|'u', userid?: string}>, total_spent: float, userid: string}>, array<never, never>>' for OCA\Cospend\Controller\ApiController::getLocalProjects is more specific than the inferred return type 'OCP\AppFramework\Http\DataResponse<200, array<array-key, mixed>, array<never, never>>' (see https://psalm.dev/070)
* @throws Exception
*
* 200: Project list
Expand Down Expand Up @@ -344,7 +344,7 @@ public function autoSettlement(string $projectId, ?int $centeredOn = null, int $
*
* @param string $projectId
* @param int|null $lastChanged
* @return DataResponse<Http::STATUS_OK, CospendMember[], array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @return DataResponse<Http::STATUS_OK, list<CospendMember>, array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
*
* 200: List of members
*/
Expand Down Expand Up @@ -509,7 +509,7 @@ public function editBill(
* Edit multiple bills
*
* @param string $projectId
* @param array<int> $billIds
* @param list<int> $billIds
* @param int|null $categoryId
* @param string|null $date
* @param string|null $what
Expand All @@ -525,7 +525,7 @@ public function editBill(
* @param string|null $comment
* @param int|null $repeatFreq
* @param int|null $deleted
* @return DataResponse<Http::STATUS_OK, int[], array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @return DataResponse<Http::STATUS_OK, list<int>, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @throws Exception
*/
#[NoAdminRequired]
Expand Down Expand Up @@ -613,7 +613,7 @@ public function moveBill(string $projectId, int $billId, string $toProjectId): D
*
* @param string $projectId
* @param int $billId
* @return DataResponse<Http::STATUS_OK, array<array{new_bill_id: int, date_orig: string, date_repeat: string, what: string, project_name: string}>, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @return DataResponse<Http::STATUS_OK, list<array{new_bill_id: int, date_orig: string, date_repeat: string, what: string, project_name: string}>, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
*/
#[NoAdminRequired]
#[CospendUserPermissions(minimumLevel: Application::ACCESS_LEVEL_PARTICIPANT)]
Expand Down Expand Up @@ -730,7 +730,7 @@ public function deleteBill(string $projectId, int $billId, bool $moveToTrash = t
* Delete multiple bills
*
* @param string $projectId
* @param array<int> $billIds
* @param list<int> $billIds
* @param bool $moveToTrash
* @return DataResponse<Http::STATUS_OK, '', array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @throws DoesNotExistException
Expand Down Expand Up @@ -769,7 +769,7 @@ public function deleteBills(string $projectId, array $billIds, bool $moveToTrash
* @param int|null $includeBillId
* @param string|null $searchTerm
* @param int|null $deleted
* @return DataResponse<Http::STATUS_OK, array{nb_bills: int, allBillIds: int[], timestamp: int, bills: CospendBill[]}, array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @return DataResponse<Http::STATUS_OK, array{nb_bills: int, allBillIds: list<int>, timestamp: int, bills: list<CospendBill>}, array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
*/
#[NoAdminRequired]
#[CospendUserPermissions(minimumLevel: Application::ACCESS_LEVEL_VIEWER)]
Expand Down Expand Up @@ -951,7 +951,7 @@ public function editPaymentMode(
* Save payment modes order
*
* @param string $projectId
* @param array<array{order: int, id: int}> $order Array of objects, each object contains the order number and the payment mode ID
* @param list<array{order: int, id: int}> $order Array of objects, each object contains the order number and the payment mode ID
* @return DataResponse<Http::STATUS_OK, '', array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @throws DoesNotExistException
* @throws Exception
Expand Down Expand Up @@ -1064,7 +1064,7 @@ public function editCategory(
* Save categories order
*
* @param string $projectId
* @param array<array{order: int, id: int}> $order
* @param list<array{order: int, id: int}> $order
* @return DataResponse<Http::STATUS_OK, true, array{}>|DataResponse<Http::STATUS_FAILED_DEPENDENCY, array<string, string>, array{}>
* @throws DoesNotExistException
* @throws Exception
Expand Down Expand Up @@ -1703,7 +1703,7 @@ public function importSWProject(string $path): DataResponse {
*
* Used by MoneyBuster to check if weblogin is valid
*
* @return DataResponse<Http::STATUS_OK, array<?string>, array{}>
* @return DataResponse<Http::STATUS_OK, list<?string>, array{}>
*/
#[NoAdminRequired]
public function ping(): DataResponse {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/FederationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function acceptShare(int $id): DataResponse {
*
* @param int $id ID of the share
* @psalm-param non-negative-int $id
* @return DataResponse<Http::STATUS_OK, array<empty>, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_BAD_REQUEST, array{error?: string}, array{}>
* @return DataResponse<Http::STATUS_OK, list<empty>, array{}>|DataResponse<Http::STATUS_NOT_FOUND|Http::STATUS_BAD_REQUEST, array{error?: string}, array{}>
*
* 200: Invite declined successfully
* 400: Invite was already accepted, use the "Remove the current user from a room" endpoint instead
Expand Down
Loading

0 comments on commit 4831b98

Please sign in to comment.