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

Remove the low-level fallback handling #174

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

sergei-maertens
Copy link
Member

This is a bit overdue now, so clearing this up as I noticed I was starting to bump into it with the form preview.

The situation is:

  • Open Forms only supports a subset of formio components
  • Open Forms also defines some own custom components
  • It's likely at some point JSON will end up in the form definition that will contain component types that we don't know/support

It's important that the application doesn't crash when such an unsupported component is present, but the challenge is that we don't know what it looks like. So, for that, FallbackSchema exists.

In the public API entrypoints, we must allow for AnyComponentSchema and FallbackSchema, so that our type checker helps us in preventing crashes. This was and remains the case.

This PR instead moves all the fallback handling from the internal/private API, as we are feature complete in terms of supported components and don't need this anymore. This should simplify the code/maintenance quite a bit.

FallbackSchema (i.e. unknown component types) need to be handled as
soon as possible, since they make it harder to operate in type-safe
ways on downstream components. Being able to reason only in
AnyCompnentSchema simplifies implementations and guard clauses.
@sergei-maertens sergei-maertens force-pushed the chore/remove-fallback-types branch from 7a2074d to d76a52e Compare August 15, 2024 14:09
@sergei-maertens sergei-maertens merged commit 0b88686 into main Aug 15, 2024
13 checks passed
@sergei-maertens sergei-maertens deleted the chore/remove-fallback-types branch August 15, 2024 14:32
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

Successfully merging this pull request may close these issues.

1 participant