Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pczhao1210 opened this issue Nov 19, 2021 · 1 comment

Comments

@pczhao1210
Copy link

pczhao1210 commented Nov 19, 2021

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.

@jamiewilbraham
Copy link
Collaborator

Hi @pczhao1210 - I believe this should have been addressed in this commit 416aa85.

Let me know if you still see the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants