[DGR-4735] Document the 422 for credential recipient assignment - #139
Open
sandilya91 wants to merge 1 commit into
Open
[DGR-4735] Document the 422 for credential recipient assignment#139sandilya91 wants to merge 1 commit into
sandilya91 wants to merge 1 commit into
Conversation
Creating a Credential can fail validation with a `user` error of "Could not assign user to the credential", raised when we cannot attach a recipient account to the Credential. Neither creation endpoint documented a 422 at all, so integrators had nothing to code against. Adds the 422 to POST /v1/credentials and POST /v1/credentials/bulk_create, covering both shapes `errors` actually takes on each: attribute-keyed validation messages (an object for single create, an array with one entry per failed Credential for bulk) or a single message string when the request could not be processed at all. The description calls out that the advisory-lock timeout behind this error is transient, so retrying is the right response. Implements ISD-3046. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sandilya91
marked this pull request as ready for review
August 5, 2026 13:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
POST /v1/credentialsandPOST /v1/credentials/bulk_createcan fail with a 422 ("Could not assign user to the credential", raised by theCredential#assign_userhook when recipient-account creation fails or two requests race on the samerecipient_email), but neither endpoint documented any 422, so integrators had nothing to code against. This documents the 422 on both, including that the lock-race case is transient and worth retrying. Implements DGR-4735 / ISD-3046.Review notes
errorsis modelled as aoneOfbecause the code genuinely returns two shapes: an attribute-keyed object (the ticket's case) or a plain string from the rescue branches. Both shapes already appear in the spec's global Errors section.PUT /v1/credentials/{id}returns400, not422, for the same error, and documents no error responses at all. Wider gap than this ticket.422onPOST /v2/credentials/bulk_createdoesn't matchServices::CredentialBulkCreateSerializer(errorswithmessagevserrorwithreason). Pre-existing.Testing
redocly lintvsdevelop: errors unchanged at 135, warnings 159 → 157. The two resolved warnings are exactly theoperation-4xx-responsewarnings for these two operations.