Skip to content

Adopt the Commonalities r4.4 error response catalogue in sim-swap and sim-swap-subscriptions #296

Description

@hdamker

Problem description

With Commonalities r4.3, both APIs reference generic error responses that include codes which do not apply to them. Most visible in sim-swap-subscriptions (via Generic* from CAMARA_common.yaml and CreateSubscriptionUnprocessableEntity422 from CAMARA_event_common.yaml):

  • POST /subscriptions 409: the deprecated CONFLICT next to INCOMPATIBLE_STATE
  • POST /subscriptions 422: MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED and MULTIEVENT_COMBINATION_TEMPORARILY_NOT_SUPPORTED, although types has maxItems: 1; UNSUPPORTED_IDENTIFIER, which does not apply to a phone number as the only identifier
  • GET/DELETE operations 403: INVALID_TOKEN_CONTEXT
  • GET/DELETE /subscriptions/{subscriptionId} 404: IDENTIFIER_NOT_FOUND

sim-swap references Generic400, Generic401, Generic404 and Generic429 from CAMARA_common.yaml and defines Generic403 and Generic422 locally.

Commonalities r4.4 (0.9.0) deprecates all Generic* responses and CreateSubscriptionUnprocessableEntity422, with removal planned for the next meta-release cycle, and provides a catalogue of minimal error responses that contain only codes every referencing API can return. API-specific code sets are defined locally from the shared examples. See the "CAMARA error responses — catalogue" and "DEPRECATED error responses" sections in CAMARA_common.yaml r4.4 and the r4.4 subscription API template.

Expected behavior

Update release-plan.yaml to commonalities_release: r4.4, merge the common files sync, and replace the error response references as follows.

sim-swap (/check and /retrieve-date):

Status Current r4.4 Effect on codes
400 (/check) Generic400 BadRequestWithRange400 unchanged (INVALID_ARGUMENT, OUT_OF_RANGE for maxAge)
400 (/retrieve-date) Generic400 BadRequest400 OUT_OF_RANGE removed (no range-restricted field)
401 Generic401 Unauthenticated401 unchanged
403 local Generic403 PermissionDenied403 unchanged, local definition removed
404 Generic404 IdentifierNotFound404 NOT_FOUND removed
422 local Generic422 PhoneNumberIdentifier422 unchanged, local definition removed, examples in phone number wording
429 Generic429 TooManyRequests429 QUOTA_EXCEEDED removed

sim-swap-subscriptions:

Operation Status Current r4.4 Effect on codes
POST /subscriptions 400 CreateSubscriptionBadRequest400 unchanged —
401 Generic401 Unauthenticated401 unchanged
403 SubscriptionPermissionDenied403 unchanged —
409 Generic409 CreateSubscriptionConflict409 CONFLICT, INCOMPATIBLE_STATE removed
422 CreateSubscriptionUnprocessableEntity422 local definition from the shared examples: SERVICE_NOT_APPLICABLE, MISSING_IDENTIFIER, UNNECESSARY_IDENTIFIER, PRIVATE_KEY_JWT_NOT_CONFIGURED UNSUPPORTED_IDENTIFIER, MULTIEVENT_* removed
429 Generic429 TooManyRequests429 QUOTA_EXCEEDED removed
GET /subscriptions 400 Generic400 BadRequest400, or BadRequestWithRange400 if OUT_OF_RANGE is returned for page/perPage OUT_OF_RANGE removed with BadRequest400
401 Generic401 Unauthenticated401 unchanged
403 Generic403 PermissionDenied403 INVALID_TOKEN_CONTEXT removed
GET/DELETE /subscriptions/{subscriptionId} 400 SubscriptionIdRequired400 unchanged —
401 Generic401 Unauthenticated401 unchanged
403 Generic403 PermissionDenied403 INVALID_TOKEN_CONTEXT removed
404 Generic404 NotFound404 IDENTIFIER_NOT_FOUND removed
Notification callback 400 / 401 / 403 / 410 / 429 Generic400 / Generic401 / Generic403 / Generic410 / Generic429 BadRequest400 / Unauthenticated401 / PermissionDenied403 / SinkGone410 / TooManyRequests429 OUT_OF_RANGE (400) and QUOTA_EXCEEDED (429) removed

CreateSubscriptionPhoneNumber422 from CAMARA_event_common.yaml would keep the two MULTIEVENT_* codes, hence the local 422 definition for POST /subscriptions.

To decide:

  • QUOTA_EXCEEDED: if providers need it, define the 429 responses locally from GENERIC_429_TOO_MANY_REQUESTS and GENERIC_429_QUOTA_EXCEEDED.
  • SUBSCRIPTION_MISMATCH on POST /subscriptions 403 (from SubscriptionPermissionDenied403): it was removed in r3.2 ([Sim-Swap-Subscriptions]: remove SUBSCRIPTION_MISMATCH error-code #209). If that decision still holds, define the 403 locally with PERMISSION_DENIED only.

Test definitions to align:

  • sim-swap-subscriptions.feature, scenario @sim_swap_subscription_creation_100_not_applicable expects 422 UNSUPPORTED_IDENTIFIER for a phone number that does not support SIM swap subscriptions; with the phone number variant this is SERVICE_NOT_APPLICABLE.
  • Check that no scenario asserts a removed code (currently none found for CONFLICT, INCOMPATIBLE_STATE, INVALID_TOKEN_CONTEXT, QUOTA_EXCEEDED, NOT_FOUND in sim-swap, IDENTIFIER_NOT_FOUND in sim-swap-subscriptions).

Alternative solution

Keep the r4.3 references and define all trimmed responses locally. This duplicates definitions that the r4.4 catalogue already provides, and the deprecated Generic* responses are planned for removal.

Additional context

Found during the release review of r4.1 (#293). Removing codes from error responses does not break API consumers. The operation changes were checked with oasdiff changelog after replacing the references and syncing the r4.4 common files; the notification callback row is based on reading the response definitions.

Related: #288 (items 1 and 2: error code consistency and device vs. phone number wording between the two APIs).

Activity

  1. hdamker commented on Oct 1, 2026

    @hdamker
    CollaboratorAuthor

    Additions after comparing with #288:

    • The local 422 definition for POST /subscriptions should reference the phone number variants of the shared examples: GENERIC_422_SERVICE_NOT_APPLICABLE, GENERIC_422_MISSING_IDENTIFIER_PHONE_NUMBER and GENERIC_422_UNNECESSARY_IDENTIFIER_PHONE_NUMBER, plus GENERIC_422_PRIVATE_KEY_JWT_NOT_CONFIGURED from CAMARA_event_common.yaml. Together with PhoneNumberIdentifier422 in sim-swap, this aligns the 422 example messages of both APIs on phone number wording.
    • Syncing the r4.4 common files also adds the GENERIC_400_INVALID_TOKEN example to CreateSubscriptionBadRequest400. In r4.3 the code is listed without an example.
    • Removing INVALID_TOKEN_CONTEXT from the sim-swap-subscriptions 403 responses matches its info.description, which specifies 422 UNNECESSARY_IDENTIFIER when the phone number is also identified from the access token. Per the CAMARA API Design Guide r4.4, 403 INVALID_TOKEN_CONTEXT applies only when the API scope allows explicit confirmation whether the identifiers match.

    With this, the PR for this issue resolves items 1 and 3 of #288 and the example wording part of item 2. Items 4–6 and the "device" wording in the info.description of sim-swap-subscriptions remain in #288.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    correctionSomething needs to be corrected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions