ek9_query_constrained_types
Answers first: constrainedTypeNames[], then constrainedTypes[] (name, module, file, line, constrains, constraint, admissibleWindow, suffix) and summary counts.
When to use it
Is there already a constrained type over this base, or admitting this range - one call with baseTypeFilter:'String' or nameFilter:'Email'. Scope it with moduleFilter; no arguments lists every constrained type.
When not to use it
- Looking for multi-field data shapes — use
ek9_query_recordsinstead. - Looking for a class with behaviour — use
ek9_query_classesinstead. - You want the constrained type's full SOURCE (the declaration as written, comments and all) — use
ek9_read_constructinstead. This response carries the constraint predicate itself, so it answers 'what does it admit?' without reading the source.
Details
constraint is the predicate as written ('>= 16 and <= 100'), present whenever the compiler modelled it. admissibleWindow is the inclusive interval it folds to, present only for a decidable Integer range. suffix is the shared currency or unit ('#GBP', 'mm') when the literals carry one — a Money type over GBP does not serve a USD need. constrains is the base type recovered from the synthesized base constructor (the super-aggregate is Any, not the base). nameFilter/baseTypeFilter are plain case-insensitive substrings, not regex; moduleFilter is an exact-name allow-list; built-in org.ek9.* types are excluded. status: ok (matches returned) / empty (none match, or moduleFilter named a non-existent module — meta.unmatchedFilters[] then carries module:<value>) / error (no compiled program — run ek9_compile first).
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
baseTypeFilter | string | Filter to constrained types whose base type matches (case-insensitive, e.g. 'String' finds EmailAddress, PostCode, ...). | |
moduleFilter | array of string | Restrict to these exact module names. Default: workspace-wide. | |
nameFilter | string | Case-insensitive substring match on constrained-type names. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
List all
Request
{ }
Response
{
"constrainedTypeNames" : [ "DrivingAge", "Salary" ],
"constrainedTypes" : [ {
"admissibleWindow" : "[16, 100]",
"constrains" : "Integer",
"constraint" : ">= 16 and <= 100",
"file" : "constrained.ek9",
"line" : 6,
"module" : "com.example.constrained",
"name" : "DrivingAge"
}, {
"constrains" : "Money",
"constraint" : ">= 10000#GBP and <= 120000#GBP",
"file" : "constrained.ek9",
"line" : 9,
"module" : "com.example.constrained",
"name" : "Salary",
"suffix" : "#GBP"
} ],
"meta" : {
"serverMs" : "<timing>"
},
"status" : "ok",
"summary" : {
...
Cut short here: 4 more lines. The whole recorded call.