Azure / opendigitaltwins-dtdl

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

Device Capability Model exported from IoT Central fails validation in PnPCodeGen #51

Closed johnhaire89 closed 4 years ago

johnhaire89 commented 4 years ago

Not sure if it's an issue with IoT Central or an issue with the json schema document, but there seems to be a mismatch.

To reproduce this, we can create a new device template in IoT Central by importing the capability model for the MXChip IoT DevKit. I then exported the capability model and tried to run the "IoT Plug and Play: Generate Device Code Stub" within VS Code.

The error returned is

[ERROR][PnPCodeGen] Invalid content of the capabilityModel, error: Microsoft.Azure.IoT.DigitalTwin.Parser.ModelParserException: Content is not valid

Name=urn:szasDemo:szas_alert_device_v4:1, Id=http://azureiot.com/v1/classes/Interface/contents, Description=Extra Node found.http://azureiot.com/v1/classes/Interface/contents

I managed to fix it by deleting "contents": [], near the bottom of the json document.

rido-min commented 4 years ago

Thanks @johnhaire89,

I followed your repro steps but the exported JSON does not include the offending "contents": [].

There was another issue related to support @context with an Array.

Both issues should be fixed now, let me know if you can still repro.

rido-min commented 4 years ago

@johnhaire89 have you been able to repro it with the latest version?

rido-min commented 4 years ago

closing due to the lack of response. @johnhaire89 if you still reproes this issue, please reactivate.