Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
updating error response structure tables (#325)
Browse files Browse the repository at this point in the history
* updating error response structure tables

* fixing toc

* removing code, moving id to the error details object
  • Loading branch information
Jiyoon Koo authored Jul 10, 2024
1 parent 30eb9ed commit e9ca0bd
Showing 1 changed file with 19 additions and 28 deletions.
47 changes: 19 additions & 28 deletions specs/http-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Version: Draft
- [Discoverability](#discoverability)
- [Example](#example)
- [Error Responses](#error-responses)
- [Error object](#error-object)
- [Error response structure](#error-response-structure)
- [ErrorDetail structure](#errordetail-structure)
- [Example](#example-1)
- [Exceptions](#exceptions)
- [Query Params](#query-params)
Expand Down Expand Up @@ -99,41 +100,31 @@ If the serviceEndpoint is itself a DID, this DID should resolve to a document an
* An error response is one whose status code is `>= 400`.
* If present, the body of an error response will conform to the following:

## Error response structure
| Field | Type | Required | Description |
| --------- | ------------- | -------- | ------------------------------------------------------------------------ |
| `message` | String | Y | A human-readable explanation specific to this occurrence of the problem. |
| `details` | ErrorDetail[] | N | Optional array of `ErrorDetail` objects |

| Field | Required (Y/N) | Description |
| -------- | -------------- | ----------------------- |
| `errors` | Y | List of `Error` objects |


## Error object
| Field | Required (Y/N) | Description |
| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | N | A unique identifier for this particular occurrence of the problem. |
| `status` | N | The HTTP status code applicable to this problem, expressed as a string value. This SHOULD be provided. |
| `code` | N | An application-specific error code, expressed as a string value. |
| `title` | N | A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. |
| `detail` | Y | A human-readable explanation specific to this occurrence of the problem. Like `title`, this field’s value can be localized. |
| `source` | N | An object containing references to the primary source of the error. It should include the `pointer`, `parameter`, or `header` members or be omitted. |
| `source.pointer` | N | A JSON Pointer to the value in the request document that caused the error. This MUST point to a value in the request document that exists; if it doesn’t, the client SHOULD simply ignore the pointer. |
| `source.parameter` | N | A string indicating which URI query parameter caused the error. |
| `source.header` | N | A string indicating the name of a single request header which caused the error. |
| `meta` | N | A meta object containing non-standard meta-information about the error. |
## ErrorDetail structure
| Field | Type | Required | Description |
| --------- | ------ | -------- | -------------------------------------------------------------------------------------- |
| `id` | String | N | Optional server-generated request-specific ID, useful for diagnosing unexpected errors |
| `message` | String | N | A human-readable explanation specific to this occurrence of the problem. |
| `path` | String | N | Path where validation failed (i.e. JSON schema path) |

---

## Example
```json
{
"errors": [
{
"id": "95e076c3-1589-4535-9a38-dba793d5c181",
"status": 400,
"detail": "Offering with id offering_xyz not found",

}
]
"message": "Missing field: payin.amount",
"details": [{
"id": "9af2bf88-e4f4-4f81-8ba9-55eaeeb718e2",
"message": "Payin amount must be present.",
"path": "$.payin.amount"
}]
}

```

# Exceptions
Expand Down

0 comments on commit e9ca0bd

Please sign in to comment.