form-js icon indicating copy to clipboard operation
form-js copied to clipboard

Offer API to get the type of schema variables

Open marstamm opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

We are working provideing variable suggestions to the user throughout the BPMN-Process. For this, we want to use linked form-js forms and extract the return variables.

Currently, we can use getSchemaVariables.

Also returning the type of the variable (e.g. Number/String/List/Boolean/...) would allow us to display this information in the variable suggestions. This helps users when the Context of the Form is no longer available during BPMN modeling.

Related to https://github.com/bpmn-io/form-js/issues/555, typed input variables would allow for more fine-grained linting, verifying that the variables are present and have the correct format.

Describe the solution you'd like

  • Offer an API that returns schema variable names with types. E.g.
getSchemaVariables(schema, {typed: true})

---

{
  textField_1: "String",
 numberField_1: "Number"
}

Describe alternatives you've considered

  • Don't show types for variables from forms
  • Manually parse the schema

Additional context

https://camunda.slack.com/archives/C043W5V88M7/p1677665447021069 https://github.com/bpmn-io/form-js/issues/555

marstamm avatar Mar 02 '23 08:03 marstamm

This is not a very easy task, so I'll remove the spring cleaning label.

Skaiir avatar Jul 21 '23 21:07 Skaiir

Worth noting that now that we have more complex nesting structures, we need to also account for it, making it a bit more complex.

https://github.com/bpmn-io/form-js/issues/913#issuecomment-1826469239

Skaiir avatar Nov 26 '23 02:11 Skaiir