Skip to content

[CSM Portal][BE] feat(openapi): align spec with entity-service PR #896 - #897

Merged
suhand merged 2 commits into
wso2-open-operations:v2from
Rashmika998:task/csm-portal-align-entity-pr896
Jun 19, 2026
Merged

suhand merged 2 commits into
wso2-open-operations:v2from
Rashmika998:task/csm-portal-align-entity-pr896

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Timestamp field renames (*At*On): updated createdOn, updatedOn, closedOn across all response schemas — Case, CaseView, CaseSearchView, User, Account, Project, Deployment, Product, ProductVersion, DeployedProduct, and CaseComment. Matches the *On convention standardized in entity service PR [Customer Entity] Extend case endpoints with workState update, full response field parity, and *On timestamp convention #896.
  • workState in PATCH: added workState to UpdateCaseRequest (oneOf + properties) so callers can set the work sub-state via PATCH /cases/{id}.
  • CaseView additions: workState and closedOn fields added (entity service now returns both).
  • CaseSearchView additions: workState, closedOn, product, assignedEngineer, parentCase, relatedCase, and account (new fields returned by entity service SearchCaseView).
  • New component schemas: AssignedEngineerRef, CaseNumberRef, AccountRef (needed by CaseSearchView refs).

No Go handler code changes required — the portal is a passthrough BFF and doesn't parse any of these timestamp or new reference fields.

Depends on entity service PR #896 being merged first.

Test plan

  • npx @apidevtools/swagger-cli validate openapi.yaml passes ✅
  • go test ./... passes ✅
  • Verify GET /cases/{id} response includes workState, createdOn, updatedOn, closedOn
  • Verify POST /cases/search response items include workState, closedOn, and new ref fields
  • Verify PATCH /cases/{id} with {"workState": "paused"} is accepted

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added work state management for cases with pause/resume capability
    • Enhanced case details view with additional reference information (product, assigned engineer, parent/related cases)

…2-open-operations#896

- Rename all *At timestamp fields to *On in response schemas (createdOn,
  updatedOn, closedOn) across Case, CaseView, CaseSearchView, User,
  Account, Project, Deployment, Product, ProductVersion, DeployedProduct,
  and CaseComment — matches the *On convention standardized in entity PR wso2-open-operations#896
- Add workState to UpdateCaseRequest (oneOf + properties) so callers can
  set work sub-state via PATCH /cases/{id}
- Add workState and closedOn to CaseView
- Add workState, closedOn, product, assignedEngineer, parentCase,
  relatedCase, and account to CaseSearchView
- Add AssignedEngineerRef, CaseNumberRef, AccountRef component schemas
- Update PATCH /cases/{id} description to mention workState

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Rashmika998, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 23 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e0733b6-f307-4cd5-ae4b-1f9ed57a1edf

📥 Commits

Reviewing files that changed from the base of the PR and between b7db51b and b1bce95.

📒 Files selected for processing (1)
  • apps/csm-portal/backend/openapi.yaml
📝 Walkthrough

Walkthrough

The apps/csm-portal/backend/openapi.yaml spec is updated to add workState (ongoing|paused) as a mutually exclusive field in PATCH /cases/{id}, rename all timestamp fields from *At to *On across every schema, extend CaseView with five new nullable reference properties, and introduce three new component schemas (AssignedEngineerRef, CaseNumberRef, AccountRef).

Changes

OpenAPI Contract Updates

