Description
In CDS 10 the compat_assert_not_null compat flag is removed. Projects that had set cds.features.compat_assert_not_null: true to preserve the legacy ASSERT_NOT_NULL error code string will now receive the new error code for not-null constraint violations. Any code — including tests — that catches or compares against the string 'ASSERT_NOT_NULL' must be updated to use the current error code. The flag has no effect when set.
How to Check
- [ ] Search for
cds.features.compat_assert_not_nullinpackage.json,.cdsrc.json, and environment-specific config files. - [ ] Search for the string literal
'ASSERT_NOT_NULL'in error handlers, test assertions, and middleware that inspecterror.codeorerror.message. - [ ] Review test fixtures or mock data that hardcode the legacy error code string.
Migration Steps
Remove the flag from CDS configuration:
diff// package.json or .cdsrc.json "cds": { "features": { - "compat_assert_not_null": true } }Update error-code comparisons to use the current not-null error code:
diff- if (error.code === 'ASSERT_NOT_NULL') { + if (error.code === '400') { // or the specific current code — verify at runtimeUpdate test assertions that expect the legacy code:
diff- expect(err.code).toBe('ASSERT_NOT_NULL'); + expect(err.code).toBe('400'); // verify the exact code in your CAP version
Notes
The exact replacement error code should be confirmed against the CDS 10 release notes or by triggering a not-null violation in a test environment and inspecting the resulting error.code.