Azure-Samples / Azure-Samples/digital-twins-explorer

Error when Importing DTDLs generated in IoT Central using ADT Explorer, CLI works fine

Open
#234 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
215
Forks
127
PR merge metrics
No merged PRs in 30d

Description

The dtdls are simple, created in Azure IoT Central and export directly, showed below:
```
[
{
"@id": "dtmi:dtdlv2:TempSensor:original;1",
"@type": "Interface",
"contents": [
{
"@id": "dtmi:dtdlv2:TempSensor:Temperature;1",
"@type": [
"Property",
"Temperature"
],
"displayName": {
"en": "Temperature"
},
"name": "Temperature",
"schema": "double",
"unit": "degreeCelsius",
"writable": true
},
{
"@id": "dtmi:dtdlv2:TempSensor:Humidity;1",
"@type": [
"Property",
"RelativeHumidity"
],
"displayName": {
"en": "Humidity"
},
"name": "Humidity",
"schema": "double",
"unit": "percent",
"writable": true
}
],
"displayName": {
"en": "TempSensor"
},
"@context": [
"dtmi:iotcentral:context;2",
"dtmi:dtdl:context;2"
]
}
]
```
Following errors will pop up when import using ADT Explorer:
>DocumentParseError: Failed to parse input. Error: jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.
at n. (https://explorer.digitaltwins.azure.net/static/js/2.2bafa1d5.chunk.js:2:7913129)
at c (https://explorer.digitaltwins.azure.net/static/js/2.2bafa1d5.chunk.js:2:7185557)
at Generator._invoke (https://explorer.digitaltwins.azure.net/static/js/2.2bafa1d5.chunk.js:2:7185345)
at Generator.E.forEach.e. [as throw] (https://explorer.digitaltwins.azure.net/static/js/2.2bafa1d5.chunk.js:2:7185980)
at s (https://explorer.digitaltwins.azure.net/static/js/2.2bafa1d5.chunk.js:2:7898628)

Need to remove `"dtmi:iotcentral:context;2"` from `"@context"` in order to perform a successfully import using ADT Explorer.

OR using CLI, the import will success without editing the original file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.