-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Admin Approver expenses/check policy/check mandatory bulk APIs #788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| post: | ||
| tags: | ||
| - Expenses | ||
| summary: Update expenses in bulk | ||
| description: | | ||
| Update expenses in bulk by admin. | ||
| operationId: admin_expenses_post_bulk | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| data: | ||
| $ref: '../../components/schemas/expense.yaml#/admin_expenses_bulk_in' | ||
| responses: | ||
| '200': | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| properties: | ||
| data: | ||
| type: array | ||
| items: | ||
| $ref: '../../components/schemas/expense.yaml#/expense_out' | ||
| '400': | ||
|
Comment on lines
+21
to
+29
|
||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/400.yaml' | ||
| '401': | ||
| description: Unauthorized request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/401.yaml' | ||
| '403': | ||
| description: Forbidden | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/403.yaml' | ||
| '404': | ||
| description: Not Found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/404.yaml' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| post: | ||
| tags: | ||
| - Expenses | ||
| summary: Check multiple expenses for missing mandatory fields in bulk | ||
| description: | | ||
| Before updating multiple expense objects as an admin, you can validate | ||
| if all mandatory fields are present using this bulk endpoint. | ||
| operationId: admin_check_mandatory_fields_bulk_post | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: '../../components/schemas/expense.yaml#/admin_expense_check_mandatory_fields_bulk_in' | ||
| responses: | ||
| '200': | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: ../../components/schemas/expense.yaml#/expense_check_mandatory_fields_bulk_out | ||
| '401': | ||
| description: Unauthorised request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/401.yaml' | ||
| '400': | ||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/400.yaml' | ||
| '403': | ||
| description: Forbidden | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/403.yaml' | ||
| '404': | ||
| description: Not Found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/404.yaml' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| post: | ||
| tags: | ||
| - Expenses | ||
| summary: Check multiple expenses for policy violations in bulk | ||
| description: | | ||
| Admin bulk version of the check_policies API that allows checking | ||
| multiple expenses for policy violations in one request. | ||
|
|
||
| **NOTE:** This API can only be used to check policies for existing expenses that you want to update. The API will evaluate all the expenses against the configured policy rules and return an array of policy violation information for each expense in the request payload. | ||
| operationId: admin_check_policies_bulk_post | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: "../../components/schemas/expense.yaml#/admin_check_policies_bulk_in" | ||
| responses: | ||
| "200": | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| properties: | ||
| data: | ||
| $ref: ../../components/schemas/expense.yaml#/expense_check_policies_bulk_out | ||
| "401": | ||
| description: Unauthorised request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/401.yaml" | ||
| "400": | ||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/400.yaml" | ||
| "404": | ||
| description: Not Found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/404.yaml" |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||||||||||
| post: | ||||||||||||||||||||||
| tags: | ||||||||||||||||||||||
| - Expenses | ||||||||||||||||||||||
| summary: Update expenses in bulk | ||||||||||||||||||||||
| description: | | ||||||||||||||||||||||
| Update expenses in bulk by approver. | ||||||||||||||||||||||
|
||||||||||||||||||||||
| Update expenses in bulk by approver. | |
| Update multiple expenses in bulk by approver. | |
| Each expense in the request is validated independently and must satisfy the | |
| same approver authorization, allowed expense-state, and update constraints | |
| as the single-expense approver update endpoint. Only expenses that are | |
| eligible for the requested update can be processed through this operation. | |
| Clients should apply the same validation rules used for the single-expense | |
| approver update flow to every item included in the bulk payload. |
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The request schema doesn’t mark data as required and doesn’t set additionalProperties: false, so an empty object {} (or unexpected fields) would still validate. Other bulk endpoints under Expenses (e.g., attach_files bulk) require data and disallow additional properties; consider aligning this endpoint to avoid an overly-permissive contract.
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 200-response schema is missing additionalProperties: false (and doesn’t require data), making the documented response shape more permissive than other bulk Expenses endpoints. Consider tightening the response schema for consistency and better client generation.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| post: | ||
| tags: | ||
| - Expenses | ||
| summary: Check multiple expenses for missing mandatory fields in bulk | ||
| description: | | ||
| Before updating multiple expense objects as an approver, you can validate | ||
| if all mandatory fields are present using this bulk endpoint. | ||
| operationId: approver_check_mandatory_fields_bulk_post | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: '../../components/schemas/expense.yaml#/approver_expense_check_mandatory_fields_bulk_in' | ||
| responses: | ||
| '200': | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: ../../components/schemas/expense.yaml#/expense_check_mandatory_fields_bulk_out | ||
| '401': | ||
| description: Unauthorised request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/401.yaml' | ||
| '400': | ||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/400.yaml' | ||
| '403': | ||
| description: Forbidden | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/403.yaml' | ||
| '404': | ||
| description: Not Found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '../../components/schemas/404.yaml' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| post: | ||
| tags: | ||
| - Expenses | ||
| summary: Check multiple expenses for policy violations in bulk | ||
| description: | | ||
| Approver bulk version of the check_policies API that allows checking | ||
| multiple expenses for policy violations in one request. | ||
|
|
||
| **NOTE:** This API can only be used to check policies for existing expenses that you want to update. The API will evaluate all the expenses against the configured policy rules and return an array of policy violation information for each expense in the request payload. | ||
| operationId: approver_check_policies_bulk_post | ||
| requestBody: | ||
| required: true | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| required: | ||
| - data | ||
| properties: | ||
| data: | ||
| $ref: "../../components/schemas/expense.yaml#/approver_check_policies_bulk_in" | ||
| responses: | ||
| "200": | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: object | ||
| additionalProperties: False | ||
| properties: | ||
| data: | ||
| $ref: ../../components/schemas/expense.yaml#/expense_check_policies_bulk_out | ||
| "401": | ||
| description: Unauthorised request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/401.yaml" | ||
| "400": | ||
| description: Bad request | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/400.yaml" | ||
| "404": | ||
| description: Not Found | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: "../../components/schemas/404.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The request schema doesn’t mark
dataas required and doesn’t setadditionalProperties: false, so an empty object{}(or unexpected fields) would still validate. Other bulk endpoints under Expenses (e.g., attach_files bulk) requiredataand disallow additional properties; consider aligning this endpoint to avoid an overly-permissive contract.