Summary
The MDMS v2 schema validator throws ClassCastException while walking schema definitions that use JSON-Schema oneOf with mixed primitive types (e.g. oneOf: [{type: number}, {type: array}, {type: null}]), both at /schema/v1/_create time and at data _create/_update validation time. oneOf is core JSON-Schema draft-07; polymorphic cell values are a natural shape for master data.
Reproduction
Register a schema whose property declares:
"slaHoursByState": {
"type": "object",
"additionalProperties": {
"oneOf": [
{ "type": "number" },
{ "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2 },
{ "type": "null" }
]
}
}
Validation of data against it fails with an unhandled ClassCastException (e.g. org.json.JSONObject cannot be cast to ...) instead of evaluating the union.
Impact / workaround
Tenants are forced to flatten polymorphic shapes and lose declarative validation: we ship additionalProperties: true / items: {} and re-implement cell-shape + bounds validation application-side in two places (scheduler + configurator). Documented in the CCRS escalation design doc § "egov-mdms-v2 validator and oneOf" — egovernments/Citizen-Complaint-Resolution-System#770, discussion egovernments/Citizen-Complaint-Resolution-System#773 (prompt 8).
Related quirk worth fixing in the same pass: an empty x-unique also trips a ClassCastException, which is why singleton schemas in the wild carry a placeholder singletonKey field.
Summary
The MDMS v2 schema validator throws
ClassCastExceptionwhile walking schema definitions that use JSON-SchemaoneOfwith mixed primitive types (e.g.oneOf: [{type: number}, {type: array}, {type: null}]), both at/schema/v1/_createtime and at data_create/_updatevalidation time.oneOfis core JSON-Schema draft-07; polymorphic cell values are a natural shape for master data.Reproduction
Register a schema whose property declares:
Validation of data against it fails with an unhandled
ClassCastException(e.g.org.json.JSONObject cannot be cast to ...) instead of evaluating the union.Impact / workaround
Tenants are forced to flatten polymorphic shapes and lose declarative validation: we ship
additionalProperties: true/items: {}and re-implement cell-shape + bounds validation application-side in two places (scheduler + configurator). Documented in the CCRS escalation design doc § "egov-mdms-v2 validator and oneOf" — egovernments/Citizen-Complaint-Resolution-System#770, discussion egovernments/Citizen-Complaint-Resolution-System#773 (prompt 8).Related quirk worth fixing in the same pass: an empty
x-uniquealso trips aClassCastException, which is why singleton schemas in the wild carry a placeholdersingletonKeyfield.