Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

PUT user-profile returns 500 when user_id is missing from the payload

オープン 初心者向け
#3,911 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

難易度
1/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api

調査の方向性

バグは policyengine_api/routes/user_profile_routes.py の update_user_profile にあります。payload.pop("user_id") にはデフォルト値がなく、KeyError を発生させます。user_id が null の場合の既存の分岐("Payload must include user_id" とともに 400 を返す)を読み、キーが存在しない場合も同じ経路をたどるようにしてください。user_id を含まないペイロードが null の場合と同じ 400 を受け取り、両方のケースをテストでカバーすれば完了です。

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

説明

The PUT /<country_id>/user-profile route (update_user_profile in policyengine_api/routes/user_profile_routes.py) reads the ID with payload.pop("user_id"), with no default. A payload without a user_id key raises KeyError, which the generic error handler turns into a 500.

The route already returns 400 ("Payload must include user_id") when user_id is present but null, so a missing key should get the same 400.

Expected

A payload without user_id gives 400 with the same message as a null user_id, for example by using payload.pop("user_id", None). Add a test for both cases.

Notes

  • Found while documenting the code for the ruff docstring rules; behaviour was left unchanged there.
  • The route has a TODO pointing at #2054 (request validation), which is now closed.
主要言語
Python
スター
18
フォーク
33
平均マージ
1日 15時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

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

PolicyEngine/policyengine-api のほかの issue

PolicyEngine/policyengine-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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