# 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.&#x20;

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&#x20;
* 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 :

```
MyEntity {
  id  : int { @Id } ;

  // tag "mytag" (without value) :
  comment : string { #mytag } ;
}
```

Usage in a template :

```
#if ( $attrib.hasTag("mytag") )  
## do something ...
#end
```

### Example 2 - Tag with value :

Tag "**OpenAPIFormat**" in entity file :

```
MyEntity {
  id  : int { @Id } ;

  // tag "OpenAPIFormat" with value :
  val : long  { #OpenAPIFormat(int64) } ;
}
```

Usage in a template :

```
#if ( $attrib.hasTag("OpenAPIFormat") )  
$attrib.tagValue("OpenAPIFormat")
#end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://news.telosys.org/version-3.3.0/dsl-model-tags.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
