Types and instances together
One .ilk file holds both type declarations (what shapes exist) and instance bindings (the named entities in your domain). No separate schema files β the catalog lives with the model.
Example concrete usecase is declare a json-schema with higher-level constraints it has to respect
A .ilk file has two sections: meta declarations and instance bindings.
// Meta declaration
meta HttpResponse = {
status! Concrete<Int> // required (!), Concrete<...> means instances have to declare a value
body {...} // open : any fields allowed, no constraints
}
// Instances
creationSuccess = HttpResponse {
status 201
body {uid Uuid}
}
notFound = HttpResponse {
status 404
}
userProfile = HttpResponse {
status 200
body {
uid Uuid
name String
admin Bool
email String
}
}Traditional schemas validate shape. ilk also validates where data comes from.
@source declares which upstream fields may supply data to a downstream field. Every open field must be explicitly mapped β the compiler checks it.
| Type form | Instance form | Meaning |
|---|---|---|
String | String | Open β any value at runtime |
Concrete<String> | "webhook" | Instance-fixed β instance author picks one |
"POST" | "POST" | Type-fixed β must match exactly |
{_} // exactly 1 field of any name/type
{_ String} // exactly 1 field, meta String
{...} // any fields (open)
{id Uuid} // specific named fields
{...} & {id Uuid} // any fields + required id[]Event // 0+ elements
[3]Tag // exactly 3
[1..]Tag // 1 or more
[2..5]Tag // 2 to 5
[..10]Tag // up to 10
&Event // reference to a binding (no data flow)
[]&Event // list of referencesmeta HttpMethod = "GET" | "POST" | "PUT" // literal union
meta Status = Pending | Active | Archived // identifier union
meta Tag = {_ String} | Concrete<String> // mixed| Annotation | Purpose |
|---|---|
@main | Entry point β compiler validates from here |
@source [fields] | Data provenance: values must trace back to fields |
@constraint expr | Boolean predicate validated at compile time |
@doc "β¦" | Implementation hint, preserved in AST |