accordproject / web-components

React Components for Accord Project
Apache License 2.0
121 stars 102 forks source link

Support for derived types #55

Open dselman opened 4 years ago

dselman commented 4 years ago

Feature Request 🛍️

In the Concerto model below the field Zoo.animals can contain any type that extends the abstract type Animal. Concerto-UI does not allow the user to select the type that they want to add to the array - it appears to pick the first non-abstract type.

It would be great if (when there is more than 1 abstract type that extends a base type) the UI allows the user to explicitly select the type (both for array and for non-arrays).

namespace acme

abstract concept Animal {
 o String name
}

concept Tiger extends Animal {
}

concept Lizard extends Animal {
}

concept Zoo {
   o Animal[] animals
}

Here is the JSON created by Concerto-UI:

{
  "$class": "acme.Zoo",
  "animals": [
    {
      "$class": "acme.Tiger",
      "name": "Tigger"
    }
  ]
}

Use Case

Editing of Concerto model instances that contain a type hierarchy.

Possible Solution

Note that the sample generation code in Concerto already includes some logic to pick non-abstract types.

alsoarpit commented 2 years ago

@dselman @jeromesimeon @martinhalford @DianaLease am working on it please can you assign me this issues