Layer / File(s) Summary
workState added to PATCH /cases/{id} update contract
apps/csm-portal/backend/openapi.yaml
UpdateCaseRequest extends oneOf-required options to include workState (enum ongoing|paused). UpdatedCase.workState is updated to nullable with the same enum and a scoping description.
Case, CaseView, CaseSearchView: timestamp renames and workState updates
apps/csm-portal/backend/openapi.yaml
Timestamp fields createdAt/updatedAt/closedAt are renamed to createdOn/updatedOn/closedOn, and workState is updated to nullable+enum+description in Case, CaseView, and CaseSearchView.
CaseView new reference properties and ref schemas
apps/csm-portal/backend/openapi.yaml
CaseView gains product, assignedEngineer, parentCase, relatedCase, and account as optional nullable $ref properties. New component schemas AssignedEngineerRef, CaseNumberRef, and AccountRef are added.
Timestamp renames across remaining schemas
apps/csm-portal/backend/openapi.yaml
User, Account, Project, Deployment, Product, ProductVersion, DeployedProduct, and CaseComment all rename createdAt/updatedAt to createdOn/updatedOn.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • wso2-open-operations/cs-tools#890: Updates the same PATCH /cases/{id} handler and UpdateCaseRequest/Response shape, aligning workState enum values (on_holdpaused), which directly precedes this PR's extension of the contract.
  • wso2-open-operations/cs-tools#894: Also modifies UpdatedCase schema and AssignedEngineerRef in the same OpenAPI file, sharing the assignedTo field adjustment alongside this PR's workState additions.
  • wso2-open-operations/cs-tools#896: Directly overlaps with this PR on both the workState oneOf update contract and the *At*On timestamp standardization in the same request/response schemas.

Suggested labels

Type/Improvement, Area/Backend, App/CSM Portal

Suggested reviewers

  • v15a1
  • cloby99

Poem

🐇 Hop, hop, the fields got renamed,
createdAt and updatedAt — tamed!
Now *On shines bright and clear,
workState joins the contract here.
New refs for engineer, account, and case —
The schema hops to a tidier place! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers most critical sections including purpose, approach, test plan, and dependencies, but omits several required template sections like Goals, Release notes, Documentation, and others. Add missing template sections such as Goals, Release note, Documentation, Training, Certification, Marketing, Samples, Related PRs, Migrations, Test environment, and Learning to meet the repository's description requirements.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: aligning the OpenAPI specification with entity-service PR #896, which involves timestamp renames, schema additions, and workState support.
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 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 and usage tips.

@Rashmika998 Rashmika998 self-assigned this Jun 19, 2026
@Rashmika998 Rashmika998 added Type/Improvement Marks enhancements or improvements to existing features Area/Backend App/CSM Portal labels Jun 19, 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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/csm-portal/backend/openapi.yaml (2)

2147-2175: 💤 Low value

Consider adding format: uuid to id fields for consistency.

Other reference schemas in this spec (e.g., UserRef.id at line 1407, UserIDEmailRef.id at line 1420) specify format: uuid for their id properties. The new schemas AssignedEngineerRef, CaseNumberRef, and AccountRef omit this format specification.

If the entity-service returns UUIDs for these ids, adding format: uuid would improve consistency and enable better client-side validation.

🤖 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 `@apps/csm-portal/backend/openapi.yaml` around lines 2147 - 2175, The id
properties in the AssignedEngineerRef, CaseNumberRef, and AccountRef schemas are
missing the format specification for consistency with other reference schemas in
the spec (such as UserRef and UserIDEmailRef). Add format: uuid to the id
property definition in each of these three schemas to ensure consistent
formatting and enable better client-side validation if the entity-service
returns UUIDs for these ids.

1591-1604: 💤 Low value

nullable: true alongside $ref is ignored in OpenAPI 3.0.x.

In OpenAPI 3.0.x, $ref replaces all sibling keywords, so the nullable: true on lines 1594, 1597, 1600, 1603 is ignored. The nullability is preserved only because the referenced schemas (AssignedEngineerRef, CaseNumberRef, AccountRef) define nullable: true themselves.

For clarity and tooling compatibility, either:

  1. Remove the redundant nullable: true from these properties (relying on the schema definitions), or
  2. Use the allOf pattern to combine nullability with the reference:
assignedEngineer:
  nullable: true
  allOf:
    - $ref: '`#/components/schemas/AssignedEngineerRef`'
