Yellicode models

What is a Yellicode model?

A Yellicode model is similar to a UML model. Actually, it is just a subset of UML. We've used the parts of UML that we considered most relevant for code generation, and we might add new features to it as Yellicode evolves. If you are already familiar with UML, you will recognise many elements. If you are new to UML or want to refresh your modelling skills, there are some great resources online. One of our favorites is

What makes up a Yellicode model?

A typical Yellicode model contains classes, interfaces, data types and their relationships. These "elements" are the input for your code generation templates. You create Yellicode models with our free, cross-platform modeling tool named (as you might have guessed) Yellicode Modeler.

How do I use Yellicode models?

Yellicode Modeler saves models in a special JSON format that the code generation engine understands: when you build a model-driven Yellicode template, you can use a special (TypeScript) API named @yellicode/elements to navigate through your model. Here is an example:

import { TextWriter } from '@yellicode/core';  
import { Generator } from '@yellicode/templating'; 
import * as elements from '@yellicode/elements';

Generator.generateFromModel({ outputFile: './my-output.txt' }, (writer: TextWriter, model: elements.Model) => {
    // Enumerate all classes in the model
    model.getAllClasses().forEach((c) => {
        writer.writeLine(`Class: ${}`); // Write the class name
        // Enumerate all "owned" (that is, not inherited) attributes in this class
        c.ownedAttributes.forEach(att => {
            writer.writeLine(`${} (${att.getTypeName()})`); // Write the name and the type name

You can find the full reference of the elements API here.

How do I deal with [insert programming language here] types?

A basic Yellicode model is programming language independent. However, you can easily extend your models using a UML concept named Profiles: a Profile can contain (amongst others) data types that are specific to a programming language. You can create a profiles as part of your model, but you can also create them independently. Additionally, profiles can be shared as NPM packages, so the profile you need might already be there (keep an eye on the extensions page).

Profiles also provide a very useful extension mechanism named Stereotypes: Stereotypes let you attach your own custom values to your classes, properties and other elements. So, Stereotypes let you extend your models with information that is specific to a programming language, framework or domain.

Even if you prefer to keep your model language-independent, there are still ways to generate language-specific type names. For this purpose, Yellicode provides a special interface named TypeNameProvider. An example implementation can be found in the C# extension, where basic UML types are mapped to C# types.

Go to the Quick Start »

Get Yellicode Modeler »