cloud-cap-samples
cloud-cap-samples copied to clipboard
feat: PoC for dynamic constraints using standard cds views
Experimental Dynamic Constraints
This example demonstrates how to use dynamic constraints in a CAP application. It includes a service definition and a test setup to validate the constraints.
Prerequisites
You've setup the cap/samples like so:
git clone -q https://github.com/sap-samples/cloud-cap-samples cap/samples
cd cap/samples
npm install
Testing
Test like that in cds.repl from cap/samples root:
cds repl --run bookshop/test/dynamic-constraints
await AdminService.create ('Books', { title:' ', author_ID:150 })
The recent commit adds ...
- constraints views on service entities level
-
baseassociation to refer to data excluded from service entities (hereAuthors:books) from within constraints - automatic validations after each 'CREATE' → would be before
COMMITlater.
Recent commit https://github.com/SAP-samples/cloud-cap-samples/pull/847/commits/65eccfad33551db246b60b0eb757aeb0d0a519be moved all experiments into a dedicated folder so we could merge to main w/o damage.