🤖 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 `@apps/csm-portal/backend/openapi.yaml` around lines 1591 - 1604, The
`nullable: true` keywords alongside `$ref` in the openapi.yaml file for the
properties assignedEngineer, parentCase, relatedCase, and account are being
ignored in OpenAPI 3.0.x because `$ref` replaces all sibling keywords. To fix
this, either remove the redundant `nullable: true` statements from these four
properties (since nullability is already defined in their referenced schemas
AssignedEngineerRef, CaseNumberRef, and AccountRef), or restructure each
affected property using the `allOf` pattern where you place the `nullable: true`
and `$ref` at the appropriate nesting levels instead of as siblings.
🤖 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 `@apps/csm-portal/backend/openapi.yaml`:
- Around line 1485-1502: The CaseView schema in openapi.yaml is missing
reference property definitions that the frontend BeCaseView type expects and
that the entity-service contract provides. Add the missing reference properties
(assignedEngineer, account, product, parentCase, and relatedCase) to the
CaseView schema definition by following the same structure and format used in
the CaseSearchView schema (lines 1591-1604). These properties should be added to
the CaseView schema to ensure accurate API documentation and align with what
consumers expect to receive from this endpoint.

---

Nitpick comments:
In `@apps/csm-portal/backend/openapi.yaml`:
- Around line 2147-2175: The id properties in the AssignedEngineerRef,
CaseNumberRef, and AccountRef schemas are missing the format specification for
consistency with other reference schemas in the spec (such as UserRef and
UserIDEmailRef). Add format: uuid to the id property definition in each of these
three schemas to ensure consistent formatting and enable better client-side
validation if the entity-service returns UUIDs for these ids.
- Around line 1591-1604: The `nullable: true` keywords alongside `$ref` in the
openapi.yaml file for the properties assignedEngineer, parentCase, relatedCase,
and account are being ignored in OpenAPI 3.0.x because `$ref` replaces all
sibling keywords. To fix this, either remove the redundant `nullable: true`
statements from these four properties (since nullability is already defined in
their referenced schemas AssignedEngineerRef, CaseNumberRef, and AccountRef), or
restructure each affected property using the `allOf` pattern where you place the
`nullable: true` and `$ref` at the appropriate nesting levels instead of as
siblings.
🪄 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: fae54997-497b-4d1f-abc1-1cb83283c431

📥 Commits

Reviewing files that changed from the base of the PR and between b25bac5 and b7db51b.

📒 Files selected for processing (1)
  • apps/csm-portal/backend/openapi.yaml

Comment thread apps/csm-portal/backend/openapi.yaml
…-open-operations#897

- Add missing ref properties (product, assignedEngineer, parentCase,
  relatedCase, account) to CaseView schema — entity service CaseView
  returns these same fields
- Remove redundant nullable: true siblings next to $ref in CaseSearchView;
  nullability is already declared on the referenced schemas, and OAS 3.0
  ignores sibling keywords alongside $ref
- Add format: uuid to id fields in AssignedEngineerRef, CaseNumberRef,
  and AccountRef for consistency with other ref schemas in this spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@suhand
suhand merged commit a1076c4 into wso2-open-operations:v2 Jun 19, 2026
1 check passed
Rashmika998 added a commit to Rashmika998/cs-tools that referenced this pull request Jun 22, 2026
…-open-operations#897

- Add missing ref properties (product, assignedEngineer, parentCase,
  relatedCase, account) to CaseView schema — entity service CaseView
  returns these same fields
- Remove redundant nullable: true siblings next to $ref in CaseSearchView;
  nullability is already declared on the referenced schemas, and OAS 3.0
  ignores sibling keywords alongside $ref
- Add format: uuid to id fields in AssignedEngineerRef, CaseNumberRef,
  and AccountRef for consistency with other ref schemas in this spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App/CSM Portal Area/Backend Type/Improvement Marks enhancements or improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants