Skip to content

Rename apiId to artifactId in subscription REST APIs#2709

Merged
Piumal1999 merged 2 commits into
wso2:mainfrom
Piumal1999:sub-artifactId
Jul 15, 2026
Merged

Rename apiId to artifactId in subscription REST APIs#2709
Piumal1999 merged 2 commits into
wso2:mainfrom
Piumal1999:sub-artifactId

Conversation

@Piumal1999

Copy link
Copy Markdown
Contributor

Purpose

Fix a naming inconsistency in the /subscriptions REST APIs.

Approach

Previously in subscription related REST APIs, the request/response bodies had apiId field. Since the subscriptions are not limited for RestApis, but also applicable for MCP proxies, this had to be changed to artifactId. No internal changes were needed since the artifact resolution was already kind-based.

Samples

N/A

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Piumal1999, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b3c96a32-cd97-41c2-b213-6c9577f03c1c

📥 Commits

Reviewing files that changed from the base of the PR and between adde133 and 96a33d0.

📒 Files selected for processing (2)
  • tests/integration-e2e/steps_devportal_lifecycle_test.go
  • tests/integration-e2e/steps_secured_test.go
📝 Walkthrough

Walkthrough

Subscription creation, listing, generated models, response mapping, and OpenAPI documentation now use artifactId instead of apiId. Artifact metadata is resolved for subscription responses with UUID fallback behavior.

Changes

Subscription artifact identifier migration

Layer / File(s) Summary
Subscription API contract updates
platform-api/api/generated.go, platform-api/resources/openapi.yaml
Generated request, response, and list-filter models and the OpenAPI schemas replace apiId with artifactId.
Creation and listing artifact inputs
platform-api/internal/handler/subscription_handler.go
Creation validates and forwards artifactId; listing accepts the new filter and resolves artifact metadata by UUID.
Artifact response shaping
platform-api/internal/handler/subscription_handler.go
Response helpers emit artifactId using artifact metadata, falling back to the artifact UUID.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: thushani-jayasekera, malinthaprasan

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers purpose and approach, but most required template sections are missing. Add the missing Goals, Documentation, Automation tests, Security checks, Related PRs, and Test environment sections, or mark them N/A with brief context.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title is concise and accurately describes the main API field rename.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Piumal1999 Piumal1999 changed the title Rename apiId to artifactId in subscription APIs Rename apiId to artifactId in subscription REST APIs Jul 15, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
platform-api/internal/handler/subscription_handler.go (1)

159-159: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Return early if the subscription list is empty.

When len(list) == 0, the handler continues execution and issues three backend queries (GetArtifactMetadataMap, GetPlanNameMap, and SubsForUUIDs) passing empty slices. Returning early avoids these unnecessary allocations and database/service calls.

♻️ Proposed refactor
 	if err != nil {
 		var appErr *apperror.Error
 		if errors.As(err, &appErr) {
 			return err
 		}
 		return serviceError(err, fmt.Sprintf("failed to list subscriptions for artifact %s in org %s", artifactId, orgId))
 	}
+
+	if len(list) == 0 {
+		httputil.WriteJSON(w, http.StatusOK, map[string]any{
+			"list":  []map[string]any{},
+			"count": 0,
+			"pagination": map[string]any{
+				"total":  total,
+				"offset": offset,
+				"limit":  limit,
+			},
+		})
+		return nil
+	}
 
 	// Bulk fetch artifact handles and plan names to avoid N+1 queries
 	artifactUUIDSet := make(map[string]struct{})
🤖 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 `@platform-api/internal/handler/subscription_handler.go` at line 159, Update
the subscription handler to return immediately when the subscription list is
empty, before the bulk-fetch section that calls GetArtifactMetadataMap,
GetPlanNameMap, and SubsForUUIDs. Preserve the existing response behavior while
ensuring those backend queries are skipped for an empty list.
🤖 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.

Nitpick comments:
In `@platform-api/internal/handler/subscription_handler.go`:
- Line 159: Update the subscription handler to return immediately when the
subscription list is empty, before the bulk-fetch section that calls
GetArtifactMetadataMap, GetPlanNameMap, and SubsForUUIDs. Preserve the existing
response behavior while ensuring those backend queries are skipped for an empty
list.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0088c4a6-0d3c-4ea7-8cd3-99ec6129a5d2

📥 Commits

Reviewing files that changed from the base of the PR and between 5fc5f1b and adde133.

📒 Files selected for processing (3)
  • platform-api/api/generated.go
  • platform-api/internal/handler/subscription_handler.go
  • platform-api/resources/openapi.yaml

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 15, 2026
@Piumal1999
Piumal1999 merged commit 3bf5414 into wso2:main Jul 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants