Skip to content

メンバーシップ登録していないプロジェクトにissueをPOSTするときに返ってくるエラーが的確でない #74

@sanak

Description

@sanak

メンバーシップ登録していないプロジェクトに対して issue を作成しようとしたとき、メンバーシップ登録がされていないことに対するエラーではなく、プロジェクトIDやトラッカーIDが入力されていないことに対するエラーが返ってくるのは挙動として不自然。

再現手順:

  1. Fixturesを読み込み
    bundle exec rake db:fixtures:load
  2. システム管理者アカウント(admin / admin)でログインし、Settings / API から、 Enable REST web service をチェックONして保存
  3. システム管理者アカウントをログアウトし、 rhill / foo でログイン後、右上のMy accountから API access key 下の Show をクリックして、APIキーを生成
  4. curlで rhill ユーザーが参加していないプライベートプロジェクト(ID: 5, Private child of eCookbook)に対して、IssueのPOST(作成)リクエストを実行。
    curl -v -H "Content-Type: application/json" \
      -d '{"issue":{"project_id":5,"subject":"None member issue","tracker_id":1}}' \
      'http://localhost:3000/issues.json?key=(rhillのAPIキー)'
  5. 以下の分かりにくいエラーコード・メッセージが返される。
    :
    < HTTP/1.1 422 Unprocessable Entity
    :
    {"errors":["Project cannot be blank","Tracker cannot be blank","Status cannot be blank"]}
    

※補足: プロジェクトのメンバーである admin, jsmith アカウントでは、上記のエラーは発生せず、正しくIssueの作成が完了する。

curl -v -H "Content-Type: application/json" \
  -d '{"issue":{"project_id":5,"subject":"None member issue","tracker_id":1}}' \
  'http://localhost:3000/issues.json?key=(adminもしくはjsmithのAPIキー)'

結果:

:
< HTTP/1.1 201 Created
:
{"issue":{"id":17,"project":{"id":5,"name":"Private child of eCookbook"}...

Metadata

Metadata

Assignees

No one assigned

    Labels

    DefectRedmine.orgのチケット(もしくはこれから作成するチケット)のトラッカー取り組み候補

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions