feat: /list/invoicesと/invoiceを/invoicesに統一#24
Conversation
📝 WalkthroughWalkthroughこのPRでは、請求書(invoice)リソースへのアクセスパスを統合します。既存の Changes請求書エンドポイントの統合
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
openapi.yamlserver/gen.go
| get: | ||
| summary: 請求書由来の入金一覧を取得 | ||
| tags: | ||
| - Invoice | ||
| operationId: getInvoices |
There was a problem hiding this comment.
GET /invoices に description を追加してください。
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.
| 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.
| responses: | ||
| '200': | ||
| description: OK | ||
| content: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Invoice' | ||
| '403': | ||
| $ref: '#/components/responses/Forbidden' | ||
| '500': |
There was a problem hiding this comment.
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.
| 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.
close #20
Summary by CodeRabbit
/invoicesで利用可能に。statusおよびcollection_methodクエリパラメータを追加し、より詳細なフィルタリングに対応