Skip to content

feat: ログインユーザーのセッション情報を取得する GET /me エンドポイントを新設#35

Open
reiroop wants to merge 3 commits into
feature/issue-11from
feature/issue-34
Open

feat: ログインユーザーのセッション情報を取得する GET /me エンドポイントを新設#35
reiroop wants to merge 3 commits into
feature/issue-11from
feature/issue-34

Conversation

@reiroop
Copy link
Copy Markdown
Collaborator

@reiroop reiroop commented May 28, 2026

Close #34

Summary by CodeRabbit

リリースノート

  • New Features

    • 新しい /me エンドポイントを追加しました。
  • Bug Fixes

    • セッションクッキー名を更新しました(__Host-checkin_session__Host-checkin_email_verified_session)。
  • Changes

    • APIエンドポイントのパス構造を統一しました(/customer/customers/invoices/checkout/sessions)。
    • セキュリティ要件を複数のエンドポイントに追加・強化しました。
    • APIレスポンス形式を最適化しました。

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b93c487d-45aa-4b89-bdb2-bd40f6f8c8ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

OpenAPI 3.1.0仕様を更新し、ユーザーセッション情報を取得するGET /meエンドポイントを新設、既存エンドポイント経路を統合(/customer/customersなど)、セキュリティ要件とスキーマ契約を統一化。対応するサーバー生成Goコード(型、インタフェース、ルート登録)を同期更新しました。

Changes

API仕様とサーバーコード生成の統一化

Layer / File(s) Summary
ユーザーセッション情報エンドポイント(GET /me)と認証スキーム
openapi.yaml, server/gen.go
新しいGET /meエンドポイントを定義し、MeResponseスキーマ(email、traq_id、is_admin、customer_id)を導入。認証不要として設計。セキュリティスキーム(EmailVerifiedSession、NewShowcaseAuth、CsrfTokenHeader)をコンポーネントで統一定義。サーバー側でGetMeメソッドとwrapper実装を追加。
メール検証フローのスキーマ更新とセッションクッキー変更
openapi.yaml, server/gen.go
/verify-email/confirmのリクエスト/レスポンススキーマをPostVerifyEmailConfirmRequestPostVerifyEmailResponseに置換。セッションクッキー名を__Host-checkin_sessionから__Host-checkin_email_verified_sessionに変更。POST時のsecurity制約を明示。サーバー側でリクエストボディalias定義を更新。
顧客エンドポイントの統合と更新スキーマの導入
openapi.yaml, server/gen.go
/customerから/customersへパスを統合。GET/POST/PATCHにEmailVerifiedSessionNewShowcaseAuthセキュリティを付与。PatchCustomerRequestスキーマを新規追加。サーバー側でGetCustomerParams型定義と更新されたwrapper実装を整備。
請求書エンドポイントの統合と新しいレスポンス契約
openapi.yaml, server/gen.go
/list/invoicesから/invoicesへ統合。GET操作に複数のクエリパラメータ(status、collection_method等)とセキュリティを追加。InvoiceStatusを独立enumスキーマとして抽出。GetInvoicesResponseを新規定義してレスポンス契約を再構成。POSTレスポンスをCreateInvoiceResponseからPostInvoiceResponseに置換。webhookにsecurity: []を追加。サーバー側で対応する型定義とparams構造体を更新。
Checkout Sessionsエンドポイントの再構成
openapi.yaml, server/gen.go
/list/checkout-sessionsから/checkout/sessionsへ統合。GET操作にセキュリティ制約を付与。adminエンドポイントのセキュリティも更新。サーバー側で型定義を整理。
サーバーコード生成の同期と新しいルート登録
server/gen.go
ServerInterfaceServerInterfaceWrapperを更新。PatchCustomerPostCustomerPostInvoiceのシグネチャから直接パラメータ引数を削除し、ctx.Setパターンへ移行。RegisterHandlersWithBaseURLのルート登録を新しいパスへ変更。埋め込まれたSwagger仕様をbase64/gzipで更新。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • traPtitech/Checkin-openapi#10: Both PRs update the OpenAPI + generated server/gen.go around the same auth/CSRF+cookie flow and verify-email/confirm endpoints (including shared StripeEvent/invoice webhook contract and related cookie/CSRF schema/type plumbing), so the main PR's changes build directly on the retrieved PR's API surface adjustments.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning GET /me エンドポイント新設と関連する OpenAPI 仕様更新が主体だが、同時に /customer → /customers、/list/invoices → /invoices、/list/checkout-sessions → /checkout/sessions など既存パスのリネームも含まれており、これらは Issue #34 の範囲外の変更である。 既存エンドポイントのリネーム変更を別のプルリクエストに分離するか、またはこれらの変更をカバーする新たなリンク Issue を作成・参照してください。
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは「ログインユーザーのセッション情報を取得する GET /me エンドポイントを新設」であり、OpenAPI仕様ファイルおよびserver/gen.goの主要な変更内容である GET /me エンドポイントの追加と完全に一致している。
Linked Issues check ✅ Passed リンク Issue #34 の要件(GET /me エンドポイント新設、MeResponse スキーマ定義、security: []設定)がすべて実装されており、レスポンススキーマは email/traq_id/is_admin/customer_id を備えた仕様と合致している。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue-34

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@reiroop reiroop changed the base branch from main to feature/issue-11 May 28, 2026 00:03
@reiroop reiroop requested a review from kaitoyama May 28, 2026 00:04
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
openapi.yaml (1)

