Skip to content

Stay more compatible with 1.0.0 #10

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions models/errors-1.0.1.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Errors:
title: Errors
required:
- errors
- trace
- type
Copy link
Collaborator

@mattiasmelin mattiasmelin Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why type is required? Seems to be a breaking change compared to 1.0.0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it could be removed. It's not required per se, but if it's not precent it should default to about/blank - which is quite useless. Should I remove it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type: object
description: Information on where and why an error has occurred.
properties:
title:
type: string
Expand All @@ -10,33 +14,47 @@ Errors:
type:
type: string
format: uri-reference
example: urn://errors/validation-error
description: |
The type contains a URI reference that identifies the problem type.
This link will take you to the documentation where you can read more about the error in a generic context.
More detailed information should be given from the error items (specifically their messages and parameters).
RFC reference: https://datatracker.ietf.org/doc/html/rfc9457#name-type
trace:
type: string
format: uuid
description: |
Trace is a UUID which can be used for debugging purposes in case something goes wrong.
Please include this when contacting support in such a case as this will lower the time required for finding problems.
Please include this when contacting support regarding API errors. This will lower the time required for finding problems.
example: cd05b1fc-bc10-4ba6-9a9f-b73c503dbd77
errors:
type: array
items:
type: object
properties:
code:
type: string
description: |
Generic code used to categorize errors. `Example: UNAUTHORIZED_REQUEST`
message:
type: string
description: |
Message detailing what caused this error.
parameters:
type: array
description: |
Sent in parameters which made this problem occur.
items:
type: string
$ref: "#/Error"
Error:
required:
- code
- message
type: object
properties:
code:
type: string
description: Semantic strings, also hinting to the reason for the error occurring.
example: "SELF_MANAGEMENT_NOT_ALLOWED"
message:
type: string
description: |
Information for the developer to further understand why the
error occurred and will always be in English regardless of language requested
in the header.
example: "Users are not allowed to modify their own permissions"
parameters:
type: array
description: Lists all values that is related to this error
items:
type: string
description: The value of an offending parameter
example: "johndoe"
description: |
Supplies the consumer with further insight into what has gone wrong.
Information adding meaning and value to the developer, and not messages that
are to be displayed directly to the end user.