shinosakarb / tebukuro

Build communities and ticketing
https://shinosakarb.github.io/tebukuro/
BSD 3-Clause "New" or "Revised" License
44 stars 17 forks source link

Decide the error format of API #108

Open chimame opened 7 years ago

chimame commented 7 years ago

Problems and suggestions:問題・課題点/提案

In the case of an error, since the JSON format is not fixed, it is difficult to use for the client. ex.

  1. Response at mandatory error when posting to /communities.
    {
      "description": [
        "を入力してください"
      ]
    }
  2. Response at the time of NotFound error when getting to /communities/0.
    {"status":404,"error":"Not Found"}

    Countermeasure:対応方法(案)

    I considered the following format. What do you think.

    {
    "level": 1,#1=warning, 2=error
    "messages": [] #I am considering entering multiple messages.
    }
ytorii commented 7 years ago

I thought case 1 corresponds to level 1(warning) and case 2 corresponds to level 2(error), is that correct? If possible, I think the format of RFC 7807 is worthy of consideration. https://www.eisbahn.jp/yoichiro/2017/01/rfc_7807.html

springaki commented 7 years ago

@chimame @ytorii これはどうなるの?

chimame commented 7 years ago

これは置いておいてもらっていいですか?

springaki commented 7 years ago

はーい