fix(cli): correct subscription create payload field names#2724
Conversation
…ayload The create subscription command was sending `subscriptionPlanId` in the JSON request body, but the DevPortal API expects `subscriptionPlanName`. This caused the unit test to fail and would have sent the wrong field to the server at runtime.
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe subscription creation command now uses ChangesSubscription creation payload
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 1
🤖 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 `@cli/src/cmd/devportal/subscription/create.go`:
- Line 114: Update the payload construction in the subscription creation flow to
use the key subscriptionPlanId instead of subscriptionPlan, preserving the
existing selected subscriptionPlan value so downstream consumers receive the
expected plan identifier.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5f44a7b9-b34a-463e-a4ce-2c087cc6777f
📒 Files selected for processing (1)
cli/src/cmd/devportal/subscription/create.go
The CLI was sending `apiId` and `subscriptionPlanName` in the subscription create request body. The DevPortal API (devportal-openapi-spec-v0.9.yaml, SubscriptionCreateRequest) requires `artifactId` and `subscriptionPlanId`, which the subscriptionService.js also confirms at the destructuring site. Update both the payload builder and the test assertions accordingly.
Purpose
The `ap devportal subscription create` command was sending incorrect JSON field names in the request body. The DevPortal API (`devportal-openapi-spec-v0.9.yaml`, `SubscriptionCreateRequest`) requires `artifactId` and `subscriptionPlanId`, but the CLI was sending `apiId` and `subscriptionPlanName`. This caused the unit tests to fail and would have silently sent invalid payloads to the DevPortal at runtime.
Goals
Correct both field names in the subscription create payload so the CLI sends requests that the DevPortal API and its underlying service (`subscriptionService.js`) can parse correctly.
Approach
User stories
As a CLI user, running `ap devportal subscription create --api-id --subscription-plan ` should create a subscription with a valid request body that the DevPortal accepts.
Documentation
N/A — no user-visible behaviour change beyond the bug fix.
Automation tests
Security checks
Samples
N/A
Related PRs
N/A
Test environment