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

[BUG] IoT PnP: Empty string not allowed in "mapValue": { "name": "xyz", "schema": "string"} #505

Closed
Salazander opened this issue Apr 26, 2022 · 2 comments
Labels
backlog by design This is working as it was designed to. DTDL enhancement New feature or request Plug and Play Feature: Plug and Play related

Comments

@Salazander
Copy link

Describe the bug
I'm working on the DTDL definition of a new OSConfig module.
Here's the work in progress: https://github.com/Salazander/iot-plugandplay-models/blob/main/dtmi/osconfig/pmc-1.json
I tried to set a "mapValue" of type "string" to "" (empty string) using Azure IoT Explorer, but the input validation rejects empty strings.
image

Since setting an empty string is overloaded with a very specific meaning in our case, setting "" as mapValue is valid from our point of view. Is there anything in the docs that suggest that empty strings are invalid? https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#map

To Reproduce
Steps to reproduce the behavior:

  1. Add a writeable Property with a map to any PnP Model that gets loaded from a local folder
{
  "@context": "dtmi:dtdl:context;2",
  "@id": "dtmi:osconfig:pmc;1",
  "@type": "Interface",
  "displayName": "Repro",
  "description": "Repro",
  "contents": [
    {
      "@type": "Property",
      "name": "desiredState",
      "schema": {
        "@type": "Object",
        "fields": [
          {
            "name": "sources",
            "schema": {
              "@type": "Map",
              "mapKey": {
                "name": "id",
                "schema": "string"
              },
              "mapValue": {
                "name": "entry",
                "schema": "string"
              }
            }
          }
        ]
      },
      "writable": true
    }
  ]
}
  1. Open Device -> Module identities > IoT Plug and Play components -> Properties (writable)
  2. Try to set an empty string as input parameter for entry
  3. -> Input validation fails

Expected behavior
An empty string "" is a valid input parameter for mapValues of type "string"

Screenshots
image
Note the unrelated validation issue with numbers.

Desktop (please complete the following information):

  • OS: Windows
  • OS Version: 22000.613
  • App version: local build based on latest main and Preview Release 0.14.5.0
@Salazander Salazander added bug Something isn't working needs review Review required by team member labels Apr 26, 2022
@YingXue
Copy link
Member

YingXue commented Jul 26, 2022

Hi @Salazander
The asterisk start beside 'entry' does indicate this is a required property.
At the time everything is a required a property, so that's what this tool is enforcing.
I remember there has been discussions around DTDL languages support optional property before, unfortunately we are lacking bandwidth to update the tool to keep up the latest.
Will keep this item in our backlog, and when the time comes we will update the tool to be compliant with DTDL v3

@YingXue YingXue added enhancement New feature or request by design This is working as it was designed to. backlog and removed needs review Review required by team member bug Something isn't working labels Jul 26, 2022
@YingXue YingXue added the Plug and Play Feature: Plug and Play related label Aug 30, 2022
@YingXue YingXue added the DTDL label Dec 6, 2022
@YingXue
Copy link
Member

YingXue commented Mar 14, 2023

@YingXue YingXue closed this as completed Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog by design This is working as it was designed to. DTDL enhancement New feature or request Plug and Play Feature: Plug and Play related
Projects
None yet
Development

No branches or pull requests

2 participants