Invalid query parameters return two different error shapes

オープン
#1,112 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go
領域
api

調査の方向性

Start by tracing query-parameter validation on the list endpoints for limit, dir, order_by, time[…], and the next/prev cursors, comparing the 400 and 422 response shapes shown in the issue. The issue leaves the choice of status and shape open, so clarify that decision before changing behavior. Done means all those invalid parameters use one consistent status and response shape, with a release note covering the client compatibility impact.

索引モデルが issue の本文から書いたものです。

説明

As of #1109, on the list endpoints an invalid limit returns a 400 with a plain message. For example GET /api/v1/events?limit=0:

{"status":400,"message":"invalid limit: must be between 1 and 1000"}

An invalid dir, order_by or time[…] on the same endpoint returns a 422 with a data detail. For example GET /api/v1/events?dir=sideways:

{"status":422,"message":"validation error","data":{"query.dir":"must be 'asc' or 'desc'"}}

An invalid next or prev cursor is a 400 with a plain message, like limit. A client has to handle both shapes for one request.

Proposal: pick one status and shape for query parameter validation and apply it on every endpoint. Clients that match on the status would break, so the change needs a release note.

主要言語
Go
スター
1.1k
フォーク
70
平均マージ
3日 9時間
マージ済み PR(30日)
34

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hookdeck/outpost のほかの issue

hookdeck/outpost の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。