Azure / opendigitaltwins-dtdl

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

Clarify versioning rules around enums #35

Open jspaith opened 4 years ago

jspaith commented 4 years ago

My understanding is that once I define (e.g.) Enum Color {Red, Blue, Green} and publish the interface, then I can NEVER add a Yellow object.

This also flows from https://github.com/Azure/IoTPlugandPlay/tree/master/DTDL#enum describing the enumValues as immutable.

I think it would still be very useful in https://github.com/Azure/IoTPlugandPlay/tree/master/DTDL#enum and anywhere else discussing enums to explicitly call out this behavior. This probably makes sense for a modeling language that has versions, but devs coming from a language like C where enums can always be expanded need to be aware of DTDL behavior.

jspaith commented 4 years ago

Also same question around adding new fields in an Object. And probably more generally.

I'd recommend adding actually a spec that walks through examples of what is and isn't allowed, in addition to expanding out samples a bit with rules in doc. Thanks.

briancr-ms commented 4 years ago

Thanks for the feedback! I agree with the need for more examples and details on versioning. A separate doc with more descriptions and examples is a good idea.