-
Notifications
You must be signed in to change notification settings - Fork 8
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
How prescriptive should we be about which HTTP error codes to return? #100
Comments
Yes and consider using: https://datatracker.ietf.org/doc/html/rfc7807 -> https://datatracker.ietf.org/doc/html/rfc9457 |
We need to provide a way to standardize the non-happy path in an extensible way. |
Proposal:
|
Need:
|
@manuelottlik will work on a template to follow for the spec text/ "errors" appendix |
This would be a very simple problem for a 404: {
"type": "https://docs.xregistry.io/problems/default/not-found-error",
"instance": "/schemagroups/mygroup/schemas/myschema",
"title": "Not Found"
} This could be a more advanced problem that has an additional attribute {
"type": "https://docs.xregistry.io/problems/compatibility-violated",
"instance": "schemagroups/mygroup/schemas/myschema/versions",
"title": "Compatibility violated",
"detail": "Can not create version because it violates the compatibility",
"compatibility": "forward_transitive"
} This would be a JSON schema representation we can use in our OpenAPI: DefaultProblem:
type: object
description: default problem object thrown when no further problem is specified
required:
- type
- status
- title
properties:
status:
type: integer
format: int32
description: HTTP status code
example: 400
type:
type: string
format: url
description: URI pointing to a human readable documentation
example: https://docs.xregistry.io/problems/email-already-taken
title:
type: string
description: short, human readable description of the problem
example: The provided e-mail address is already taken.
detail:
type: string
description: human readable explanation of the problem
example: The e-mail adress serves as an identifier and thus can only be taken once.
instance:
type: string
description: endpoint where the problem occurred
example: /users I copied these things from a personal project of mine and adapted them to xRegistry. The reason for the camelCase titles is i18n, since clients might want to use that. |
https://datatracker.ietf.org/doc/html/rfc9457#section-3.1.5 "instance" is kind of interesting. As defined it looks like it's a URL to the "problem json" and not the instance/object that generated the error. So when you used |
404 is one we do mandate, and we sometimes say it must be a 400, but most of the time we just say "an error must be generated". Do we need to be more precise? Should we standardize the error messages?
The text was updated successfully, but these errors were encountered: