Repository navigation
Conversation
Decisions: - Describe each 422 by the body the API renders: a string, an array, or per-attribute strings, where the documents claimed per-attribute arrays - Add the 422s that deleting an account access, listing campaigns and deleting a domain return but did not list - Split start/schedule from cancel/terminate/reset: only the first two return sending-validation errors, and no action returns a plain array - Keep the per-attribute response component for API token reset, which still renders that shape - from_display_name is null for a campaign without a sender name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueNo actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review |
Action performed
|
Decisions: - Start and schedule 422 is a oneOf of the existing single-message and per-attribute schemas, as the API token create 422 is, instead of a third schema that copied both. - The bulk permission, API token and sub-account 422 descriptions now name every cause the API returns them for: an invalid access level, an update that leaves no permissions, an organization scheduled for deletion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Motivation
Several error responses in the Account Management, Email Campaigns and Email Sending references don't match what the API returns. Some 422 bodies have a different
errorsshape, three operations don't list their 422 at all, and a campaign'sfrom_display_namecan benull. Clients generated from these documents decode those responses wrongly.Changes
errorsas a single message.oneOfwith an example of each.errorsas an array of messages.datetime) or sending-validation messages per attribute, campaign-wide ones underbase. The documented array never occurs.token, as listing templates already does.from_display_nameisnullfor a campaign without a sender name.emailorbase), not arrays.This touches the same
responses:blocks as #71 and sits next to the code samples #69 edits; whichever lands second rebases.How to test
You'll need an admin API token for an account with a sending domain and email campaigns, and an organization API token for the sub-account checks. Each response below should match what the API reference now documents for that operation.
Account Management
PUT /api/account_accesses/{owner_access_id}/permissions/bulkwith any permission. Expect422,{"errors":"You can't update the permissions of an account owner"}.POST /api/api_tokenswith an emptyresourceslist. Expect422,{"errors":{"base":["No permissions selected. Please choose at least one."]}}.POST /api/api_tokenswith{"resource_type":"project","resource_id":<missing id>,"access_level":100}inresources. Expect422,{"errors":"Resource of type 'project' and ID #<id> not found"}.DELETE /api/account_accesses/{owner_access_id}. Expect422,{"errors":"You can not remove the owner of the account"}.POST /api/organizations/{organization_id}/sub_accountsfor an organization at its sub-account limit. Expect422,{"errors":["Accounts limit reached"]}. A name over 80 characters returns{"errors":["Failed to create account."]}.Email Campaigns
POST /api/email_campaigns/{id}/starton a draft of an account with no company information. Expect422with the message undererrors.baseas an array.422,{"errors":"Cannot transition from 'started' to 'scheduled'"}.POST /api/email_campaigns/{id}/schedulegive the same two shapes.{"errors":"Campaign is not scheduled"}.GET /api/email_campaigns?per_page=100&token=100000000000000000. Expect422,{"errors":"token is out of range"}.GET /api/email_campaigns/{id}for a campaign created withoutfrom_display_name. Expect200with"from_display_name": null.Email Sending
POST /api/domains/{domain_id}/send_setup_instructionswith{"email":"invalid"}. Expect422,{"errors":{"email":"Invalid email address"}}.DELETE /api/domains/{domain_id}for a domain an inbound inbox depends on. Expect422,{"errors":{"base":["Can't delete the domain because there are inbound inboxes depending on it."]}}.Summary by CodeRabbit
422error cases for account management, including permission changes, token creation, and sub-account creation.