why does dns.records.edit() require a full record instead of a Partial<> ?

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

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

評価

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

調査の方向性

まず、DNS レコード編集用の API 定義を調べ、RecordEditParams と RecordUpdateParams を比較します。エンドポイントが、再現例の zone_id と content のみのような部分的なペイロードを受け付けるか確認します。API が部分更新をサポートしている場合、TypeScript の型がエンドポイントの必須フィールドを正確に反映し、示されている編集呼び出しに対するリグレッションチェックがあれば完了です。

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

説明

Confirm this is a TypeScript library issue and not an underlying Cloudflare API issue
  • This is an issue with the TypeScript library
Describe the bug

Sorry if this is a stupid question but doesn't that defeat the purpose of using PATCH ?

I could be confused but it appears the actual API endpoint accepts partial updates e..g. { content: new_ip } but the API definition requires ttl, name, and type making edit and update synonyms.

If the actual API endpoint accepts partials then the API should allow them too e.g. RecordEditParams should be defined with ?: for everything except zoneid: rather than being an exact duplicate of RecordUpdateParams.

If I am confused and the partial update is forcing missing settings to some default then the API is currently correct.

Note: Code generation looks correct. It is the actual spec I am questioning.

To Reproduce

Reproduction is simple. This fragment appears to work fine in a production worker:

			await creds.cloudflare.dns.records.edit(dnsid, {
				zone_id: creds.zoneid,
				content: ip,
			})

But when compiled with tsc it refuses to build due to the missing mandatory fields.

Code snippets

OS

Ubuntu 22.04

Runtime version

Typescript 7.0.2

Library version

cloudflare 7.0.0 cloudflare/types 7.0.1 cloudflare/workers-types 5.20260801.1

主要言語
TypeScript
スター
835
フォーク
201
平均マージ
41分
マージ済み PR(30日)
1

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

cloudflare/cloudflare-typescript のほかの issue

cloudflare/cloudflare-typescript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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