ek9_query_constrained_types

Answers first: constrainedTypeNames[], then constrainedTypes[] (name, module, file, line, constrains, constraint, admissibleWindow, suffix) and summary counts.

Category: Enquiry · Compare: Constrained-types outline panel (reuse-discovery)

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

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

ArgumentTypeRequiredWhat it is
baseTypeFilterstringFilter to constrained types whose base type matches (case-insensitive, e.g. 'String' finds EmailAddress, PostCode, ...).
moduleFilterarray of stringRestrict to these exact module names. Default: workspace-wide.
nameFilterstringCase-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.