Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

danjoa
Copy link
Member

@danjoa danjoa commented Jul 16, 2025

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 })

See also: bookshop/test/dynamic-constraints/readme.md

@danjoa
Copy link
Member Author

danjoa commented Jul 23, 2025

The recent commit adds ...

  • constraints views on service entities level
  • base association to refer to data excluded from service entities (here Authors:books) from within constraints
  • automatic validations after each 'CREATE' → would be before COMMIT later.

@danjoa
Copy link
Member Author

danjoa commented Jul 24, 2025

Recent commit 65eccfa moved all experiments into a dedicated folder so we could merge to main w/o damage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant