Closed ruthoferroman closed 1 year ago
At present, there is no facility for tagging Properties with arbitrary metadata. This has been a somewhat common request, so I would not be surprised to see a future DTDL language extension that provides a mechanism for this. In the meantime, one thing you might be able to do is use a mocked-out language extension. This will not work for models you submit to ADT, but it can work for any models you process with code under your control. The DTDLParser accepts an option to allow models to contain undefined extension context specifiers:
ParsingOptions options = new ParsingOptions() { AllowUndefinedExtensions = WhenToAllow.Always };
ModelParser modelParser = new ModelParser(options);
When a model specifies an undefined extension, its elements are allowed to contain undefined co-types, and when an element has an undefined co-type, it is allowed to contain undefined properties. Therefore, you can write something like this:
{
"@context": [
"dtmi:dtdl:context;3",
"dtmi:com:example:alert:extension;1"
],
"@id": "dtmi:test:anInterface;1",
"@type": "Interface",
"contents": [
{
"@type": [ "Property", "Alert" ],
"name": "IsErr",
"schema": "boolean",
"description": {
"en": "General alarm",
"de": "Allgemeiner Alarm",
"es": "Alarma general"
},
"alertCategory": "Common faults"
}
]
}
@jrdouceur sounds good! I'll try it. Thanks!
I want to declare some boolean properties in my models as alerts. Therefore i would need some additional "meta" properties like a alert category etc. Is there a way to achive this?
something like the following would be great: