Azure / Azure/azure-iot-cli-extension
[bug] `az iot central device-template create` does not accept DTDL v2 interfaces
- Dominant language
- Python
- Stars
- 88
- Forks
- 78
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 9
Description
`az iot central device-template create` does not accept DTDL v2 interfaces
**To Reproduce**
Install the latest with `az extension remove azure-iot && az extension add azure-iot`
Follow the [reference docs to create a device template](https://docs.microsoft.com/en-us/cli/azure/iot/central/device-template?view=azure-cli-latest#az_iot_central_device_template_create-required-parameters)
Use the next DTDL v2 Model as the input file
```json
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:com:example:basic;1",
"@type": "Interface",
"displayName": "basic",
"contents": [
{
"@type": "Telemetry",
"name": "temperature",
"schema": "double"
}
]
}
```
**Expected behavior**
A device template is added to my central app
**Observed behavior**
```text
{'code': 'InvalidBody',
'message': "The provided request body contains the following errors:
should have required property 'capabilityModel';
['@type'] should be array.
```
**Environment (please complete the following information):**
```
C:\code> az --version
azure-cli 2.19.1 *
core 2.19.1 *
telemetry 1.0.6
Extensions:
azure-iot 0.10.13
interactive 0.4.4
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\rido2\.azure\cliextensions'
Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]
```
Contributor guide
Research direction
Start by reproducing the failure with the `az iot central device-template create` command and the DTDL v2 model shown in the issue, then inspect the command's implementation and its request-building path. Done means the command accepts the DTDL v2 interface and successfully adds the device template to the Central app without the reported validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100