Azure / opendigitaltwins-dtdl

Digital Twins Definition Language
Creative Commons Attribution 4.0 International
466 stars 160 forks source link

Components should allow for nesting #103

Open krwq opened 3 years ago

krwq commented 3 years ago

Here is a scenario: In https://github.com/dotnet/iot/ we have libraries for many devices. Some of them have complex structures, i.e.:

multiple levels of nesting would allow us to create DTDL per device and share the structure publicly and it could be re-used by other things using it. Currently if we share SenseHAT or MPU9250 it already contains 1 level (max) nesting which means the shared Interface cannot be embedded further.

In normal configuration users would use multiple sensors, i.e. MPU9250 would likely be used with more sensors and therefore natural way would likely be creating an interface where you can add component which can reference the DTDL of MPU9250 and adding other things you use in your app. Since MPU9250 already has one nesting level user cannot use it as component and has to manually create a new DTDL which lifts up MPU9250 telemetry and components into user's DTDL.

In dotnet/iot we consider generating the DTDLs from code and having support for nesting would be much easier to handle and would be more re-usable.

Ideally nesting should not have any limitations in depth (but should not allow for cycles) but at minimum I think 10 levels should be enough for most applications.

briancr-ms commented 3 years ago

I was looking at this issue today (because we've been discussing it) and realized that I never responded here. Sorry about that!

Thanks for submitting this issue. We're looking at improving some of the limits in DTDL, including component nesting. We don't have details to share, but will update this issue as we know more.