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

@kie-tools/form-generation-tool: Doesn't set a default value on array field types #1313

Open
pefernan opened this issue Jun 7, 2024 · 2 comments
Assignees
Labels
area:form-generation-tool type:bug Something is behaving unexpectedly

Comments

@pefernan
Copy link

pefernan commented Jun 7, 2024

When generating the binding expression to bind the model data into the form state, the generated tool sets a default value for each input. but It doesn't do so for array data types leaving the property null.
This could cause problems in the runtime when submitting the payload with the null array.

Steps to reproduce:

  1. Build the jbpm-compact-architecture example (mvn clean install) to generate the json schemas.
  2. Run the form-generation-cli to generate forms (it doesn't matter the type)
  3. Start the jbpm-compact-architecture in dev mode (mvn clean compile quarkus:dev or pnpm -F @kie-tools-examples/jbpm-compact-architecture-example quarkus:dev)
  4. Start a hiring process instance from the Process Definitions tab. After submit you'll get see the error dialog appear

Image
Image

@pefernan pefernan self-assigned this Jun 7, 2024
@pefernan pefernan converted this from a draft issue Jun 7, 2024
@pefernan pefernan changed the title @kie-tools/form-generation-tool: Doesn't set a default value on unsupported field types @kie-tools/form-generation-tool: Doesn't set a default value on unsupported field types Jun 7, 2024
@pefernan pefernan changed the title @kie-tools/form-generation-tool: Doesn't set a default value on unsupported field types @kie-tools/form-generation-tool: Doesn't set a default value on array field types Jun 7, 2024
@pefernan pefernan added type:bug Something is behaving unexpectedly area:form-generation-tool labels Jun 7, 2024
@jomarko
Copy link

jomarko commented Jun 18, 2024

I have two observation about this issue.

01

The same object seems to have a default array field type implementation present in the task form - see the attached screenshot. Once the hiring process is started, in the Tasks view we will find the attached form view where the 'skills' has an UI elements rendered.

Screenshot 2024-06-18 104704

02

Form generation tools uses fields implemented here https://github.com/apache/incubator-kie-tools/tree/main/packages/uniforms-bootstrap4-codegen/src/uniforms . There you will easily find the message about unsupported Array field type. What is strange in our codebase is the duplication of places we implement form fields, another place is here https://github.com/apache/incubator-kie-tools/tree/main/packages/uniforms-patternfly/src, please notice there is ListField available.

Not sure if possible, but to unify user experience from tooling usage, we should probabaly minimize the amount of field implementation we use? Also it seem the external implementation has the ListField available https://uniforms.tools/docs/api-fields/

@jomarko
Copy link

jomarko commented Jan 8, 2025

This issue is partially fixed for patternfly by apache/incubator-kie-tools#2826. The bootstrap is not addressed by mentioned PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:form-generation-tool type:bug Something is behaving unexpectedly
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants