Azure / LogicAppsUX

https://learn.microsoft.com/azure/logic-apps
MIT License
75 stars 81 forks source link

Unable to map from string to string array using Logic Apps Data Mappers #5872

Open maxmorrow-rrexpress opened 1 week ago

maxmorrow-rrexpress commented 1 week ago

Describe the Bug with repro steps

Summary

This issue is specific to Logic Apps Data Mappers within Visual Studio Code specifically. This defect (or missing feature, unsure if this is expected) occurs when you try to map from a source string attribute to an array.

Repro Steps

  1. Create a new data map in VS Code
  2. Create a source schema that has no arrays and at least one string property
  3. Create a new destination schema that has a string array to map to
  4. Attempt to map from the string value to the string array
  5. Click "Save"
  6. Click "Generate XSLT"
  7. Click "Test"
  8. Run a test to validate mapping
  9. Observe that the array item is not mapped

Example Schemas

source

{
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "default": {},
    "title": "Example Source Schema",
    "required": [
        "data"
    ],
    "properties": {
        "data": {
            "type": "object",
            "default": {},
            "properties": {
                "Type": {
                    "type": "string",
                    "default": ""
                }
            }
        }
    }
}

target

{
    "$schema": "https://json-schema.org/draft/2019-09/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "default": {},
    "title": "Example Target Schema",
    "properties": {
        "Name": {
            "type": "string",
            "default": ""
        },
        "Tags": {
            "type": "array",
            "default": [],
            "items": {
                "type": "string",
                "default": ""
            }
        }
    }
}

test json

{

"data": {

"Type": "abc"

}

}

What type of Logic App Is this happening in?

Standard (VSCode)

Which operating system are you using?

Windows

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

N/A -- Unable to complete building a data mapper for use in a workflow.

Screenshots or Videos

Image

Image

Image

Browser

Additional context

We are attempting to map from a single string value to an array of string values. The use-case is for an integration that has a list of tags we need to map a single value to during an outbound HTTP request.

DanielleCogs commented 5 days ago

Hello @maxmorrow-rrexpress thank you for reporting this! I have a few follow up questions for you. I believe that this is expected behavior, but I'd like to know more about your scenario so that we can find a workaround or put a feature request in our backlog. With our current implementation, we do not change anything about the data being mapped based on the target schema type.

In this example scenario, are you needing the output to be the following: { "Name": ["abc"] }