[Customer Portal][BE] Enhance feature configs and change request search response - #560
Conversation
📝 WalkthroughWalkthroughThe PR extends Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/customer-portal/backend/openapi.yaml (1)
4866-4932:⚠️ Potential issue | 🟠 MajorSchema/type mismatch:
defaultCaseProductCategories&srProductCategoriesarerequiredin OpenAPI but optional in Ballerina.In
apps/customer-portal/backend/modules/types/types.bal(lines 296–298), these fields are declared asentity:ProductCategory[]?(optional-presence — they are omitted from JSON when unset). The OpenAPI schema, however, lists them underrequired(lines 4869, 4880). Since Ballerina's JSON serialization omits unset optional fields rather than emittingnull, responses will violate therequiredcontract whenever the upstream entity service returnsnilfor either field.Either drop both from the
requiredlist (keepingnullable: trueto allownullwhen explicitly set), or change the Ballerina fields to required-presence and guarantee they are always assigned.📝 Proposed schema fix (option 1: drop from required)
ProjectFeatures: required: - acceptedSeverityValues - - defaultCaseProductCategories - hasChangeRequestReadAccess - hasDeploymentReadAccess - hasDeploymentWriteAccess - hasEngagementsReadAccess - hasServiceRequestReadAccess - hasServiceRequestWriteAccess - hasSraReadAccess - hasSraWriteAccess - hasTimeLogsReadAccess - hasUpdatesReadAccess - - srProductCategories🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/customer-portal/backend/openapi.yaml` around lines 4866 - 4932, The OpenAPI ProjectFeatures schema marks defaultCaseProductCategories and srProductCategories as required but the Ballerina model declares them as optional-presence (entity:ProductCategory[]?) in types.bal, causing mismatches; either remove both defaultCaseProductCategories and srProductCategories from the OpenAPI required array in the ProjectFeatures schema (keeping nullable: true if you want to allow explicit null), or change the Ballerina fields to required-presence (make them non-optional arrays) and ensure code always assigns an array (possibly empty) before serializing; update whichever side you choose so defaultCaseProductCategories and srProductCategories semantics match between ProjectFeatures and types.bal.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/customer-portal/backend/openapi.yaml`:
- Around line 4866-4932: The OpenAPI ProjectFeatures schema marks
defaultCaseProductCategories and srProductCategories as required but the
Ballerina model declares them as optional-presence (entity:ProductCategory[]?)
in types.bal, causing mismatches; either remove both
defaultCaseProductCategories and srProductCategories from the OpenAPI required
array in the ProjectFeatures schema (keeping nullable: true if you want to allow
explicit null), or change the Ballerina fields to required-presence (make them
non-optional arrays) and ensure code always assigns an array (possibly empty)
before serializing; update whichever side you choose so
defaultCaseProductCategories and srProductCategories semantics match between
ProjectFeatures and types.bal.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a6d920b9-6d81-45f0-bbc9-f0ca2c348243
📒 Files selected for processing (5)
apps/customer-portal/backend/modules/entity/types.balapps/customer-portal/backend/modules/types/types.balapps/customer-portal/backend/openapi.yamlapps/customer-portal/backend/service.balapps/customer-portal/backend/utils.bal
Summary
This PR enhances feature configurations and updates the change request search response to include product category–related fields.
Changes
1️⃣ Feature Config Enhancement
Reason:
These fields enable:
2️⃣ Change Request Search Response Update
Reason:
Including product category data in responses:
Impact
Testing
Summary by CodeRabbit
Release Notes
New Features
API Updates