Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
yutteee
reviewed
Oct 28, 2025
Contributor
yutteee
left a comment
There was a problem hiding this comment.
commented
API呼び出し側のコードがどうなるかが気になりました!
api呼び出すたびにfe側でzod.parseする必要があるのかなぁというのが気になってます
Comment on lines
+31
to
+34
| return new Response(JSON.stringify(viewModel), { | ||
| headers: corsHeaders, | ||
| status: 200, | ||
| }); |
Contributor
There was a problem hiding this comment.
📝
json型でいい
NextResponse.jsonが正しいかも
| import { extendZodWithOpenApi } from "@asteasolutions/zod-to-openapi"; | ||
|
|
||
| // ZodをOpenAPI対応に拡張 | ||
| extendZodWithOpenApi(z); |
Comment on lines
+43
to
+76
| /** | ||
| * ZodErrorを適切なHTTPエラーレスポンスに変換する(詳細版) | ||
| * @param error - ZodError | ||
| * @returns エラーメッセージと詳細情報 | ||
| */ | ||
| export function formatZodErrorDetailed(error: ZodError) { | ||
| return { | ||
| message: "データの形式が正しくありません", | ||
| details: | ||
| error.issues?.map((err) => ({ | ||
| path: err.path.join("."), | ||
| message: err.message, | ||
| code: err.code, | ||
| received: err.input, // 実際に受信した値 | ||
| })) || [], | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * ZodErrorを適切なHTTPエラーレスポンスに変換する | ||
| * @param error - ZodError | ||
| * @returns エラーメッセージと詳細情報 | ||
| */ | ||
| export function formatZodError(error: ZodError) { | ||
| return { | ||
| message: "データの形式が正しくありません", | ||
| details: | ||
| error.issues?.map((err) => ({ | ||
| path: err.path.join("."), | ||
| message: err.message, | ||
| code: err.code, | ||
| })) || [], | ||
| }; | ||
| } |
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.
タイトル
概要
変更内容
スクリーンショット
備考
型をチェックするようになったら動かなくなります.
動きません.jsonを直そう...