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

Properly handle value types #27

Open
2 tasks
sergei-maertens opened this issue Apr 21, 2023 · 0 comments
Open
2 tasks

Properly handle value types #27

sergei-maertens opened this issue Apr 21, 2023 · 0 comments

Comments

@sergei-maertens
Copy link
Member

Formio component values are not limited to scalars/primitives, as the Value type currently implies.

The file upload component value is an object which contains metadata about the file + the backend URL, amongst others. This entire blob is sent to and stored in the backend. There is the added nuance that formio always wraps this in a list, even if there's no multiple uploads allowed (then the value is always a list with a single item).

Additionally, components can be toggled between 'scalar' and compound mode using the multiple flag - if that's set to True, the value of the component is an Array of values and the component itself is repeated in the interface (while the name has an index suffix).

Note that there also exist nested data structures in formio, using the parent.child key pattern - this will be stored in a submission data structure with the shape:

{
  "parent": {
    "child": "value",
  }
}

The way these values (and corresponding error data structures) are handled is not sufficient.

Affected files:

  • validate.ts
  • ...?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant