From 4831b9805a3328a22df34f533a9f32adbc8d34cb Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sun, 22 Dec 2024 14:08:20 +0100 Subject: [PATCH] fix openapi specs Signed-off-by: Julien Veyssier --- appinfo/routes.php | 64 +++++++++++++------------ lib/Controller/ApiController.php | 20 ++++---- lib/Controller/FederationController.php | 2 +- lib/Controller/PublicApiController.php | 16 +++---- lib/ResponseDefinitions.php | 25 +++++----- openapi-federation.json | 43 ++++++++--------- openapi-full.json | 50 ++++++++----------- openapi.json | 43 ++++++++--------- 8 files changed, 125 insertions(+), 138 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index cbd4c5a16..7dc37b147 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -12,6 +12,10 @@ $requirements = [ 'apiVersion' => '(v1)', +]; + +$publicRequirements = [ + 'apiVersion' => '(v1)', 'token' => '^[a-zA-Z0-9]{4,64}$', ]; @@ -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], @@ -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], @@ -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], ], ]; diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 13388004f..0b19bf0df 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -144,7 +144,7 @@ public function createProject(string $id, string $name): DataResponse { /** * Get local project list * - * @return DataResponse + * @return DataResponse, array{}> * @throws Exception * * 200: Project list @@ -344,7 +344,7 @@ public function autoSettlement(string $projectId, ?int $centeredOn = null, int $ * * @param string $projectId * @param int|null $lastChanged - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * * 200: List of members */ @@ -509,7 +509,7 @@ public function editBill( * Edit multiple bills * * @param string $projectId - * @param array $billIds + * @param list $billIds * @param int|null $categoryId * @param string|null $date * @param string|null $what @@ -525,7 +525,7 @@ public function editBill( * @param string|null $comment * @param int|null $repeatFreq * @param int|null $deleted - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * @throws Exception */ #[NoAdminRequired] @@ -613,7 +613,7 @@ public function moveBill(string $projectId, int $billId, string $toProjectId): D * * @param string $projectId * @param int $billId - * @return DataResponse, array{}>|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> */ #[NoAdminRequired] #[CospendUserPermissions(minimumLevel: Application::ACCESS_LEVEL_PARTICIPANT)] @@ -730,7 +730,7 @@ public function deleteBill(string $projectId, int $billId, bool $moveToTrash = t * Delete multiple bills * * @param string $projectId - * @param array $billIds + * @param list $billIds * @param bool $moveToTrash * @return DataResponse|DataResponse, array{}> * @throws DoesNotExistException @@ -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|DataResponse, array{}> + * @return DataResponse, timestamp: int, bills: list}, array{}>|DataResponse, array{}> */ #[NoAdminRequired] #[CospendUserPermissions(minimumLevel: Application::ACCESS_LEVEL_VIEWER)] @@ -951,7 +951,7 @@ public function editPaymentMode( * Save payment modes order * * @param string $projectId - * @param array $order Array of objects, each object contains the order number and the payment mode ID + * @param list $order Array of objects, each object contains the order number and the payment mode ID * @return DataResponse|DataResponse, array{}> * @throws DoesNotExistException * @throws Exception @@ -1064,7 +1064,7 @@ public function editCategory( * Save categories order * * @param string $projectId - * @param array $order + * @param list $order * @return DataResponse|DataResponse, array{}> * @throws DoesNotExistException * @throws Exception @@ -1703,7 +1703,7 @@ public function importSWProject(string $path): DataResponse { * * Used by MoneyBuster to check if weblogin is valid * - * @return DataResponse, array{}> + * @return DataResponse, array{}> */ #[NoAdminRequired] public function ping(): DataResponse { diff --git a/lib/Controller/FederationController.php b/lib/Controller/FederationController.php index 43de26dae..743c43f70 100644 --- a/lib/Controller/FederationController.php +++ b/lib/Controller/FederationController.php @@ -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, array{}>|DataResponse + * @return DataResponse, array{}>|DataResponse * * 200: Invite declined successfully * 400: Invite was already accepted, use the "Remove the current user from a room" endpoint instead diff --git a/lib/Controller/PublicApiController.php b/lib/Controller/PublicApiController.php index b1cf7d410..4de27d432 100644 --- a/lib/Controller/PublicApiController.php +++ b/lib/Controller/PublicApiController.php @@ -157,7 +157,7 @@ public function publicDeleteBill(string $token, int $billId, bool $moveToTrash = * Delete multiple bills * * @param string $token - * @param array $billIds + * @param list $billIds * @param bool $moveToTrash * @return DataResponse|DataResponse, array{}> * @throws DoesNotExistException @@ -390,7 +390,7 @@ public function publicEditBill( * Edit multiple bills * * @param string $token - * @param array $billIds + * @param list $billIds * @param int|null $categoryId * @param string|null $date * @param string|null $what @@ -406,7 +406,7 @@ public function publicEditBill( * @param string|null $comment * @param int|null $repeatFreq * @param int|null $deleted - * @return DataResponse|DataResponse, array{}> + * @return DataResponse, array{}>|DataResponse, array{}> * @throws DoesNotExistException * @throws Exception * @throws MultipleObjectsReturnedException @@ -456,7 +456,7 @@ public function publicEditBills( * * @param string $token * @param int $billId - * @return DataResponse, array{}>|DataResponse + * @return DataResponse, array{}>|DataResponse */ #[NoAdminRequired] #[PublicPage] @@ -583,7 +583,7 @@ public function publicCreateBill( * @param int|null $includeBillId * @param string|null $searchTerm * @param int|null $deleted - * @return DataResponse + * @return DataResponse, timestamp: int, bills: list}, array{}> * @throws Exception */ #[NoAdminRequired] @@ -650,7 +650,7 @@ public function publicGetBill(string $token, int $billId): DataResponse { * * @param string $token * @param int|null $lastChanged - * @return DataResponse + * @return DataResponse, array{}> */ #[NoAdminRequired] #[PublicPage] @@ -815,7 +815,7 @@ public function publicEditPaymentMode( * Save payment modes order * * @param string $token - * @param array $order + * @param list $order * @return DataResponse * @throws DoesNotExistException * @throws Exception @@ -914,7 +914,7 @@ public function publicEditCategory( * Save categories order * * @param string $token Project share token - * @param array $order Array describing the categories ordering + * @param list $order Array describing the categories ordering * @return DataResponse|DataResponse, array{}> * * 200: Categories order is saved diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 0af625721..36a21fc88 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -26,9 +26,10 @@ namespace OCA\Cospend; +// @psalm-type CospendShareType = 'l'|'u'|'g'|'c' + /** * @psalm-type CospendAccessLevel = 0|1|2|3|4 - * @psalm-type CospendShareType = 'l'|'u'|'g'|'c' * @psalm-type CospendFrequency = 'n'|'d'|'w'|'b'|'s'|'m'|'y' * * @psalm-type CospendMember = array{ @@ -72,7 +73,7 @@ * password: ?string, * } * - * @psalm-type CospendShare = array + * @psalm-type CospendShare = CospendUserShare|CospendGroupShare|CospendCircleShare|CospendPublicShare * * @psalm-type CospendCurrency = array{ * id: int, @@ -97,16 +98,16 @@ * } * * @psalm-type CospendExtraProjectInfo = array{ - * active_members: CospendMember[], - * members: CospendMember[], - * balance: array, + * active_members: list, + * members: list, + * balance: array, * nb_bills: int, * total_spent: float, * nb_trashbin_bills: int, - * shares: CospendShare[], - * currencies: CospendCurrency[], - * categories: CospendCategoryOrPaymentMode[], - * paymentmodes: CospendCategoryOrPaymentMode[], + * shares: list, + * currencies: list, + * categories: array, + * paymentmodes: array, * } * * @psalm-type CospendPublicProjectInfo = array{ @@ -151,8 +152,8 @@ * timestamp: int, * date: string, * payer_id: int, - * owers: CospendOwer[], - * owerIds: int[], + * owers: list, + * owerIds: list, * repeat: CospendFrequency, * paymentmode: string, * paymentmodeid: int, @@ -165,7 +166,7 @@ * } * * @psalm-type CospendProjectSettlement = array{ - * transactions: ?array, + * transactions: ?list, * balances: array, * } * diff --git a/openapi-federation.json b/openapi-federation.json index f73aff23b..a6dc76d2b 100644 --- a/openapi-federation.json +++ b/openapi-federation.json @@ -165,8 +165,8 @@ } }, "balance": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "type": "number", "format": "double" } @@ -196,14 +196,14 @@ } }, "categories": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } }, "paymentmodes": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } } @@ -514,23 +514,20 @@ ] }, "Share": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/UserShare" - }, - { - "$ref": "#/components/schemas/GroupShare" - }, - { - "$ref": "#/components/schemas/CircleShare" - }, - { - "$ref": "#/components/schemas/PublicShare" - } - ] - } + "anyOf": [ + { + "$ref": "#/components/schemas/UserShare" + }, + { + "$ref": "#/components/schemas/GroupShare" + }, + { + "$ref": "#/components/schemas/CircleShare" + }, + { + "$ref": "#/components/schemas/PublicShare" + } + ] }, "UserShare": { "allOf": [ diff --git a/openapi-full.json b/openapi-full.json index 7baa01880..70b6b28aa 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -264,8 +264,8 @@ } }, "balance": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "type": "number", "format": "double" } @@ -295,14 +295,14 @@ } }, "categories": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } }, "paymentmodes": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } } @@ -745,31 +745,19 @@ ] }, "Share": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/UserShare" - }, - { - "$ref": "#/components/schemas/GroupShare" - }, - { - "$ref": "#/components/schemas/CircleShare" - }, - { - "$ref": "#/components/schemas/PublicShare" - } - ] - } - }, - "ShareType": { - "type": "string", - "enum": [ - "l", - "u", - "g", - "c" + "anyOf": [ + { + "$ref": "#/components/schemas/UserShare" + }, + { + "$ref": "#/components/schemas/GroupShare" + }, + { + "$ref": "#/components/schemas/CircleShare" + }, + { + "$ref": "#/components/schemas/PublicShare" + } ] }, "UserShare": { diff --git a/openapi.json b/openapi.json index e1f271cc2..fa02caa75 100644 --- a/openapi.json +++ b/openapi.json @@ -264,8 +264,8 @@ } }, "balance": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "type": "number", "format": "double" } @@ -295,14 +295,14 @@ } }, "categories": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } }, "paymentmodes": { - "type": "array", - "items": { + "type": "object", + "additionalProperties": { "$ref": "#/components/schemas/CategoryOrPaymentMode" } } @@ -704,23 +704,20 @@ ] }, "Share": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/UserShare" - }, - { - "$ref": "#/components/schemas/GroupShare" - }, - { - "$ref": "#/components/schemas/CircleShare" - }, - { - "$ref": "#/components/schemas/PublicShare" - } - ] - } + "anyOf": [ + { + "$ref": "#/components/schemas/UserShare" + }, + { + "$ref": "#/components/schemas/GroupShare" + }, + { + "$ref": "#/components/schemas/CircleShare" + }, + { + "$ref": "#/components/schemas/PublicShare" + } + ] }, "UserShare": { "allOf": [