Specification

Example of an UMX Model

UMX is a simple data modelling language optimized for interoperability and code generation.

All language expressions are newline separated meaning you can only use one per line. Available expressions are:

  • Class Headers [%Class%] are placed inside square brackets

  • Comments #%Comment% are prefixed with an #

  • Fields %Name%:%Type%<%Generic%>? begin with the field name, followed by an colon and the type of the field, which can also be another class. A field is made nullable by appending an ? at the end of the type. Some classes also accept generic types, which are placed inside diamonds.

All fields below a class header are associated with the individual class until a new header starts. Comments on the other hand always are applied to the element below them. Multiple lines of comments are collected in an sequential list.

When a file has been successfully parsed, an intermediate model is created which can also be dumped as a json file using the Online IDE and looks something like this

{
    "types": [
        {
            "name": "Timestamp",
            "fields": [
                {
                    "name": "seconds",
                    "type": "Int",
                    "generic": null,
                    "nullable": false,
                    "comments": []
                },
                {
                    "name": "nanos",
                    "type": "Int",
                    "generic": null,
                    "nullable": false,
                    "comments": []
                }
            ],
            "comments": []
        },
        ...
    ]
}

These models are then used by the generator to create language specific representations of the described model. Since the data format is really minimalistic, the generators generally give a ton of freedom with their config parameters.

Last updated