クラウド請求書 API v3 のサポートを追加#8
Merged
Merged
Conversation
クラウド会計 API に加えて MoneyForward クラウド請求書 API v3 を扱える ようにし、AI エージェントから請求書ドラフトを CRUD できるようにする。 - iv_openapi.yaml を埋め込み、`mf describe --api invoice` で参照可能に - `mf invoices` (list/get/create/update/delete) と `mf invoice-partners` / `mf invoice-departments` / `mf invoice-items` を追加 - OAuth スコープに mfc/invoice/data.read / .write を追加(AllScopes のみ) - 内部設計: 既存 *api.Client を再利用しつつ NewInvoiceClient で invoice 用ベース URL を持つ第二インスタンスを生成 - 新コマンドは DI + pure runner + RunE wrapper パターンで testable に - 数値精度保持のため json.Number ベースで decode、未知フィールドや trailing data も拒否 - describe parser に path-item parameters マージ、requestBody.\$ref 解決、root-level security フォールバック、HTTP method ベースの read/write スコープ優先選択を追加
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
概要
クラウド会計 API に加えて マネーフォワード クラウド請求書 API v3 を扱えるようにし、AI エージェントから請求書ドラフトを CRUD できるようにする。
変更内容
iv_openapi.yamlを埋め込み、mf describe --api invoiceで参照可能にmf invoices(list/get/create/update/delete)、mf invoice-partners、mf invoice-departments、mf invoice-itemsmfc/invoice/data.read/.writeを追加(AllScopesのみ。DefaultScopesは変更なし)internal/api.NewInvoiceClientを追加して invoice 用ベース URL の第二クライアントを生成、*api.Client本体は共通利用RunEwrapper パターンで testable に(cmd/invoice_deps.go)json.Numberベースで decode、未知フィールド・trailing data・不正 JSON は拒否requestBody.$refの 1 段解決、root-level security フォールバック、HTTP method ベースの read/write スコープ優先選択を追加Codex ローカルレビューの結果
exitInvoiceAPIErrorで friendly remediation hint が消えていた →output.PrintError直書きに変更UpdateBillingRequest.Itemsは spec 非対応 → 削除dry-runURL がurl.PathEscapeをバイパス → 適用NormalizeInvoiceBaseURLが?のみ URL を許容 →ForceQueryも拒否maxLengthがバイト基準 →utf8.RuneCountInStringに変更tag_namesの空配列を明示送信できなかった →*[]string化DisallowUnknownFields+ 再 Decode でio.EOF期待describeのrequired_scopeが空表示 → root-level security フォールバック追加--qの排他チェックが厳しすぎた → spec 通り 4 フラグに限定scopes[0]返却 → GET は.read優先 / 他は.write優先テスト
go test -race ./...: 全パッケージ通過golangci-lint run ./...: 0 issuesmf describe --api invoice invoicesでBillingNewTemplateCreateRequestが表示されることを確認