diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-05-11 01:18:02 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2021-05-11 01:50:42 +0200 |
commit | de3876b815c9f095f557fe8bd6ee7c22d842c974 (patch) | |
tree | 8224538badfabf26df8b5ddd1df266b42734e6df | |
parent | b8375da9313e0755d664306163139220a41d9ced (diff) | |
download | PeerTube-de3876b815c9f095f557fe8bd6ee7c22d842c974.tar.gz PeerTube-de3876b815c9f095f557fe8bd6ee7c22d842c974.tar.zst PeerTube-de3876b815c9f095f557fe8bd6ee7c22d842c974.zip |
explicit error formatting variant in openapi spec
-rw-r--r-- | support/doc/api/openapi.yaml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 7316b0b58..1a0822c8f 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -39,12 +39,25 @@ info: | |||
39 | 39 | ||
40 | The API uses standard HTTP status codes to indicate the success or failure | 40 | The API uses standard HTTP status codes to indicate the success or failure |
41 | of the API call. The body of the response will be JSON in the following | 41 | of the API call. The body of the response will be JSON in the following |
42 | format. | 42 | formats. |
43 | 43 | ||
44 | ``` | 44 | ``` |
45 | { | 45 | { |
46 | "code": "unauthorized_request", // example inner error code | 46 | "error": "Account not found" // error debug message |
47 | "error": "Token is invalid." // example exposed error message | 47 | } |
48 | ``` | ||
49 | |||
50 | Some errors benefit from a more detailed message: | ||
51 | ``` | ||
52 | { | ||
53 | "errors": { | ||
54 | "id": { // where 'id' is the name of the parameter concerned by the error. | ||
55 | "value": "a117eb-c6a9-4756-bb09-2a956239f", // value that triggered the error. | ||
56 | "msg": "Should have an valid id", // error debug message | ||
57 | "param": "id", | ||
58 | "location": "params" // 'params', 'body', 'header', 'query' or 'cookies' | ||
59 | } | ||
60 | } | ||
48 | } | 61 | } |
49 | ``` | 62 | ``` |
50 | 63 | ||