-
Notifications
You must be signed in to change notification settings - Fork 152
chore: invocing fixes #3520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: invocing fixes #3520
Conversation
Two changes: - The detailed line type was not properly set in the schema (the detailed string was used previously) - Deprecate detailed line's invoiceAt field, as that is always the same as the parent line's
📝 WalkthroughWalkthroughThis pull request updates API schemas across specification, OpenAPI documentation, and generated TypeScript types to refine invoice line handling, introduce new invoice management capabilities, and enrich notification event payloads. Key changes include renaming an InvoiceLineStatus enum value from 'detail' to 'detailed', adding a deprecated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes The changes span multiple file types and layers (specification, OpenAPI, generated types) with a mix of enum updates, deprecations, and new schema introductions. While some patterns repeat across files, each schema adjustment requires separate reasoning to verify correctness and backward compatibility. Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
api/spec/src/billing/invoices/invoice.tsp (1)
765-772: Consider making the deprecatedinvoiceAtfield optional.The deprecation strategy is implemented correctly with a clear message directing users to the parent line's
invoiceAtfield. However, the field is still required (no?operator), which is unusual for deprecated fields and may cause confusion during the transition period.Consider making the field optional to signal its deprecated status more clearly:
/** * The time this line item should be invoiced. */ #deprecated "Use invoiceAt from the parent line instead, this field will be removed in the future versions of the API" @visibility(Lifecycle.Read, Lifecycle.Create, Lifecycle.Update) - invoiceAt: DateTime; + invoiceAt?: DateTime;Alternatively, if the field must remain required for backward compatibility, consider documenting this requirement in the deprecation notice.
api/client/javascript/src/client/schemas.ts (1)
6404-6404: Docstring has typos.Please fix the wording to something like “Subscriptions are the references to the subscriptions that this line is related to.” Right now it reads “Subscription are … subscritpions.”
api/openapi.cloud.yaml (1)
18082-18087: MarkinvoiceAtas read-only.We’re deprecating this field because it’s always derived from the parent line, so clients shouldn’t be sending it back. Without
readOnly: true, the spec still advertises it as writable. Flag it read-only to match the actual behavior and avoid client confusion.invoiceAt: type: string format: date-time description: The time this line item should be invoiced. example: '2023-01-01T01:01:01.001Z' deprecated: true + readOnly: true
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
api/client/javascript/src/client/schemas.ts(2 hunks)api/openapi.cloud.yaml(2 hunks)api/openapi.yaml(2 hunks)api/spec/src/billing/invoices/invoice.tsp(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Artifacts / Benthos Collector Container image
- GitHub Check: Artifacts / Container image
- GitHub Check: Code Generators
- GitHub Check: Migration Checks
- GitHub Check: Lint
- GitHub Check: Test
- GitHub Check: Build
- GitHub Check: Repository Scan
- GitHub Check: Analyze (go)
🔇 Additional comments (5)
api/spec/src/billing/invoices/invoice.tsp (2)
765-772: LGTM! Clear deprecation strategy.The approach of omitting
invoiceAtfrom the base properties and then re-introducing it as a deprecated field is a good pattern for managing the deprecation lifecycle. The deprecation message clearly guides users to use the parent line'sinvoiceAtinstead and sets expectations for future removal.
477-477: Confirm removal of the old'detail'enum value and update migration/docs
- Run a targeted search for any use of the old literal, e.g.:
rg -nP "InvoiceLineStatus\.(detail|detailed)" -g '*.ts' -g '*.go' -g '*.py'- Verify client-SDKs, examples, tests and OpenAPI samples no longer reference
'detail'- Add release-note entry for this breaking change and include any DB-migration steps to handle existing records
api/openapi.yaml (2)
18565-18570: Good call on deprecatinginvoiceAt.Exposing it once at the base line level while marking it deprecated keeps clients aware without encouraging new usage. Implementation looks correct.
19241-19245: Enum rename matches the actual status token.Switching to
detailedbrings the schema in sync with produced values and unblocks client codegen.api/openapi.cloud.yaml (1)
18567-18571: Verify ‘detailed’ enum in API responses. Ensure the backend emits and accepts thedetailedstatus literal—sample your staging or production API (e.g.,curl -sS https://api.staging.openmeter.io/invoices | jq -r '.[].status') to confirm.
Overview
Two changes:
Notes for reviewer
Summary by CodeRabbit
Bug Fixes
API Enhancements
invoiceAtfield on invoice lines.