Merged
Conversation
- セレクトフィールドの型を常にstring[]に修正(microCMSは単一選択でも常に配列を返す) - selectItemsがある場合は文字列リテラルユニオン型の配列を生成 - relationListフィールドで参照先エンドポイントのContent型を使用するよう修正 - Management APIのselectItemsパースを追加(文字列配列/オブジェクト配列の両形式対応) - 対応するテストケースを追加 Co-authored-by: Ryusei Sugita <wato787@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
microCMS Content API の公式仕様では、コンテンツ参照(relation)フィールドは 空値の場合に null を返す。この挙動を型定義に正しく反映させる。 - relation フィールドの型を XxxContent | null に変更 - 全フィールドタイプの型マッピング網羅テストを追加 - 共通型の microcms-js-sdk 互換性テストを追加 Co-authored-by: Ryusei Sugita <wato787@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
microCMSの公式仕様と照らし合わせ、型生成の誤りを修正しました。特にセレクトフィールドと複数コンテンツ参照の型定義を改善します。
背景 / 目的
microCMSのContent APIレスポンスとManagement APIのフィールド定義に沿った、より正確な型を生成するため、開発時の型安全性を向上させることが目的です。
変更内容
string[]または("選択肢1" | "選択肢2")[]に修正 (単一選択も配列に)。relationList) の型を参照先APIエンドポイント名Content[]に修正。selectItems) をパースする機能を追加。動作確認
bun run build影響範囲
stringとして扱われていた場合)に依存している箇所は型エラーになる可能性があります。補足
string[]になる点)と、relationListが参照先の型を持つようになる点をご確認ください。selectItemsのパースにより、セレクトフィールドの選択肢が型に反映されるようになりました。