Skip to content

fix: remove subscription's settlement mode default value - #4521

Merged
tothandras merged 1 commit into
mainfrom
fix/subscription-settlement-mode-default-value
Jun 12, 2026
Merged

fix: remove subscription's settlement mode default value#4521
tothandras merged 1 commit into
mainfrom
fix/subscription-settlement-mode-default-value

Conversation

@borosr

@borosr borosr commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

With this fix, the subscription's settlement mode can be inherited from the plan.

Summary by CodeRabbit

  • Breaking Changes
    • Removed exported subscription input type variants (SubscriptionCreateInput, SubscriptionInput, SubscriptionChangeInput, SubscriptionPagePaginatedResponseInput, SubscriptionChangeResponseInput) from the JavaScript client package.
    • The settlement_mode field in subscription operations is now optional without a default value. Previously, it defaulted to credit_then_invoice when omitted.

@borosr
borosr requested review from GAlexIHU, rolosp and tothandras June 12, 2026 12:11
@borosr borosr self-assigned this Jun 12, 2026
@borosr
borosr requested a review from a team as a code owner June 12, 2026 12:11
@borosr borosr added release-note/bug-fix Release note: Bug Fixes Bug labels Jun 12, 2026
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: df41e329-1065-43b2-aa46-a86399a27aae

📥 Commits

Reviewing files that changed from the base of the PR and between fda362f and 67cde58.

⛔ Files ignored due to path filters (1)
  • api/v3/openapi.yaml is excluded by !**/openapi.yaml
📒 Files selected for processing (6)
  • api/spec/packages/aip-client-javascript/src/index.ts
  • api/spec/packages/aip-client-javascript/src/models/operations/subscriptions.ts
  • api/spec/packages/aip-client-javascript/src/models/schemas.ts
  • api/spec/packages/aip-client-javascript/src/models/types.ts
  • api/spec/packages/aip/src/subscriptions/subscription.tsp
  • api/v3/api.gen.go
💤 Files with no reviewable changes (1)
  • api/spec/packages/aip-client-javascript/src/index.ts

📝 Walkthrough

Walkthrough

This PR consolidates subscription type handling by removing implicit settlement_mode defaults, eliminating redundant *Input type variants, and updating Zod schemas and request types for consistency across the TypeScript client.

Changes

Subscription Type Consolidation

Layer / File(s) Summary
Source specification settlement_mode update
api/spec/packages/aip/src/subscriptions/subscription.tsp
The Subscription model's settlement_mode field removes its explicit default value assignment, becoming a truly optional field without implicit fallback behavior.
Type contract and Input interface consolidation
api/spec/packages/aip-client-javascript/src/models/types.ts
SubscriptionCreate, Subscription, and SubscriptionChange interfaces make settlement_mode optional; the redundant SubscriptionCreateInput, SubscriptionInput, and SubscriptionChangeInput generated interfaces are removed while SubscriptionCancelInput is preserved.
Zod schemas and request type alignment
api/spec/packages/aip-client-javascript/src/models/schemas.ts, api/spec/packages/aip-client-javascript/src/models/operations/subscriptions.ts
Zod schemas for subscriptionCreate, subscription, and subscriptionChange drop .default('credit_then_invoice') calls, making them truly optional; request type imports switch from *Input variants (SubscriptionCreateInput, SubscriptionChangeInput) to non-Input types (SubscriptionCreate, SubscriptionChange).
Public API export cleanup
api/spec/packages/aip-client-javascript/src/index.ts
Index re-exports remove SubscriptionCreateInput, SubscriptionInput, SubscriptionPagePaginatedResponseInput, SubscriptionChangeResponseInput, and SubscriptionChangeInput, leaving only SubscriptionCancelInput among subscription-related input types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • openmeterio/openmeter#4181: Updates MapSubscriptionViewToAPI to include settlement_mode in payload mapping alongside the optional field changes in this PR.
  • openmeterio/openmeter#4501: Directly overlaps with subscription type consolidation in index.ts, models/types.ts, models/schemas.ts, and models/operations/subscriptions.ts regarding settlement_mode optionality and *Input variant usage.
🚥 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 The title clearly and concisely describes the main change: removing a default value from the subscription's settlement_mode field across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 fix/subscription-settlement-mode-default-value

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.

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Removes the credit_then_invoice default value from settlement_mode on the Subscription TypeSpec model, making the field fully optional with no server-side default. All downstream artifacts are consistently regenerated.

  • TypeSpec root change (subscription.tsp): drops = ProductCatalog.SettlementMode.CreditThenInvoice from the optional settlement_mode field; the OpenAPI spec and Go embedded spec follow mechanically.
  • TypeScript SDK types (types.ts, schemas.ts, operations/subscriptions.ts): settlement_mode becomes optional (?) in SubscriptionCreate, Subscription, and SubscriptionChange; the five …Input variant interfaces are correctly removed since input and output shapes no longer diverge.
  • Public barrel (index.ts): re-exports for the five deleted …Input types are removed, constituting a semver-breaking SDK change for any consumer that imported them directly.

Confidence Score: 5/5

Safe to merge. The change is a clean, fully-propagated removal of a server-side default; all generated artifacts are consistent with the TypeSpec source.

The single-line TypeSpec change cascades correctly through every generated layer: OpenAPI schema, zod schemas, TypeScript types, request-body aliases, and barrel exports. The removal of the five Input divergence-variant interfaces is logically correct — they existed solely because the defaulted field created an input/output shape difference, which no longer exists.

No files require special attention. The most consumer-visible change is the deletion of five publicly exported Input types from index.ts; teams using the JS SDK directly should be aware this is a breaking export removal.

Important Files Changed

Filename Overview
api/spec/packages/aip/src/subscriptions/subscription.tsp Root change: removes the default from the optional settlement_mode field, making it truly optional (no server-side default) on all three visibility facets.
api/spec/packages/aip-client-javascript/src/models/types.ts Correctly makes settlement_mode optional in SubscriptionCreate, Subscription, and SubscriptionChange; removes five Input variant interfaces since the field no longer diverges between input and output shapes.
api/spec/packages/aip-client-javascript/src/models/schemas.ts Removes .default('credit_then_invoice') from the three zod schemas, keeping .optional() on each. Consistent with the TypeSpec change.
api/spec/packages/aip-client-javascript/src/models/operations/subscriptions.ts Correctly replaces Input variant types with base types for CreateSubscriptionRequest and ChangeSubscriptionRequest.body.
api/spec/packages/aip-client-javascript/src/index.ts Removes public barrel exports for the five deleted Input types.
api/v3/openapi.yaml Removes default: credit_then_invoice from settlement_mode in three OpenAPI component schemas.
api/v3/api.gen.go Auto-generated embedded Swagger spec updated to reflect the three default removals in openapi.yaml.

Reviews (1): Last reviewed commit: "fix: remove subscription's settlement mo..." | Re-trigger Greptile

@tothandras
tothandras merged commit 097ee63 into main Jun 12, 2026
42 of 46 checks passed
@tothandras
tothandras deleted the fix/subscription-settlement-mode-default-value branch June 12, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug release-note/bug-fix Release note: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants