Skip to content

Commit

Permalink
fix: Removing the "NOT" terminology from error codes. (#52)
Browse files Browse the repository at this point in the history
Terminology in error codes is updated to be consistent and to provide a code that is representative of the problem (rather than the solution).
  • Loading branch information
travisgosselin authored Mar 14, 2023
1 parent 6d9a532 commit 961958f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions standards/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Content-Type: application/problem+json // Should return
// Request ID should be carried over from the X-Request-ID header of the request, otherwise, it's automatically generated GUID value.
"context": [ // OPTIONAL (array): List of objects providing additional context and detail on sub-reasons for the validation issue or error.
{
"code": "INPUT_NOT_NULL", // OPTIONAL (string): Short, machine-readable, name of the validation error that occurred.
"code": "INPUT_NULL", // OPTIONAL (string): Short, machine-readable, name of the validation error that occurred.
// To infer that these are machine codes, usage MUST be CAPITAL_SNAKE_CASE.
"message": "Attribute 'foo2' must not be null.", // REQUIRED (string): Human-readable details or message specific error about the request failure.
.... // EXTENSIONS: (any): The context list object can be extended with additional properties as needed for your application.
Expand Down Expand Up @@ -133,37 +133,41 @@ Content-Type: application/problem+json
"requestId": "b6d9a290-9f20-465b-bcd3-4a5166eeb3d7",
"context": [
{
// INDICATES A FIELD THAT DOES NOT MATCH THE DEFINED FORMAT
"code": "INPUT_INVALID",
"message": "Attribute 'email' must be a valid email address.",
"field": "email",
"source": "body",
"value": "testuser"
},
{
"code": "INPUT_NOT_NULL",
// INDICATES A MISSING FIELD
"code": "INPUT_NULL",
"message": "Attribute 'reason' must not be null.",
"field": "reason",
"source": "body"
},
{
"code": "INPUT_NOT_BLANK",
// INDICATES EMPTY STRING VALUE
"code": "INPUT_BLANK",
"message": "Attribute 'description' must not be blank.",
"field": "description",
"source": "body"
},
{
"code": "INPUT_NOT_BLANK",
"code": "INPUT_BLANK",
"message": "Attribute 'pages[0].description' must not be blank.",
"field": "pages[0].description",
"source": "body"
},
{
"code": "INPUT_NOT_EMPTY",
// INDICATES EMPTY ARRAY
"code": "INPUT_EMPTY",
"message": "Attribute 'tags' must not be empty.",
"field": "tags",
"source": "body"
},
{
{
"code": "INPUT_MIN_VALUE",
"message": "Attribute 'limit' must be greater than or equal to 1.",
"field": "limit",
Expand All @@ -189,7 +193,7 @@ Content-Type: application/problem+json
"message": "Attribute 'If-Match' does not match the expected format.",
"field": "If-Match",
"source": "header",
"value": "empty"
"value": "1234"
}
]
}
Expand Down

0 comments on commit 961958f

Please sign in to comment.