fix: align bulk delete error contracts - #854
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Admin OpenAPI spec to standardize bulk delete error response schemas by introducing reusable error schema components and referencing them from several bulk delete and bulk delete-summary endpoints.
Changes:
- Added
invalid_usage_errorandbulk_action_errorschema components for consistent error modeling. - Updated multiple Admin bulk delete endpoints to reference the shared error schemas instead of inline error objects.
- Regenerated
reference/admin.yamlto reflect the updated component schemas and endpoint responses.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/schemas/invalid_usage_error.yaml | Adds a reusable schema for InvalidUsage errors. |
| src/components/schemas/bulk_action_error.yaml | Adds a reusable oneOf schema covering InvalidUsage and BulkError response bodies. |
| src/admin/paths/admin@per_diem_rates@delete@bulk.yaml | Switches 400/403 error schemas to shared components for bulk delete. |
| src/admin/paths/admin@per_diem_rates@delete_summary@bulk.yaml | Adds 400 error schema and updates 403 schema reference to shared components. |
| src/admin/paths/admin@mileage_rates@delete@bulk.yaml | Switches 400/403 error schemas to shared components for bulk delete. |
| src/admin/paths/admin@mileage_rates@delete_summary@bulk.yaml | Switches 400/403 error schemas to shared components for delete summary. |
| src/admin/paths/admin@levels@delete@bulk.yaml | Switches 400/403 error schemas to shared components for bulk delete. |
| src/admin/paths/admin@levels@delete_summary@bulk.yaml | Switches 400/403 error schemas to shared components for delete summary. |
| src/admin/paths/admin@departments@delete@bulk.yaml | Switches 400/403 error schemas to shared components for bulk delete. |
| src/admin/paths/admin@departments@delete_summary@bulk.yaml | Switches 400/403 error schemas to shared components for delete summary. |
| src/admin/paths/admin@cost_centers@delete@bulk.yaml | Switches 400/403 error schemas to shared components for bulk delete. |
| src/admin/paths/admin@cost_centers@delete_summary@bulk.yaml | Adds 400 error schema and updates 403 schema reference to shared components. |
| reference/admin.yaml | Updates the bundled Admin reference spec to include the new components and updated endpoint schemas. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (11)
src/admin/paths/admin@cost_centers@delete@bulk.yaml:40
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@per_diem_rates@delete@bulk.yaml:40
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@mileage_rates@delete@bulk.yaml:65
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@levels@delete@bulk.yaml:65
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@departments@delete@bulk.yaml:65
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@cost_centers@delete_summary@bulk.yaml:47
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@per_diem_rates@delete_summary@bulk.yaml:47
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@mileage_rates@delete_summary@bulk.yaml:57
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@levels@delete_summary@bulk.yaml:57
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/admin/paths/admin@departments@delete_summary@bulk.yaml:58
- This
403response is documented as "Forbidden" but now referencesinvalid_usage_error(error=InvalidUsage). That conflicts with the existing403.yamlcontract (message=Forbidden) and makes it unclear what payload clients should expect. Consider documenting both shapes for 403 viaoneOf(Forbidden vs InvalidUsage).
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '../../components/schemas/invalid_usage_error.yaml'
src/components/schemas/invalid_usage_error.yaml:18
messageis used asnullable: truein existing InvalidUsage error payload docs (e.g.,src/admin/paths/admin@projects@delete@bulk.yaml:48-58), but this new shared schema makesmessagenon-nullable. That would make the shared contract stricter than other endpoints and may rejectnullmessages.
message:
type: string
description: Human-readable description of why the action was rejected.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/components/schemas/invalid_usage_error.yaml:18
- Most existing InvalidUsage/400-style error schemas in this repo allow
messageto be nullable (e.g.,src/components/schemas/400.yaml). Makingmessagenon-nullable here is a stricter contract and may break clients if the API ever returnsmessage: nullfor InvalidUsage errors.
message:
type: string
description: Human-readable description of why the action was rejected.
src/components/schemas/bulk_action_forbidden_error.yaml:2
- Using
oneOfhere can become invalid if an error payload happens to satisfy both referenced schemas (e.g., a payload shaped likeinvalid_usage_errorwith message "Forbidden" would also validate against403.yamlbecause it doesn't forbid extra properties). Switching toanyOfavoids runtime schema-validation failures while still expressing that either shape may be returned.
oneOf:
Summary
Validation
ClickUp
https://app.clickup.com/