Success Responses with Meta Information#567
Success Responses with Meta Information#567gmuratk wants to merge 6 commits intocamaraproject:mainfrom
Conversation
|
@gmuratk thanks for the new proposal. If so, then the
This means when JSON:API v1.0 — Section 7.5: Meta Information requires |
|
Thanks @rartych !
|
|
I have added minor editorial comments in example section. Other text - LGTM.
|
|
HI @gmuratk -
I think 'supplementary purposes' is a clear example of 'meta data', as per the examples given at JSON API: Meta Information (which is described as 'non-standard, and is intended for the document response as a whole). But for that same reason I do not think it is appropriate for the 'partial cases' as discussed in #555, because:
So I think this approach can be considered if we want to allow some non-standard meta information that applies to the whole response, but not for limited/partial success cases. |
|
@Kevsy the PR description looks out-dated as PR evolved:
|
|
I guess, that API definitions should enumerate |
|
Thanks @rartych -
The reference has been removed, but the design of JSON API: Meta Information is still there. For the reason I give above I don't believe that is appropriate for partial/limited success scenarios.
That's my point: a 'meta' field that was intended for free entry is not appropriate here. I agree that API's should define an enumeration for response values/text that indicate partial success, but that should be a formal part of the response definition. |
| # Conditional requirement: | ||
| # - Either `meta` MUST be present alone, OR | ||
| # - The normal required fields must be present | ||
| anyOf: |
There was a problem hiding this comment.
Given the #567 (comment) I had changed it to anyOf.
| $ref: "#/components/responses/<schema-name>" | ||
| ``` | ||
| #### 5.7.6.1 Success Responses with Meta Information | ||
| CAMARA APIs MAY include an optional `meta` field in success responses to express *successful but indeterminate* outcomes without breaking clients. |
There was a problem hiding this comment.
This will break clients in API stable versions, for instance (Device Reachability Status):
200 OK
{
"lastStatusTime": "2024-02-20T10:41:38.657Z",
"reachable": false
}
200 OK
{
"meta": { "Request was valid. Unable to provide details." }
}
Because meta is not added as an optional field over "regular" response schema but as another response option
| $ref: "#/components/responses/<schema-name>" | ||
| ``` | ||
| #### 5.7.6.1 Success Responses with Meta Information | ||
| CAMARA APIs MAY include an optional `meta` field in success responses to express *successful but indeterminate* outcomes without breaking clients. |
There was a problem hiding this comment.
In line with Issue#555 comment Let's imagine an API that adopts this model, in the same way an API Provider can adopt 200 with "meta" response, how would be guaranteed that an API provider is free to not adopt it
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Rafal Artych <121048129+rartych@users.noreply.github.com>
Co-authored-by: Pedro Díez García <pedro.diezgarcia@telefonica.com>
|
Thanks for the proposal and the good discussion it triggered around the "limited success / no result" topic from #555. After reviewing the discussion here and in #555, I don't think this approach solves the underlying problem: The issue in #555 is about how to model business-level outcomes (success, failure, partial, unknown) for valid 2xx requests in a consistent, interoperable way. The proposed I share @Kevsy's concern that a free-form I would recommend closing this PR and addressing #555 via guidance in the CAMARA API Design Guide. The guidance should be based on explicit, typed outcome fields (e.g. I am preparing a PR along these lines. |
|
Closed. Addressed via PR #578 |
What type of PR is this?
What this PR does / why we need it:
Current CAMARA API Design Guide does not define option to define handling for 'limited' success responses for valid requests with partial fulfillment. In addition, while the
ErrorInfostructure allows for 4xx/5xx responses to provide insights, there is no option to provide such insights for the 2xx, success responses. This PR introduces a new subsection in the Design Guide referencing the JSON API: Meta Information for a conditional optional property to be considered by the API Designers for sharingmetadata, either for supplementary purposes or to handle partial cases, such as indeterminate situations.Which issue(s) this PR fixes:
Fixes #555
Does this PR introduce a breaking change?
Special notes for reviewers:
Changelog input
Additional documentation
Obsoletes #557