Skip to content

add: 既存バックエンドAPIのOpenAPI定義を追加#5

Open
ayuayuyu wants to merge 2 commits intomainfrom
feature/openapi
Open

add: 既存バックエンドAPIのOpenAPI定義を追加#5
ayuayuyu wants to merge 2 commits intomainfrom
feature/openapi

Conversation

@ayuayuyu
Copy link
Copy Markdown
Collaborator

OpenAPIを作成

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

既存バックエンド API の OpenAPI 3.0 定義(openapi.yaml)を新規追加し、各エンドポイント/リクエスト/レスポンスのスキーマをドキュメント化する PR です。

Changes:

  • OpenAPI 3.0.3 の定義ファイルを新規追加
  • User / Charge / Purchase / Balance / Item / Health の各 API を paths と schemas で記述
  • 共通の ErrorResponse、パラメータ(UserId)を components に定義

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +29 to +33
/v1/user:
post:
tags: [user]
summary: ユーザー登録
operationId: registerUser
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

POST のユーザー登録エンドポイントが /v1/user と定義されていますが、実装側は app/server/server.go:95-97/v1/user/r.Post("/"))を登録しており、middleware.StripSlashes 等が無い限り /v1/user では 404 になる可能性があります。OpenAPI 側を /v1/user/ に合わせるか、サーバ側でスラッシュ正規化(StripSlashes/RedirectSlashes)を入れて /v1/user/v1/user/ の両方を受けるようにしてください。

Copilot uses AI. Check for mistakes.
Comment on lines +299 to +304
/v1/item:
post:
tags: [item]
summary: 商品登録
operationId: registerItem
requestBody:
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

/v1/item の POST/PATCH/GET(一覧) がスラッシュ無しで定義されていますが、実装は app/server/server.go:106-112/v1/item/r.Post("/"), r.Patch("/"), r.Get("/"))として登録されています。スラッシュ正規化ミドルウェアが無い場合、ドキュメント通り /v1/item を叩くと一致しないため、OpenAPI のパスを /v1/item/ にするかサーバ側で /v1/item も受けるよう統一してください。

Copilot uses AI. Check for mistakes.
Comment on lines +410 to +414
/v1/health:
get:
tags: [health]
summary: ヘルスチェック
operationId: healthCheck
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

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

ヘルスチェックが /v1/health と定義されていますが、実装側は app/server/server.go:114-117/v1/health/r.Get("/"))を登録しています。スラッシュ正規化が無い場合に実際の到達パスとズレるので、OpenAPI のパスを /v1/health/ に合わせるか、サーバ側で /v1/health/v1/health/ を両対応にしてください。

Copilot uses AI. Check for mistakes.
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