Skip to content

feat: /list/invoicesと/invoiceを/invoicesに統一#24

Open
reiroop wants to merge 1 commit into
mainfrom
feature/issue-20
Open

feat: /list/invoicesと/invoiceを/invoicesに統一#24
reiroop wants to merge 1 commit into
mainfrom
feature/issue-20

Conversation

@reiroop
Copy link
Copy Markdown
Collaborator

@reiroop reiroop commented May 22, 2026

close #20

Summary by CodeRabbit

  • API Changes
    • 請求書一覧取得エンドポイントが /invoices で利用可能に。status および collection_method クエリパラメータを追加し、より詳細なフィルタリングに対応

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

このPRでは、請求書(invoice)リソースへのアクセスパスを統合します。既存のGET /list/invoicesを削除し、GET /invoicesエンドポイントを新設。statusおよびcollection_methodのクエリパラメータサポートを追加して、OpenAPI仕様と生成されるGoサーバーコード全体を更新。

Changes

請求書エンドポイントの統合

Layer / File(s) Summary
OpenAPI仕様定義の更新
openapi.yaml
GET /invoicesエンドポイントを新規定義し、statuscollection_methodをクエリの列挙値として追加。既存のGET /list/invoicesパスを削除して、入金一覧取得を新パスに統合。
生成パラメータ型と定数の更新
server/gen.go
GetInvoicesParamsstatuscollection_methodフィールドを追加し、対応するステータス定数ブロックを再配置。GetCheckoutSessionsParamsの構造を整理し、関連する型定義の順序を組み替え。
サーバーハンドラ実装とルーティング
server/gen.go
ServerInterfaceおよびServerInterfaceWrapperのメソッド順序を再構成。GetInvoicesハンドラでstatuscollection_methodのクエリバインドを実装。RegisterHandlersWithBaseURLのルーティング登録を更新して、GET/POST /invoicesを新パスに割り当て。
埋め込みSwagger仕様の更新
server/gen.go
base64エンコード・gzip圧縮されたSwagger仕様の埋め込み文字列を、OpenAPI仕様の変更に対応して更新。

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトルは、/list/invoicesと/invoiceを/invoicesに統一するという主要な変更を明確かつ簡潔に要約しており、ファイル変更内容と一致している。
Linked Issues check ✅ Passed リンクされたissue #20の要件「/list/invoicesと/invoiceを/invoicesに統一」がopenapi.yamlとserver/gen.goの変更で完全に実装されている。
Out of Scope Changes check ✅ Passed すべての変更はissue #20の統一要件の実装に直結しており、スコープ外の変更は検出されない。
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue-20

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 requested a review from kaitoyama May 22, 2026 05:11
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: 2

🤖 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 221-225: The GET /invoices operation (operationId: getInvoices) is
missing a description, which triggers Spectral's operation-description rule; add
a descriptive "description" field under the get operation for this endpoint
(next to summary, tags, operationId) that explains what the endpoint returns,
any important query parameters or filters, and expected behavior/usage so the
generated docs include sufficient detail.
- Around line 251-260: The OpenAPI response list for this endpoint is missing a
400 response which causes a spec/implementation mismatch; add a '400' response
entry under the responses block (alongside '200', '403', '500') that either
references an existing reusable response (e.g. $ref:
'`#/components/responses/BadRequest`') or defines an inline BadRequest
schema/body, so client generation and error handling match the wrapper behavior
for query bind failures (e.g. when validating limit); update the responses
section that currently references the Invoice schema to include this new '400'
entry.
🪄 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: 330da3a7-bd40-4d2b-a7bd-ad1e201f73fc

📥 Commits

Reviewing files that changed from the base of the PR and between 913b903 and 367ac05.

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

Comment thread openapi.yaml
Comment on lines +221 to +225
get:
summary: 請求書由来の入金一覧を取得
tags:
- Invoice
operationId: getInvoices
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

GET /invoicesdescription を追加してください。

summary だけだと Spectral の operation-description に引っかかるので、このエンドポイントだけ生成ドキュメントの情報量が落ちます。

📝 追加例
   /invoices:
     get:
       summary: 請求書由来の入金一覧を取得
+      description: 条件に一致する請求書由来の入金一覧を取得
       tags:
         - Invoice
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
get:
summary: 請求書由来の入金一覧を取得
tags:
- Invoice
operationId: getInvoices
get:
summary: 請求書由来の入金一覧を取得
description: 条件に一致する請求書由来の入金一覧を取得
tags:
- Invoice
operationId: getInvoices
🧰 Tools
🪛 GitHub Check: Run Spectral

[warning] 221-221:
operation-description Operation "description" must be present and non-empty string. paths./invoices.get

🤖 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 221 - 225, The GET /invoices operation
(operationId: getInvoices) is missing a description, which triggers Spectral's
operation-description rule; add a descriptive "description" field under the get
operation for this endpoint (next to summary, tags, operationId) that explains
what the endpoint returns, any important query parameters or filters, and
expected behavior/usage so the generated docs include sufficient detail.

Comment thread openapi.yaml
Comment on lines +251 to +260
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Invoice'
'403':
$ref: '#/components/responses/Forbidden'
'500':
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

400 BadRequest をレスポンス仕様に含めてください。

このエンドポイントは limit などのクエリバインド失敗時に生成 wrapper 側で 400 を返しますが、OpenAPI には 200/403/500 しか載っていません。実装と契約がずれるので、クライアント生成やエラーハンドリングの前提がずれます。

🧩 追記例
       responses:
         '200':
           description: OK
           content:
             application/json:
               schema:
                 $ref: '`#/components/schemas/Invoice`'
+        '400':
+          $ref: '`#/components/responses/BadRequest`'
         '403':
           $ref: '`#/components/responses/Forbidden`'
         '500':
           $ref: '`#/components/responses/InternalServerError`'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Invoice'
'403':
$ref: '#/components/responses/Forbidden'
'500':
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '`#/components/schemas/Invoice`'
'400':
$ref: '`#/components/responses/BadRequest`'
'403':
$ref: '`#/components/responses/Forbidden`'
'500':
$ref: '`#/components/responses/InternalServerError`'
🤖 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 251 - 260, The OpenAPI response list for this
endpoint is missing a 400 response which causes a spec/implementation mismatch;
add a '400' response entry under the responses block (alongside '200', '403',
'500') that either references an existing reusable response (e.g. $ref:
'`#/components/responses/BadRequest`') or defines an inline BadRequest
schema/body, so client generation and error handling match the wrapper behavior
for query bind failures (e.g. when validating limit); update the responses
section that currently references the Invoice schema to include this new '400'
entry.

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.

/list/invoices/invoice/invoicesに統一したい

1 participant