Skip to content

Conversation

@Lokendra-egov
Copy link
Collaborator

@Lokendra-egov Lokendra-egov commented Oct 30, 2025

Summary by CodeRabbit

  • New Features

    • Added development mode toggle to selectively load development data and configurations.
    • Introduced new tenant provisioning endpoint for setting up production data.
    • Enabled configurable data loading paths for default and development datasets.
    • Added Excel validation schemas for tenant, common, and localization configurations.
  • Chores

    • Added configuration properties to support flexible data path management.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Walkthrough

This pull request introduces configuration-driven data loading for the default-data-handler service. It replaces hardcoded resource paths with configurable data file paths for MDMS, user, employee, and localization data. It adds a development mode flag that conditionally loads dev-specific datasets, includes new API endpoints for tenant creation, and provides separate production and development data files.

Changes

Cohort / File(s) Summary
Helm Configuration
devops/deploy-as-code/charts/urban/default-data-handler/values.yaml
Added DEV_ENABLED environment variable with value "true" to enable development mode.
Configuration Properties
utilities/default-data-handler/src/main/resources/application.properties
Added 9 new properties: dev.enabled feature flag, default data paths for MDMS/user/employee/localization, and corresponding dev-mode data paths.
Configuration Class
utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java
Added 9 new @Value-injected fields to support dev mode and configurable data paths: devEnabled, defaultMdmsDataPath, defaultUserDataFile, defaultEmployeeDataFile, devMdmsDataPath, devUserDataFile, devEmployeeDataFile, defaultLocalizationDataPath, devLocalizationDataPath.
Data Loading Utilities
utilities/default-data-handler/src/main/java/org/egov/handler/util/MdmsBulkLoader.java, utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java
Updated public method signatures to accept dynamic data paths instead of hardcoded classpath resources: loadAllMdmsData now accepts mdmsDataPath; upsertLocalizationFromFile and addMessagesFromFile now accept localizationPath.
Initialization Logic
utilities/default-data-handler/src/main/java/org/egov/StartupUserAndEmployeeInitializer.java, utilities/default-data-handler/src/main/java/org/egov/StartupSchemaAndMasterDataInitializer.java
Refactored to use configuration-driven paths for default data loading. Added conditional dev-mode block to load dev-specific MDMS, localization, boundary, user, workflow, and employee data when isDevEnabled() is true.
Data Handler Service
utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java
Updated createUserFromFile and createEmployeeFromFile signatures to accept file path parameters. Added new public method loadNewTenantProductionData(NewTenantRequest) to orchestrate production data loading for new tenants (create user context, load MDMS schema, load MDMS data, load localization, create tenant config).
API Controller & Models
utilities/default-data-handler/src/main/java/org/egov/handler/web/controller/DataHandlerController.java, utilities/default-data-handler/src/main/java/org/egov/handler/web/models/NewTenantRequest.java
Added new POST endpoint /tenant/new that accepts NewTenantRequest and returns HTTP 202 Accepted. Introduced NewTenantRequest DTO with requestInfo and targetTenantId fields, using Lombok annotations.
Production Data Files
utilities/default-data-handler/src/main/resources/HRMS.json, utilities/default-data-handler/src/main/resources/User.json
Removed entries from production data: HRMS.json removed LME SL, LME GB, CSR, GRO SL, GRO GB employee records and corrected tenantId references; User.json removed ANONYMOUS user entry. Updated ADMIN user mobile number in HRMS.json.
Development Data Files
utilities/default-data-handler/src/main/resources/HRMS-dev.json, utilities/default-data-handler/src/main/resources/User-dev.json
Added new dev-mode data files with complete HRMS and user records for development testing (6 HRMS records with various roles and assignments; 2 user records: CITIZEN and ANONYMOUS SYSTEM).
Validation Schemas
utilities/default-data-handler/src/main/resources/schema/excel-validation-schemas.json
Added new JSON Schema definitions for Excel validation: tenant.master, common.master, and localization.master with required fields, patterns, enums, and constraints.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as DataHandlerController
    participant Service as DataHandlerService
    participant MDMSUtil as MdmsBulkLoader
    participant LocalizationUtil
    participant Config as ServiceConfiguration
    participant DB as Database/Backend

    Client->>Controller: POST /tenant/new<br/>(NewTenantRequest)
    activate Controller
    
    Controller->>Service: loadNewTenantProductionData<br/>(newTenantRequest)
    activate Service
    
    Note over Service: Create user context<br/>(dummy user if needed)
    Service->>Service: ensureUserContext()
    
    Note over Service: Load production MDMS schema
    Service->>MDMSUtil: createMdmSchemaFromFile()
    activate MDMSUtil
    MDMSUtil->>DB: Create schemas
    deactivate MDMSUtil
    
    Note over Service: Load production MDMS data
    Service->>Config: getDefaultMdmsDataPath()
    Config-->>Service: mdms data path
    Service->>MDMSUtil: loadAllMdmsData<br/>(tenantId, requestInfo, mdmsDataPath)
    activate MDMSUtil
    MDMSUtil->>DB: Load MDMS records
    deactivate MDMSUtil
    
    Note over Service: Load production localization
    Service->>Config: getDefaultLocalizationDataPath()
    Config-->>Service: localization path
    Service->>LocalizationUtil: upsertLocalizationFromFile<br/>(defaultDataRequest, localizationPath)
    activate LocalizationUtil
    LocalizationUtil->>DB: Upsert localization messages
    deactivate LocalizationUtil
    
    Note over Service: Create tenant config
    Service->>DB: Save tenant config
    
    Service-->>Controller: Success
    deactivate Service
    
    Controller->>Controller: Build DataSetupResponse<br/>(targetTenantId)
    Controller-->>Client: HTTP 202 Accepted<br/>(DataSetupResponse)
    deactivate Controller
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Areas requiring extra attention:

  • Breaking API changes: Method signature updates to createUserFromFile, createEmployeeFromFile, loadAllMdmsData, and upsertLocalizationFromFile require verification that all call sites have been updated correctly.
  • DataHandlerService orchestration logic: Review the new loadNewTenantProductionData method for error handling, tenant context creation, and the multi-step data loading sequence.
  • Data file consistency: Verify that production data files (HRMS.json, User.json) have been correctly pruned and that dev data files match the expected structure for test scenarios.
  • Configuration property mapping: Ensure all 9 new configuration properties are correctly bound from application.properties to ServiceConfiguration fields via @Value annotations.

