Skip to content

Other costs accept array#520

Merged
iDome89 merged 3 commits intoUN-2274-other-costsfrom
other-costs-accept-array
Feb 3, 2026
Merged

Other costs accept array#520
iDome89 merged 3 commits intoUN-2274-other-costsfrom
other-costs-accept-array

Conversation

@Kariamos
Copy link
Contributor

@Kariamos Kariamos commented Feb 3, 2026

This pull request updates the PATCH endpoint for /campaigns/:campaignId/finance/otherCosts to support bulk updates of multiple cost items in a single request. The OpenAPI documentation and test suite have been updated to reflect and validate the new array-based request and response structure. Validation and error handling are now performed per item, with improved error messages for batch operations.

Bulk Update Support and Validation Improvements:

  • The PATCH endpoint now expects and returns an array of cost items, enabling bulk updates in a single request. The OpenAPI schema and example payloads have been updated accordingly. [1] [2] [3] [4] [5] [6]
  • Validation logic has been enhanced to check that the request body is a non-empty array, and to validate each item individually, returning specific error messages that indicate the index of the invalid item (e.g., "Item 1: cost_id must be a positive number"). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Test Suite Updates:

  • The test payloads have been refactored to use arrays, and new tests have been added to cover scenarios such as sending a non-array body, empty arrays, and updating multiple costs in a single request. [1] [2] [3]
  • Tests now verify that the response is an array of updated items, and that error messages are specific to the item index in batch operations. [1] [2] [3] [4] [5]

These changes ensure the API is more flexible and robust for clients needing to update multiple cost items at once, with clearer feedback on any validation issues.

@Kariamos Kariamos added the core Team Core activity label Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Tests difference:

New Tests

< Input Validation - Should return 400 if array is empty
< Input Validation - Should return 400 if body is not an array
< Success - admin permissions - Should create multiple costs in single request
< Success - admin permissions - Should update multiple costs in single request
< Validation errors - Should return 400 for second item with invalid data
< Validation errors - Should return 400 if body is an empty array
< Validation errors - Should return 400 if body is not an array

@iDome89 iDome89 marked this pull request as ready for review February 3, 2026 16:11
@iDome89 iDome89 merged commit 26d19f4 into UN-2274-other-costs Feb 3, 2026
5 checks passed
@iDome89 iDome89 deleted the other-costs-accept-array branch February 3, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Team Core activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants