Azure / opendigitaltwins-dtdl

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

Using v2 and v3 contexts at the same time is valid #165

Closed digimaun closed 1 year ago

digimaun commented 1 year ago

Using the dtdlparser 1.0.48-preview, I noticed you are able to combine the v2 and v3 contexts at the same time. One thought around this, is by allowing mixed contexts it feels like it undermines at least one v3 extension which is quantitativeTypes v1.

Taking the first example off the quantitative types reference, removing the extension from @context causes an error as expected

image

However you can fix it by adding the v2 context, skipping usage of quantitative types altogether.

image

jrdouceur commented 1 year ago

The context rule in JSON-LD is that later contexts override earlier contexts. So, your second example is actually DTDL v2. It is not a combination of v3 and v2. If you try to use a v3 feature (such as Array in Property) in your second example, it will fail with an error.

digimaun commented 1 year ago

Understood, thanks for explaining this JSON-LD rule.

Separate from the original issue, I also want to confirm that in DTDL v2, you are able to use unknown context specifiers where-as in v3 only known context specifiers are allowed right?

Here is example with v2 that is valid

image

Which fails with v3

image

digimaun commented 1 year ago

Closing, will follow up on the additional question later.