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

mapping array without functions #214

Open
CRdeGraaf opened this issue Apr 22, 2021 · 0 comments
Open

mapping array without functions #214

CRdeGraaf opened this issue Apr 22, 2021 · 0 comments

Comments

@CRdeGraaf
Copy link

CRdeGraaf commented Apr 22, 2021

Hey there, love the plugin. I wanted to give feedback on my usecase / problem.

I am trying to provide a wide range of mapping posibilities to the end user as part of an extensively configurable interface. incoming data will come from a range of different systems, some I will not know about myself. Thus i want to provide a way for end users to configure their own mappings. This plugin so far was perfect, as i could allow users to place json files in a config folder with different mappings for different triggers.

Where i get stuck however is on arrays. Morphism requires me to use a function to map data to a destination array. And functions, for valid security reasons, cannot and should not be part of the json standard.

i am not looking for complex data translation functions, merely allowing the end user to shuffle object fields and arrays.

A simple example:

incoming:

  "client": {
    "source": "mko",
    "externalId": "123",
    "lastname": "efal",
    "initials": "T",
    "addresses": [
      {
        "streetname": "dam 1",
        "postalcode": "1101AA",
      },
      {
        "streetname": "dam 2",
        "postalcode": "1102AA",
      }
    ]
  }
}

impossible mapping.json:

  "source": "client.source",
  "externalId": "client.externalId",
  "lastname": "client.lastname",
  "initials": "client.initials",
  "addresses": ??
}

Describe the solution you'd like
I would ideally see some supported syntax for simple array translation without functions, such as:

  "source": "client.source",
  "externalId": "client.externalId",
  "lastname": "client.lastname",
  "initials": "client.initials",
  "addresses": {
      _array: "client.addresses"
      "streetname": "_.streetname",
      "postalcode": "_.postalcode",
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant