Open jbkoh opened 2 years ago
Hi @jbkoh
You can reference custom schemas and referencing those types, eg:
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:samples:customSchemas;1",
"@type": "Interface",
"schemas": [
{
"@id": "dtmi:samples:customSchemas:OffOnEnum;1",
"@type": "Enum",
"valueSchema": "integer",
"enumValues": [
{
"name": "On",
"enumValue": 1
},
{
"name": "Off",
"enumValue": 0
}
]
}
],
"contents": [
{
"@type": "Property",
"name": "myEnumOnOff",
"schema": "dtmi:samples:customSchemas:OffOnEnum;1"
}
]
}
Hi, there.
I'm trying to define a schema with DTDL v2. I see many fields are "required" while they can be referenced only. For example, I can globally define an
Enum
and refer to it by@id
in otherProperty
definitions. JSON-LD defines node reference:However, in the DTDL v2 spec,
@type
,enumValues
, andvalueSchema
are required which should not exist in referencing objects.Do DTDL respect reference nodes, where the above properties should be optional), or should I always denormalize all the references?
Thanks!