Skip to content

fix: align API status codes with OpenAPI specs#1056

Merged
adityachoudhari26 merged 3 commits intomainfrom
claude/issue-1011-20260423-1953
Apr 23, 2026
Merged

fix: align API status codes with OpenAPI specs#1056
adityachoudhari26 merged 3 commits intomainfrom
claude/issue-1011-20260423-1953

Conversation

@adityachoudhari26
Copy link
Copy Markdown
Member

Fix 5 mutation endpoints that were returning HTTP 200 instead of HTTP 202 (Accepted) as declared in the OpenAPI jsonnet specs:

  • PATCH /deploymentversions/{deploymentVersionId}
  • POST /deployments/{deploymentId}/versions
  • DELETE /relationship-rules/{relationshipRuleId}
  • PUT /relationship-rules/{relationshipRuleId}
  • DELETE /resources/identifier/{identifier}

Closes #1011

Generated with Claude Code

Update 5 mutation endpoints that were returning 200 instead of 202 (Accepted) as declared in the OpenAPI jsonnet specs:
- PATCH /deploymentversions/{deploymentVersionId}
- POST /deployments/{deploymentId}/versions
- DELETE /relationship-rules/{relationshipRuleId}
- PUT /relationship-rules/{relationshipRuleId}
- DELETE /resources/identifier/{identifier}

Co-authored-by: Aditya Choudhari <adityachoudhari26@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 20:13
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@adityachoudhari26 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 46 minutes and 41 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 41 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 78bd6a70-3ade-4ec2-8f04-0cd3747f78ee

📥 Commits

Reviewing files that changed from the base of the PR and between 7b8db28 and 07332ad.

📒 Files selected for processing (5)
  • apps/api/src/routes/v1/workspaces/deployment-versions.ts
  • apps/api/src/routes/v1/workspaces/deployments.ts
  • apps/api/src/routes/v1/workspaces/relationship-rules.ts
  • apps/api/src/routes/v1/workspaces/resources.ts
  • e2e/tests/api/resources.spec.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-1011-20260423-1953

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Aligns several workspace mutation endpoints in apps/api to return HTTP 202 Accepted as declared by the OpenAPI Jsonnet/spec output, addressing a client-generation breaking mismatch reported in #1011.

Changes:

  • Updated 5 mutation endpoints to respond with 202 instead of 200.
  • Kept response payloads the same while changing only the HTTP status codes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/api/src/routes/v1/workspaces/resources.ts Return 202 Accepted for delete-by-identifier resource mutation.
apps/api/src/routes/v1/workspaces/relationship-rules.ts Return 202 Accepted for relationship-rule delete + upsert mutations.
apps/api/src/routes/v1/workspaces/deployments.ts Return 202 Accepted for “create deployment version” mutation.
apps/api/src/routes/v1/workspaces/deployment-versions.ts Return 202 Accepted for deployment-version patch mutation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

enqueueRelationshipReconciliation(workspaceId);

res.status(200).json({ id: relationshipRuleId });
res.status(202).json({ id: relationshipRuleId });
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

The DELETE /relationship-rules/{relationshipRuleId} handler now returns 202, which matches the OpenAPI status code, but the response body still only includes { id }. OpenAPI declares the 202 response schema as RelationshipRule (required fields include name/reference/cel/metadata/workspaceId), so generated clients will likely fail to decode this response. Return the deleted rule (e.g., using the already-fetched rule + toRuleResponse) or update the OpenAPI spec to match the { id } payload.

Suggested change
res.status(202).json({ id: relationshipRuleId });
res.status(202).json(toRuleResponse(rule));

Copilot uses AI. Check for mistakes.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ adityachoudhari26
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@adityachoudhari26 adityachoudhari26 merged commit be4825d into main Apr 23, 2026
8 checks passed
@adityachoudhari26 adityachoudhari26 deleted the claude/issue-1011-20260423-1953 branch April 23, 2026 20:43
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.

Correct code status on API endpoints

3 participants