Azure / opendigitaltwins-dtdl

Digital Twins Definition Language
Creative Commons Attribution 4.0 International
473 stars 161 forks source link

Array supports the use of Componenet #181

Open chanhyupkim opened 6 months ago

chanhyupkim commented 6 months ago

For flexible modeling, I would like to use a pre-defined Componenet in Array. Why are the following formats not supported, and do you have any plans to support them in the future?

{ "@type": "Telemetry", "name": "ledState", "schema": { "@type": "Array", "elementSchema": "Component" } }

rido-min commented 6 months ago

Components allow to create composable interfaces by referencing another interface.

Arrays allow to describe a message with a sequence of different elements in the same message.

What is the use case to create an Array of Components?

Maybe, updating your example with a concrete interface that will be used as a component will help us to understand your requirement.

chanhyupkim commented 6 months ago

If the Array is supported to have a Component format, it has the advantage of being able to plug-in multiple models in a Component format by defining a single model. As it is not currently supported, it is cumbersome to create a model in a separate Object format under the Array when defining multiple models (the same code must be rewritten)

In addition, it would be good to support defining the component within the component for the same reason.