Poem

🐰 Configuration paths now dance with grace,
Dev and production data find their place,
New tenants spawn with schemas in tow,
Breaking changes bloom—review with care, though!
Hardcoded ways fade; flexibility's here!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: introducing a dev-enabled flag to control conditional data loading and making data file paths configurable through properties.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch flag-enabled

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java (1)

11-15: Optional: Simplify Lombok annotations.

The class uses @Data (line 11) which already generates @Getter, @Setter, @ToString, @EqualsAndHashCode, and @RequiredArgsConstructor. The explicit @Setter (line 14) and @Getter (line 15) annotations are redundant.

Consider this simplification:

 @Component
 @Data
 @NoArgsConstructor
 @AllArgsConstructor
-@Setter
-@Getter
 public class ServiceConfiguration {
devops/deploy-as-code/charts/urban/default-data-handler/values.yaml (1)

128-129: Consider making this configurable via Helm values.

The flag is currently hardcoded to "true". For better flexibility across different environments (dev, staging, production), consider extracting this to a configurable Helm value.

Add a new value in the values section:

# Feature flags
loadUserEmployeeDataEnabled: "true"

Then reference it in the env section:

   - name: DEFAULT_DATA_LOAD_USER_EMPLOYEE_ENABLED
-    value: "true"
+    value: {{ index .Values "loadUserEmployeeDataEnabled" | quote }}
utilities/default-data-handler/src/main/java/org/egov/StartupUserAndEmployeeInitializer.java (1)

101-106: Add logging for observability.

While the conditional logic is correct, consider adding logging to indicate whether user/employee data loading was executed or skipped. This aids troubleshooting and makes the flag's effect visible in logs.

 
         // Load user, employee, and workflow config data only if enabled
         if (serviceConfig.isLoadUserEmployeeDataEnabled()) {
+            System.out.println("[INFO] Loading user, employee, and workflow config data (flag enabled)");
             dataHandlerService.createUserFromFile(tenantRequest);
             dataHandlerService.createPgrWorkflowConfig(tenantRequest.getTenant().getCode());
             dataHandlerService.createEmployeeFromFile(defaultDataRequest.getRequestInfo());
+        } else {
+            System.out.println("[INFO] Skipping user, employee, and workflow config data loading (flag disabled)");
         }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9703051 and 228aad2.

📒 Files selected for processing (4)
  • devops/deploy-as-code/charts/urban/default-data-handler/values.yaml (1 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/StartupUserAndEmployeeInitializer.java (1 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java (1 hunks)
  • utilities/default-data-handler/src/main/resources/application.properties (1 hunks)
🔇 Additional comments (2)
utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java (1)

135-136: LGTM! Feature flag properly configured.

The new configuration property is correctly wired with an appropriate property name that follows Spring Boot conventions.

utilities/default-data-handler/src/main/resources/application.properties (1)

87-88: LGTM! Configuration property properly added.

The property name is consistent with the ServiceConfiguration field, and the default value of true maintains existing behavior. The comment clearly explains the purpose.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java (2)

87-87: Remove commented code.

The commented exception throw should be removed if it's no longer needed, or uncommented if error handling should fail fast.

 		} catch (Exception e) {
 			log.error("Error creating Tenant localization data for {} : {}", tenantId, e.getMessage());
-//			throw new CustomException("TENANT", "Failed to create localization data for " + tenantId + " : " + e.getMessage());
 		}

110-112: Consider whether silent failure is appropriate.

The method returns an empty list when the path pattern fails to resolve. If an invalid path is provided due to misconfiguration, this could silently fail without making the issue obvious.

Consider whether you should throw an exception for configuration errors vs. simply missing files:

} catch (IOException e) {
    log.error("Failed to scan localization directories: {}", e.getMessage());
    if (messages.isEmpty()) {
        log.warn("No localization messages loaded from path: {}", localizationPath);
    }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 228aad2 and 3ca544b.

⛔ Files ignored due to path filters (3)
  • utilities/default-data-handler/src/main/resources/localisations-dev/localizations (default).xlsx is excluded by !**/*.xlsx
  • utilities/default-data-handler/src/main/resources/localisations-dev/localizations (en_IN).xlsx is excluded by !**/*.xlsx
  • utilities/default-data-handler/src/main/resources/localisations-dev/localizations (hi_IN).xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (15)
  • devops/deploy-as-code/charts/urban/default-data-handler/values.yaml (1 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/StartupSchemaAndMasterDataInitializer.java (1 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/StartupUserAndEmployeeInitializer.java (2 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java (1 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java (3 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java (2 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/util/MdmsBulkLoader.java (1 hunks)
  • utilities/default-data-handler/src/main/resources/HRMS-dev.json (1 hunks)
  • utilities/default-data-handler/src/main/resources/HRMS.json (0 hunks)
  • utilities/default-data-handler/src/main/resources/User-dev.json (1 hunks)
  • utilities/default-data-handler/src/main/resources/User.json (0 hunks)
  • utilities/default-data-handler/src/main/resources/application.properties (1 hunks)
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/egov-hrms.json (1 hunks)
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/egov-user.json (1 hunks)
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/rainmaker-hr.json (1 hunks)
💤 Files with no reviewable changes (2)
  • utilities/default-data-handler/src/main/resources/User.json
  • utilities/default-data-handler/src/main/resources/HRMS.json
✅ Files skipped from review due to trivial changes (4)
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/egov-hrms.json
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/egov-user.json
  • utilities/default-data-handler/src/main/resources/localisations-dev/en_IN/rainmaker-hr.json
  • utilities/default-data-handler/src/main/resources/HRMS-dev.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • utilities/default-data-handler/src/main/resources/application.properties
  • devops/deploy-as-code/charts/urban/default-data-handler/values.yaml
  • utilities/default-data-handler/src/main/java/org/egov/handler/config/ServiceConfiguration.java
🔇 Additional comments (1)
utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java (1)

98-99: LGTM!

The dynamic path loading with PathMatchingResourcePatternResolver is well-implemented, and the logging provides good visibility.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java (2)

53-55: Good refactoring; consider adding parameter validation.

The signature change to accept localizationPath enables the configurable loading approach described in the PR objectives. Past reviews confirmed that callers provide valid paths from configuration.

Consider adding defensive null/empty validation for the localizationPath parameter to fail fast with a clear error message if misconfigured:

 public void upsertLocalizationFromFile(DefaultDataRequest defaultDataRequest, String localizationPath){
+    if (localizationPath == null || localizationPath.trim().isEmpty()) {
+        throw new IllegalArgumentException("localizationPath must not be null or empty");
+    }
     List<Message> messageList = addMessagesFromFile(defaultDataRequest, localizationPath);

91-99: Return type fix looks good; consistent parameter validation recommended.

The parameterized return type List<Message> properly addresses the raw type concern from past reviews. The dynamic path usage and logging are appropriate.

For consistency with defensive coding practices, consider adding the same null/empty validation here:

 public List<Message> addMessagesFromFile(DefaultDataRequest defaultDataRequest, String localizationPath){
+    if (localizationPath == null || localizationPath.trim().isEmpty()) {
+        throw new IllegalArgumentException("localizationPath must not be null or empty");
+    }
     List<Message> messages = new ArrayList<>();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a3f059 and b4b68c8.

📒 Files selected for processing (1)
  • utilities/default-data-handler/src/main/java/org/egov/handler/util/LocalizationUtil.java (2 hunks)

@Lokendra-egov Lokendra-egov changed the title added flag to load user and employee Separated out the prod-dev data based on the flag and made files name configurable Nov 4, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java (1)

193-196: Security concern: Hardcoded password should be externalized.

The password "eGov@123" is hardcoded in source code. Even for development/provisioning, this exposes a known credential and makes rotation difficult. Consider externalizing this to configuration.

-                        // Set password
-                        updatedUser.put("password", "eGov@123");
+                        // Set password from configuration
+                        updatedUser.put("password", serviceConfig.getDefaultEmployeePassword());
🧹 Nitpick comments (4)
utilities/default-data-handler/src/main/resources/schema/tenant.json (1)

416-469: Inconsistent schema validation: missing additionalProperties: false.

The localization.master schema is missing additionalProperties: false, unlike tenant.master (line 349) and common.master (line 413). This inconsistency allows extra properties in localization data while rejecting them in other schemas.

         "description": "Translated message in the specified locale"
         }
-      }
+      },
+      "additionalProperties": false
     }
   }
 ]
utilities/default-data-handler/src/main/java/org/egov/handler/web/models/NewTenantRequest.java (1)

23-26: Remove unnecessary @Valid and consider @NotBlank for stronger validation.

@Valid on a String field has no effect—it's meant for cascading validation into nested objects. Also, @NotNull allows empty strings; use @NotBlank to reject both null and empty/whitespace-only values.

 	@JsonProperty("targetTenantId")
-	@NotNull
-	@Valid
+	@NotBlank
 	private String targetTenantId;

Add the import:

import jakarta.validation.constraints.NotBlank;
utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java (2)

147-149: Error message references hardcoded filename instead of the configurable path.

The error message mentions "User.json" but the file path is now configurable via userFilePath. This could mislead debugging efforts.

         } catch (Exception e) {
-            log.error("Error creating users from User.json for tenant {}: {}", tenantCode, e.getMessage(), e);
+            log.error("Error creating users from {} for tenant {}: {}", userFilePath, tenantCode, e.getMessage(), e);
             throw new CustomException("USER_CREATION_FAILED", "Failed to create users for tenant: " + tenantCode);
         }

644-660: Consider using ASCII-safe log messages for broader environment compatibility.

Unicode symbols like and ✓✓✓ in log output may render incorrectly in some log aggregators, terminals, or file encodings. Consider using ASCII alternatives like [OK] or [SUCCESS].

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7fc5b7f and bd5f75c.

📒 Files selected for processing (4)
  • utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java (5 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/web/controller/DataHandlerController.java (2 hunks)
  • utilities/default-data-handler/src/main/java/org/egov/handler/web/models/NewTenantRequest.java (1 hunks)
  • utilities/default-data-handler/src/main/resources/schema/tenant.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
utilities/default-data-handler/src/main/java/org/egov/handler/web/models/NewTenantRequest.java (1)
utilities/default-data-handler/src/main/java/org/egov/handler/web/models/Message.java (1)
  • Builder (10-27)
🔇 Additional comments (1)
utilities/default-data-handler/src/main/java/org/egov/handler/web/controller/DataHandlerController.java (1)

49-59: LGTM!

The new /tenant/new endpoint follows the existing controller patterns, uses appropriate HTTP 202 status for the potentially long-running tenant provisioning operation, and properly delegates to the service layer.

Comment on lines +630 to +632
} else {
requestInfo.getUserInfo().setTenantId(targetTenantId);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Mutating the caller's RequestInfo object may cause unintended side effects.

Calling requestInfo.getUserInfo().setTenantId(targetTenantId) modifies the object passed by the caller. If the caller reuses this RequestInfo for other operations, they may get unexpected behavior. Consider creating a copy or documenting this mutation as intentional.

Comment on lines +664 to +667
Tenant newTenant = new Tenant();
newTenant.setCode(targetTenantId);
newTenant.setName(targetTenantId);
newTenant.setEmail("admin@" + targetTenantId + ".com");
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check NewTenantRequest and Tenant classes structure
rg -n "class NewTenantRequest|class Tenant" --type=java -A 25 | head -100

Repository: egovernments/Citizen-Complaint-Resolution-System

Length of output: 11045


🏁 Script executed:

# Check the context around lines 664-667 in DataHandlerService.java
sed -n '650,680p' utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java

Repository: egovernments/Citizen-Complaint-Resolution-System

Length of output: 1596


🏁 Script executed:

# Check if there are configuration properties or defaults being used elsewhere
rg -n "defaultTenantName|defaultTenantEmail|admin@" --type=java -B 2 -A 2 | head -40

Repository: egovernments/Citizen-Complaint-Resolution-System

Length of output: 822


Add tenant name and email to NewTenantRequest or implement configuration defaults.

The code hardcodes placeholder values (name = targetTenantId and email = "admin@" + targetTenantId + ".com") when creating a new Tenant configuration. These placeholders persist permanently in the Tenant Management System. Since NewTenantRequest currently provides only targetTenantId and RequestInfo, consider either:

  • Adding name and email fields to NewTenantRequest to accept proper tenant metadata from the caller, or
  • Implementing configurable defaults (e.g., via ServiceConfiguration) instead of hardcoding placeholder values.

The Tenant model enforces @NotNull on name and @Email validation on email, making these required fields that should be meaningful for production tenants.

🤖 Prompt for AI Agents
In
utilities/default-data-handler/src/main/java/org/egov/handler/service/DataHandlerService.java
around lines 664 to 667, the code currently assigns placeholder tenant name and
email (name = targetTenantId, email = "admin@...") which violates model
validation and persists meaningless values; update the flow so
newTenant.setName(...) and newTenant.setEmail(...) pull real values instead of
hardcoded ones: either extend NewTenantRequest to include name and email and use
those fields here (validate non-null and email format) or read configurable
defaults from ServiceConfiguration (e.g., defaultTenantName and
defaultTenantEmail) and apply them; ensure the chosen source is validated before
setting on Tenant and update callers/tests accordingly.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd5f75c and 4a2a67c.

📒 Files selected for processing (1)
  • utilities/default-data-handler/src/main/resources/schema/excel-validation-schemas.json (1 hunks)

Comment on lines +166 to +219
{
"tenantId": "{tenantid}",
"code": "localization.master",
"description": "Localization Master Schema - Used for Excel validation in Jupyter notebooks. Validates multi-language translation data with locale codes (e.g., en_IN, hi_IN, ta_IN)",
"isActive": true,
"definition": {
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"module",
"code",
"locale"
],
"x-unique": [
"code",
"locale"
],
"properties": {
"module": {
"type": "string",
"minLength": 1,
"maxLength": 100,
"description": "Module name (e.g., rainmaker-pgr, rainmaker-common)"
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 200,
"description": "Translation key (e.g., PGR_COMPLAINT_TYPE, CORE_COMMON_SAVE)"
},
"englishMessage": {
"type": [
"string",
"null"
],
"maxLength": 1000,
"description": "English translation message"
},
"locale": {
"type": "string",
"pattern": "^[a-z]{2}_[A-Z]{2}$",
"description": "Locale code in format: language_COUNTRY (e.g., en_IN, hi_IN, ta_IN)"
},
"translation": {
"type": [
"string",
"null"
],
"maxLength": 1000,
"description": "Translated message in the specified locale"
}
}
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add additionalProperties: false to the localization.master schema for consistency.

The tenant.master and common.master schemas both include "additionalProperties": false to enforce strict validation and reject unexpected properties. The localization.master schema is missing this constraint, which creates an inconsistency and may allow unintended properties during validation.

Apply this diff to add the missing constraint:

       "translation": {
         "type": [
           "string",
           "null"
         ],
         "maxLength": 1000,
         "description": "Translated message in the specified locale"
       }
     }
+    "additionalProperties": false
   }
 ]

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
utilities/default-data-handler/src/main/resources/schema/excel-validation-schemas.json
around lines 166 to 219: the localization.master schema is missing
"additionalProperties": false on its "definition" object causing inconsistent
validation behavior; add "additionalProperties": false directly inside the
"definition" object (next to "type" and "$schema") so the schema rejects
unexpected properties just like tenant.master and common.master.

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.

3 participants