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

MonitorUpdateRequest accepts illegal params

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
api

調査の方向性

datadog_api_client.v1.model.monitor_update_request.MonitorUpdateRequest から始め、受け付けられるパラメータと、issue で言及されている Monitor.read_only_vars 属性を比較します。datadog_api_client/model_utils.py にあるモデルの初期化経路を読み、その後、読み取り専用の monitor フィールドが更新の構築から除外される一方で、有効な更新フィールドは引き続き機能することを確認します。

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

説明

kind/bug stale

Describe the bug
The MonitorUpdateRequest class accepts several params that are read only attributes of a monitor and if you pass any value for one of these params creation of the MonitorUpdateRequest object fails and raises an Exception.

To Reproduce
Steps to reproduce the behavior:

  1. Import the MonitorUpdateRequest object
    from datadog_api_client.v1.model.monitor_update_request import MonitorUpdateRequest
  2. Follow the documentation for what params to pass when creating the object
  3. See error
>>> update = MonitorUpdateRequest(created=datetime(2025, 10, 20, 0, 6, 37, 825141))
Traceback (most recent call last):
  File "<python-input-9>", line 1, in <module>
    update = MonitorUpdateRequest(created=datetime(2025, 10, 20, 0, 6, 37, 825141))
  File "~/git/example/.venv/lib/python3.14/site-packages/datadog_api_client/v1/model/monitor_update_request.py", line 211, in __init__
    super().__init__(kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^
  File "~/git/example/.venv/lib/python3.14/site-packages/datadog_api_client/model_utils.py", line 445, in __init__
    raise ApiAttributeError(f"`{var_name}` is a read-only attribute.")
datadog_api_client.exceptions.ApiAttributeError: `created` is a read-only attribute.
>>> update = MonitorUpdateRequest(id=228483234)
Traceback (most recent call last):
  File "<python-input-10>", line 1, in <module>
    update = MonitorUpdateRequest(id=228483234)
  File "~/git/example/.venv/lib/python3.14/site-packages/datadog_api_client/v1/model/monitor_update_request.py", line 211, in __init__
    super().__init__(kwargs)
    ~~~~~~~~~~~~~~~~^^^^^^^^
  File "~/git/example/.venv/lib/python3.14/site-packages/datadog_api_client/model_utils.py", line 445, in __init__
    raise ApiAttributeError(f"`{var_name}` is a read-only attribute.")
datadog_api_client.exceptions.ApiAttributeError: `id` is a read-only attribute.

Expected behavior
This class should not accept parameters that are restricted from being updated via the API as it exists solely to update monitors via the API

Environment and Versions (please complete the following information):
datadog-api-client v2.50.0

Additional context
This issue was hit when i was trying to bulk update existing monitors. The workflow was get monitor details from the API, edit them with the changes i wanted, then update the monitor. I had to loop through all the params to identify the read-only ones before i discovered the Monitor.read_only_vars attribute

主要言語
Python
スター
166
フォーク
55
平均マージ
2日 17時間
マージ済み PR(30日)
73

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

DataDog/datadog-api-client-python のほかの issue

DataDog/datadog-api-client-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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