16-17: ⚡ Quick win

operation の description を追加して lint 警告を解消してください

Spectral 警告どおり、主要 operation の説明が欠けています。API ドキュメント品質とレビュー効率のため、description を追加するのがよいです。

Also applies to: 42-43, 133-134, 227-228

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@openapi.yaml` around lines 16 - 17, Add a descriptive "description" field to
each OpenAPI operation that only has a "summary" (e.g., the POST operation with
summary "isct メールアドレスの確認メールを送信" and the other operations referenced at 42-43,
133-134, 227-228) to satisfy Spectral linting; the description should be a short
sentence (in Japanese to match existing text) explaining the operation’s intent,
expected input and key side effects (e.g.,
"指定したメールアドレスに確認メールを送信します。リクエストはメールアドレスを含む JSON ボディを期待し、成功時に 202 を返します。"), and
add similar concise descriptions to the other operations with missing
descriptions so each operation object includes both summary and description.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@openapi.yaml`:
- Around line 715-730: The schema for the /me response uses OpenAPI 3.1 where
nullable: true is not supported; update the properties email, traq_id, and
customer_id in the /me schema to use JSON Schema union types instead of nullable
(e.g., set their type to ["string","null"]), leaving is_admin as a plain
boolean; ensure you modify the properties named email, traq_id, and customer_id
in the /me response object so generated clients will correctly accept null
values.

---

Nitpick comments:
In `@openapi.yaml`:
- Around line 16-17: Add a descriptive "description" field to each OpenAPI
operation that only has a "summary" (e.g., the POST operation with summary "isct
メールアドレスの確認メールを送信" and the other operations referenced at 42-43, 133-134,
227-228) to satisfy Spectral linting; the description should be a short sentence
(in Japanese to match existing text) explaining the operation’s intent, expected
input and key side effects (e.g., "指定したメールアドレスに確認メールを送信します。リクエストはメールアドレスを含む JSON
ボディを期待し、成功時に 202 を返します。"), and add similar concise descriptions to the other
operations with missing descriptions so each operation object includes both
summary and description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5e4817c8-d3a6-461a-903f-e599ccc58de9

📥 Commits

Reviewing files that changed from the base of the PR and between 913b903 and 3eb8b70.

📒 Files selected for processing (2)
  • openapi.yaml
  • server/gen.go

Comment thread openapi.yaml
@reiroop reiroop force-pushed the feature/issue-34 branch from 11b572d to b68cdea Compare May 28, 2026 15:00
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.

ログインユーザーのセッション情報を取得する GET /me エンドポイントの新設

1 participant