Skip to content

Remove irrelevant/undocumented-by-default error codes per issue #72 - #78

Open
DLondonoD wants to merge 3 commits into
camaraproject:mainfrom
DLondonoD:fix/issue-72
Open

Remove irrelevant/undocumented-by-default error codes per issue #72#78
DLondonoD wants to merge 3 commits into
camaraproject:mainfrom
DLondonoD:fix/issue-72

Conversation

@DLondonoD

Copy link
Copy Markdown
Contributor

What type of PR is this?

correction

What this PR does / why we need it:

Reviews and trims the documented error response codes per the Commonalities Design Guide section on [Standardized Use
of CAMARA Error Responses](https://github.com/camaraproject/Commonalities/blob/r4.3/documentation/CAMARA-API-Design-
Guide.md#321-standardized-use-of-camara-error-responses):

  • Removed 500/503 from all 15 operations. Per the guide, 5xx statuses are not documented by default unless
    a relevant use case justifies them; this API had none beyond generic boilerplate. The callback 410/429 responses are
    kept, since they are explicitly justified by the notification flow.
  • Restricted 400 to only INVALID_ARGUMENT, dropping OUT_OF_RANGE — no field in this API has a pre-defined
    numeric/date range or filter-combination constraint that this code would apply to.
  • Restricted 403 to only PERMISSION_DENIED, dropping INVALID_TOKEN_CONTEXT — this code requires validating
    that an identity in the request body matches the one bound to a 3-legged access token; this is a B2B management API with
    no such per-request identity binding.
  • Restricted 404 to only NOT_FOUND, dropping IDENTIFIER_NOT_FOUND — this code is specific to device-
    identification (per the guide's own example); this API never identifies a "device", only
    apps/instances/deployments/clusters/zones, already covered by NOT_FOUND.
  • Introduced local, API-scoped Generic400/Generic403/Generic404 response objects (replacing the direct $ref to
    CAMARA_common.yaml's generic ones, which include the broader set of codes) to enforce the above restrictions.
  • 401 (UNAUTHENTICATED only) and 409 (already using API-specific ALREADY_EXISTS/INCOMPATIBLE_STATE/ABORTED
    examples, never the deprecated CONFLICT) were already correct and left untouched.

As a follow-up check, verified every .feature test file's tested status codes against what its operation actually
documents in the spec, and found (and removed) 3 more phantom 404 test scenarios on collection-list operations
(getApps, getAppDeployments, getClusters) that only accept optional query filters — per REST/CAMARA semantics
these should return 200 with an empty list when nothing matches, not 404. One of them was leftover from PR #56,
which had already removed the 404 from the operation's YAML without syncing the test.

Which issue(s) this PR fixes:

Fixes #72

Special notes for reviewers:

No behavioral/runtime change to success paths — this only removes error responses that were either never justified for
this API's design or already superseded elsewhere, aligning both the OAS definition and its .feature test coverage
with the Design Guide.

Changelog input

release-note Remove undocumented-by-default 5xx responses and API-irrelevant error codes (OUT_OF_RANGE,
INVALID_TOKEN_CONTEXT, IDENTIFIER_NOT_FOUND) per the CAMARA Design Guide's error response guidance.

Additional documentation

This section can be blank.

docs

…aproject#72

Per CAMARA API Design Guide 3.2.1, error statuses 5xx are not
documented by default in the API specification unless a relevant use
case justifies it. This API has no such use case for the operation-level
500/503 responses (they were the plain generic server-error boilerplate),
so all 15 operations' 500/503 responses are removed.

Callback 410/429 responses are kept, since they are justified by the
notification/callback flow context per the same guideline and the
CAMARA Event Subscription and Notification Guide.

Also introduced local, API-scoped Generic400/403/404 response objects
(replacing the direct $ref to CAMARA_common.yaml's generic ones) that
restrict the documented error codes to only those that actually apply
to this API's business logic:
- 400: only INVALID_ARGUMENT (dropped OUT_OF_RANGE - EAM has no
  range-constrained query/body fields that would justify this code)
- 403: only PERMISSION_DENIED (dropped INVALID_TOKEN_CONTEXT - EAM is a
  B2B management API with no per-request identity binding to an
  OAuth2 token to validate against)
- 404: only NOT_FOUND (dropped IDENTIFIER_NOT_FOUND - this code is
  device-identification specific per the Design Guide's own example;
  EAM never identifies a 'device', only apps/instances/deployments/
  clusters/zones, already covered by NOT_FOUND)

401 (UNAUTHENTICATED only) and 409 (already using API-specific inline
ALREADY_EXISTS/INCOMPATIBLE_STATE/ABORTED responses, never CONFLICT)
were already correct and left untouched.

Fixes camaraproject#72
Verified every .feature file's tested status codes against the actual
responses documented per operation in the spec. Found 3 more phantom
error scenarios testing a 404 that the corresponding operation never
declares - all are plain collection GETs with only optional query
filters, which per REST/CAMARA semantics return 200 with an empty list
when nothing matches, not 404:

- getApps.feature: no filters at all, 404 never applied
- getAppDeployments.feature: 404 filtered-by-appId scenario left behind
  when 404 was removed from the operation's YAML in PR camaraproject#56 (8755fb2)
- getClusters.feature: 404 filtered-by-region scenario, same pattern

All other operations' tested status codes (200/201/202/204, 400, 401,
403, 404 on by-id operations, 409 with API-specific codes) were
verified to match exactly what edge-application-management.yaml
documents for each operationId; no other discrepancies found.
Comment thread code/API_definitions/edge-application-management.yaml Outdated
Co-authored-by: Sergi <sergialonsogarcia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Review documented error response codes

2 participants