-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align error format with Commonalities guidelines #104
Align error format with Commonalities guidelines #104
Conversation
As discussed in issue [camaraproject#97](camaraproject#97), we have to align current error model and examples to the guidelines: - Add new `status` property - Created new `Generic500` response and $ref all previous instances
@jlurien Short question: is this PR intended for the minor fix release (which I want to close "now") or already for v0.9? As status is a required field, it might fit better into v0.9.0? |
0.9 definitely |
Schemas for GenericXXX responses must restrict the ErrorInfo model to the allowed values at `status` and `code` for every specific response
Added rewievers @eric-murray @patrice-conil as discussed within our call. @sfnuser please renew your review as well. Thanks! |
Hi @jlurien, ErrorInfo: |
Hi @patrice-conil, have you commented in the file? I guess this is about the problem you mentioned in the meeting with Another alternative, as we are not reusing that much of the base |
Hi @jlurien, yes I commented in the file. and it is indeed linked to the problem that I mentioned last Friday. I agree with you, this mapping should do the trick... but it's quite new and probably not so well supported by generators. |
example: | ||
status: "403" | ||
code: FORBIDDEN | ||
message: "Operation not allowed: ..." | ||
SessionNotFound404: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not Generic404 as Generic403, Generic401 ?
All these errors are specialization of ErrorInfo ... usage is to define a type or @type field as discriminator in ErrorInfo to help deserializer to manage subtype deserialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have named it Generic404 as well, but as the only case in this API for 404 was Session Not Found, I chose a more specific name and added an explicit message in the example. Problem with Generic responses is that example has to be generic as well. For automatic API publishing in a web portal it is convenient to embed good examples in the spec, but for client generation purposes it may complicate things.
I can change the name to Generic404
if that is more coherent with the rest of responses
I only see the latest comment about Generic404. If mapping is not well supported, I prefer to remove the
|
code/API_definitions/qod-api.yaml
Outdated
code: NOT_FOUND | ||
message: "Session Id does not exist" | ||
Generic500: | ||
description: Server error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better naming would be "Internal Server Error" for the description of a 500 - Internal Server Error.
code/API_definitions/qod-api.yaml
Outdated
enum: ["500"] | ||
code: | ||
type: string | ||
enum: ["INTERNAL"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what "INTERNAL" means.
Better use the following naming:
enum: ["INTERNAL_SERVER_ERROR"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Internal Server Error" is also the description for the status code "500" within Hypertext Transfer Protocol (HTTP) Status Code Registry. Therefore +1 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on aligning as much as possible to standard HTTP terms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have aligned the codes with the ones in Commonalities, and currently they define INTERNAL for 500 and UNAVAILABLE for 503. code
has not to be necessarily the description of the HTTP code, but in any case, the discussion for this should be moved to Commonalities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok for now ... we just should get a conclusion on that before we close v0.9.0.
- `status` is now an integer - `code` values aligned with Commonalities (INVALID_ARGUMENT, UNAUTHENTICATED, PERMISSION_DENIED...) - Specific schemas defined for all errors, so `ErrorInfo` schema is not used. I have created a new issue in Commonalities to decide whether to reference specific model per error or the common model: <camaraproject/WorkingGroups#151>. When a common approach is decided we should align this to it.
Please review the latest version. Some comments:
|
LGTM, just asking @patrice-conil @maxl2287 @eric-murray for a final review (and closing remarks for the open conversations). |
Resolving conflicts with updated main
Is it intended to approve and merge this PR before Commonalities Issue #151 is resolved? |
We could merge it as it is now and later update the $refs to the right schemas, and remove the unused ones. Indeed I have intentionally left the ErrorInfo schema even if it is currently unused. |
As discussed in issue #97, we have to align current error model and examples to the guidelines:
status
propertyGeneric500
response and $ref all previous instances