Add optional regex constraints
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Regex example
|
||||
|
||||
Regex constraints are optional. Run this example with the `regex` feature enabled:
|
||||
|
||||
```sh
|
||||
cargo run -q -p decodal --features regex -- examples/regex/main.dcdl
|
||||
```
|
||||
|
||||
Without the feature, regex validation returns an unsupported feature diagnostic.
|
||||
@@ -0,0 +1,7 @@
|
||||
let
|
||||
Identifier = String & /^[A-Za-z_][A-Za-z0-9_]*$/;
|
||||
ApiName = Identifier & /^api_/;
|
||||
in
|
||||
{
|
||||
service = ApiName default "api_gateway";
|
||||
}
|
||||
Reference in New Issue
Block a user