Domain-specific syntax guide

A quick-guide for all the domain-specific syntax supported in Imagine V1

Data model


Model 'model-name' {
'field-name' <field-type> [<field-property> 'field-property-value', <field-property> 'field-property-value']...]
}
Relation <relation-name> {
many 'child-relation-name' from <child-model-name>
one 'parent-relation-name' from <parent-model-name>
}

model-name : User-selected name for the Model

field-names : User-selected name for the fields of the Model

field-types : string, integer, float, datetime, boolean

field-properties : primary-key (for string and integer); max-length and choice (for string); range, min and max (for integer and float); unique (for all); nullable (for all); default (special default values: auto-increment, now) (for all)


relation-name : User selected name for the relationship between two Models

child-model-name : the model-name of the child Model in many-child-to-one-parent relationship

parent-model-name : the model-name of the parent Model in many-child-to-one-parent relationship

child-relation-name : User-selected name for the child Model relation

parent-relation-name : User-selected name for the parent Model relation


Storage


database 'database-name' <database-choice>

API


API /'api-name' {
actions [<action>, <action>]
permissions [<permission-name>, <permission-name>]
model <model-name>
filter [<field-name>, <field-name>]
data [<field-name>, <field-name>]
}

api-name : User-selected name for the API

actions : create, read, update, delete, CRUD, readmany

model : the model-name of the Model you want to manipulate with the API handler

permissions : the permission-names of Permissions needed to access the API handler

data : the field-names of fields from a Model that the API handler should expect or return; ALL returns all field of the Model

filter : the field-names of fields from a Model that an API can be filtered (only applicable for read and readmany actions; ALL returns all fields of the Model


Authorization


Permission 'permission-name'
Permission 'permission-name'
Role 'role-name' [<role-related-permission>, <role-related-permission>...]
Role 'role-name' [<role-related-permission>, <role-related-permission>...]

permission-name : User-selected name for the Permission

role-name : User-selected name for the Role

role-related-permissions : the permission-names of Permissions that are relevant for the Role