Skip to content

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

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

fix(schema): allow null values for referenceTable and lookup in app field properties#409
yuto-0315 wants to merge 2 commits 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
@shabaraba shabaraba self-assigned this Jun 26, 2026

@shabaraba shabaraba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuto-0315
PRありがとうございます!
反応が大変遅くなってしまい申し訳ございませんでした。

こちらレビューさせていただいて、一点だけコメント書かせていただきました。
あと、もしかしたらPRタイトルが途中で切れているかもしれないです!

お手隙の際にご確認の程よろしくお願いいたします 🙇

Comment thread src/schema/app/properties-parameter.ts Outdated
@yuto-0315 yuto-0315 changed the title fix(schema): allow null values for referenceTable and lookup in app f… fix(schema): allow null values for referenceTable and lookup in app field properties Jun 26, 2026
@yuto-0315

Copy link
Copy Markdown
Author

@shabaraba
PRご確認いただきありがとうございます!

nullableに修正いたしました!
また、PRタイトルが途中で切れていた問題も修正いたしました!

再度お手隙でご確認ください。
よろしくお願いいたします🙇

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.

2 participants