DSL model "Tags"
Although Telosys now has many annotations for customizing entities, not all use cases can be predicted in advance and it is not possible to define enough annotations to meet all needs.
This is why the "tags" have been added.
The user can now add information to the attributes of an entity by definig tags of his choice.
Tags are an important advance in the adaptability and flexibility of models.

General principles for tags:

    a tag starts with the character "#"
    it is placed in the same block as the annotations (between {and})
    it can have any name
    it may or may not have a value
    in the templates we can check if a tag is present or not and possibly use its value
      $attrib.hasTag("tagName") Check if "tagName" is defined for $attrib
      $attrib.tagValue("tagName") Get "tagName" value

Example 1 - Simple tag without value :

Tag "mytag" in entity file :
1
MyEntity {
2
id : int { @Id } ;
3
4
// tag "mytag" (without value) :
5
comment : string { #mytag } ;
6
}
Copied!
Usage in a template :
1
#if ( $attrib.hasTag("mytag") )
2
## do something ...
3
#end
Copied!

Example 2 - Tag with value :

Tag "OpenAPIFormat" in entity file :
1
MyEntity {
2
id : int { @Id } ;
3
4
// tag "OpenAPIFormat" with value :
5
val : long { #OpenAPIFormat(int64) } ;
6
}
Copied!
Usage in a template :
1
#if ( $attrib.hasTag("OpenAPIFormat") )
2
$attrib.tagValue("OpenAPIFormat")
3
#end
Copied!
Last modified 2mo ago