open-formulieren / open-forms

Smart and dynamic forms
https://open-forms.readthedocs.io
Other
36 stars 26 forks source link

Infer the data type of User defined variables #3599

Open CharString opened 1 year ago

CharString commented 1 year ago

As far as I can tell, the only reason to define a variable is if you intend to use it.

This would partially close #2707, because together with #3597, #3598 and https://github.com/open-formulieren/InferNoLogic/issues/2, just the assignment to userVar in the action would be enough to infer that it is in fact a date type.

Some advanced Form Designers, may like to specify the type they intend for their variables, so the type checker may help them catch it when they make a mistake. For instance when they intend to use the variable in a ServiceFetch or a registration backend.

Adding a data type "auto" and make it the default for user defined variables, would enable both use cases.

Adding the types a registration backend expects and for servicefetch services that have a OpenAPI spec to the context, analogue to #3597, would make "auto" sufficient for everything but unspecified services.

joeribekker commented 10 months ago

Type inference feature was cancelled due to implementation difficulties vs benefits.