Issue #961 in the CADL repository discusses the utility of Bosque style data constraints. It would be great to have support from the Bosque side to allow these constraints to be specified in Bosque as well as in the CADL expression language. E.g. allow:
function accountValidator(balance: Int, kind: AccountKind, owners: List<AccountOwner>): Bool {
if (owners.empty()) {
return false;
}
elif (owners.size() == 1n) {
return kind === AccountKind::single;
}
else {
if (!owners.unique(pred(a, b) => a.name !== b.name)) {
return false;
}
return kind === AccountKind::joint;
}
}
...
ensure ${accountValidator}[./validators/account.bsq]
for more complex validation logic in addition to:
ensure if (kind == "joint") { owners.length > 1 }
from #961.
Key wins here would be:
- CADL specs can use the full expressive power of Bosque and trivially handle the no side-effect requirement.
- We get the CADL -- structured input fuzzing/solving, semantic version checking, and auto-mock generation -- features for free!
This is a longer term project and requires collaboration with CADL:
Issue #961 in the CADL repository discusses the utility of Bosque style data constraints. It would be great to have support from the Bosque side to allow these constraints to be specified in Bosque as well as in the CADL expression language. E.g. allow:
for more complex validation logic in addition to:
from #961.
Key wins here would be:
This is a longer term project and requires collaboration with CADL: