Skip to content

fix(schema): allow null values for referenceTable and lookup in app f…#409

Open
yuto-0315 wants to merge 1 commit into
kintone:mainfrom
yuto-0315:fix/allow-null-field-properties
Open

fix(schema): allow null values for referenceTable and lookup in app f…#409
yuto-0315 wants to merge 1 commit into
kintone:mainfrom
yuto-0315:fix/allow-null-field-properties

Conversation

@yuto-0315
Copy link
Copy Markdown

Why

Kintone の get-form-fields API は、関連レコード一覧(REFERENCE_TABLE)やルックアップ(LOOKUP)の構成情報が設定されていない場合や権限が制限されている場合に、null を返すことがあります。
現在の Zod スキーマでは null を許容していないため、これらのフィールドが含まれるアプリでツールを実行すると、MCP バリデーションエラー(-32602)が発生していました。

What

  • properties-parameter.ts および field-properties.ts の Zod スキーマにおいて、referenceTablelookup プロパティに .nullish() を追加し、null を受け入れられるようにしました。
  • 同時に .transform() を使用して、受け取った null を内部的に undefined へ変換するようにしました。これにより、PropertiesForParameter 型(Kintone SDK の型定義)との互換性が保たれ、add-form-fields などの他ツールでビルドエラーが発生しないようになっています。

How to test

  1. 関連レコード一覧やルックアップが設定されているアプリ(または referenceTablenull で返る状態のアプリ)に対して kintone-get-form-fields ツールを実行し、バリデーションエラーが発生しないことを確認します。
  2. pnpm build または pnpm build:mcpb を実行し、TypeScript のコンパイルエラーが発生しないことを確認します。

Checklist

  • Updated documentation if it is required. (N/A)
  • Added tests if it is required. (N/A - Schema fix)
  • Passed pnpm lint and pnpm test on the root directory.

@yuto-0315 yuto-0315 requested a review from a team as a code owner April 20, 2026 08:05
@yuto-0315 yuto-0315 requested review from chihiro-adachi and nameless-mc and removed request for a team April 20, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant