Skip to content

Commit

Permalink
update JSON Schema for Problem Details (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankkilcommins authored Apr 16, 2024
1 parent 6917caa commit 0a38b67
Showing 1 changed file with 80 additions and 67 deletions.
147 changes: 80 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,71 +25,84 @@ When necessary, a Problem Detail response _MAY_ include additional detail on the

```json
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "a string containing a URI reference that identifies the problem type. When this member is not present, its value is assumed to be `about:blank`."
},
"status": {
"type": "number",
"description": "a number indicating the HTTP status code."
},
"title": {
"type": "string",
"description": "a string containing a short, human-readable summary of the problem type."
},
"detail": {
"type": "string",
"description": "a string containing a human-readable explanation specific to this occurrence of the problem."
},
"instance": {
"type": "string",
"description": "a string containing a URI reference that identifies the specific occurrence of the problem."
},
"code": {
"type": "string",
"description": "a string containing additional provider specific codes to identify the error context."
},
"errors": {
"type": "array",
"description": "an array of error details to accompany a problem details response",
"items": [
{
"type": "object",
"description": "an error object to provide explicit details on a problem towards an API consumer",
"properties": {
"detail": {
"type": "string",
"description": "a granular description on the specific error related to a body property, query parameter, path parameters, and/or header"
},
"pointer": {
"type": "string",
"description": "a JSON Pointer to a specific request body property that is the source of error"
},
"parameter": {
"type": "string",
"description": "a string containing the name of the query or path parameter that is the source of error"
},
"header": {
"type": "string",
"description": "a string containing the name of the header that is the source of error"
},
"code": {
"type": "string",
"description": "a string containing additional provider specific codes to identify the error context."
}
},
"required": [
"detail"
]
}
]
}
},
"required": [
"title"
]
}
"$schema": "https://json-schema.org/draft/2019-09/schema",
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "A URI reference that identifies the problem type.",
"format": "uri",
"maxLength": 1024
},
"status": {
"type": "integer",
"description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
"format": "int32",
"minimum": 100,
"maximum": 599
},
"title": {
"type": "string",
"description": "A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem, except for purposes of localization.",
"maxLength": 1024
},
"detail": {
"type": "string",
"description": "A human-readable explanation specific to this occurrence of the problem.",
"maxLength": 4096
},
"instance": {
"type": "string",
"description": "A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.",
"maxLength": 1024
},
"code": {
"type": "string",
"description": "An API specific error code aiding the provider team understand the error based on their own potential taxonomy or registry.",
"maxLength": 50
},
"errors": {
"type": "array",
"description": "An array of error details to accompany a problem details response.",
"maxItems": 1000,
"items": {
"type": "object",
"description": "An object to provide explicit details on a problem towards an API consumer.",
"properties": {
"detail": {
"type": "string",
"description": "A granular description on the specific error related to a body property, query parameter, path parameters, and/or header.",
"maxLength": 4096
},
"pointer": {
"type": "string",
"description": "A JSON Pointer to a specific request body property that is the source of error.",
"maxLength": 1024
},
"parameter": {
"type": "string",
"description": "The name of the query or path parameter that is the source of error.",
"maxLength": 1024
},
"header": {
"type": "string",
"description": "The name of the header that is the source of error.",
"maxLength": 1024
},
"code": {
"type": "string",
"description": "A string containing additional provider specific codes to identify the error context.",
"maxLength": 50
}
},
"required": [
"detail"
]
}
}
},
"required": [
"detail"
]
}
```

0 comments on commit 0a38b67

Please sign in to comment.