web-components icon indicating copy to clipboard operation
web-components copied to clipboard

Support for derived types

Open dselman opened this issue 4 years ago • 1 comments

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.

dselman avatar May 13 '20 14:05 dselman

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

alsoarpit avatar Feb 09 '22 06:02 alsoarpit