Azure / opendigitaltwins-dtdl

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

Codegen v0.6.7 fails to create C code stubs for Schema: Geopoint #41

Closed uriel-kluk closed 4 years ago

uriel-kluk commented 4 years ago

This is the content definition that breaks:

     "@id": "urn:tXs:BleReader:location:1",
      "@type": [
        "Telemetry",
        "SemanticType/Location"
      ],
      "displayName": {
        "en": "Location"
      },
      "name": "location",
      "schema": "geopoint"
    },

And this is the error I get from the tool: [ERROR][PnPCodeGen] Failed to parse interface definition, @id: urn:tXs:BleReader:1, error: Microsoft.Azure.IoT.DigitalTwin.Parser.ModelParserException: Content is not valid

Name=location, Id=http://azureiot.com/v1/classes/geopoint, Description=Schema not found

johnhaire89 commented 4 years ago

I'm also experiencing this

[IoT Plug and Play] generate PnP device code failed.
[IoT Plug and Play] Check IoT Plug and Play CodeGen CLI ...CodeGen CLI v0.6.8 is installed and ready to use.
[IoT Plug and Play] Selected device capability model file: c:\Users\username\Development\mxchip\mxchip_alert_device\Capability Model20200303.json
[IoT Plug and Play] Regenerate device code using an existing CodeGen configure:
Device capability model file: c:\Users\username\Development\mxchip\mxchip_alert_device\Capability Model20200303.json
Project name: mxchip_AlertDevice
Language: ANSI C
Device connection type: DpsSasKey
Project type: CMake_Linux
Device SDK reference type: SourceCode
Project output directory: c:\Users\username\Development\mxchip\mxchip_alert_device\mxchip_AlertDevice
[INFO][PnPCodeGen] Start validating capability model...

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

Name=Coordinates, Id=http://azureiot.com/v1/classes/Geopoint, Description=Schema not found
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

[IoT Plug and Play] generate PnP device code failed.
koratshail commented 4 years ago

I am having also same problem. Can we have any solution for it?

dooriya commented 4 years ago

Thanks for the feedback.

Currently we don't support the geospacial schema in CodeGen tool, so this is a feature requirement. If you don't want to block the codegen generation for other capabilities in the DCM, you can try to change the schema type of the location data to object:

{
  "@id": "urn:tXs:BleReader:location:1",
  "@type": [
       "Telemetry",
       "SemanticType/Location"
     ],
     "displayName": {
       "en": "Location"
     },
  "name": "location",
  "schema": {
    "@type": "Object",
    "fields": [
      {
        "name": "latitude",
        "schema": "double"
      },
      {
        "name": "longitude",
        "schema": "double"
      }
    ]
  }
}

If you feel that this feature is crucial, we are happy to listen and to reconsider to put it in our road-map.

uriel-kluk commented 4 years ago

Dooriya, This works for me thanks, but suggest to fix the integration with IOTC or document it.

On Wed, Mar 25, 2020 at 3:15 AM Dooriya Li notifications@github.com wrote:

Thanks for the feedback.

Currently we don't support the geospacial schema in CodeGen tool, so this is a feature requirement. If you don't want to block the codegen generation for other capabilities in the DCM, you can try to change the schema type of the location data to object:

{ "@id": "urn:test:currentLocationTelemetry:1", "@type": "Telemetry", "name": "currentLocation", "schema": { "@type": "Object", "fields": [ { "name": "latitude", "schema": "double" }, { "name": "longitude", "schema": "double" } ] } }

If you feel that this feature is crucial, we are happy to listen and to reconsider to put it in our road-map.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Azure/IoTPlugandPlay/issues/41#issuecomment-603701486, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2NCA5OZLJYGFW5PXUVPYTRJG4STANCNFSM4JZT5G6Q .

-- *Uri Kluk*, CTO

An IoT Solutions Innovator

p: 317.661.4800 w: mesh-systems.com https://www.linkedin.com/company/mesh-systems-llc

dooriya commented 4 years ago

@uriel-kluk You can access the limitation section on the wiki page of the Workbench Extension for the CodeGen limitations. As the PnP team is going to change the geospacial type in the up-coming DTDL V2, we would like to collect more user feedback on supporting the geospacial type in CodeGen at that time and re-consider this feature. So I will close this issue here.

Thanks for your understanding and happy coding!