Refactor the paths to ensure that we are always referencing the corre… #189
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this change, the core library was trying to accomplish multiple "pathing" strategies using the single "path" variable passed through both the "eachComponent" as well as the "eachComponentData" methods. These paths were not following any strict rules on how they behaved causing MANY downstream issues with the renderer and data processing systems. This pull requests solves this issue by creating a very deterministic and structured pathing system when dealing with both the Form JSON as well as the Submission JSON objects.
To start, there are now 2 different "types" of paths. Form paths and Data paths. They are defined as follows.
Form Path: The path to a component within the Form JSON. This path is used to locate a component provided a nested Form JSON object.
Data Path: The path to the data value of a component within the data model for the form. This path is used to provide the value path provided the Submission JSON object.
These paths can also be broken into two different path "types". Local and Full paths.
Local Path: This is the path relative to the "current" form. This is used inside of a nested form to identify components and values relative to the current form in context.
Full Path: This is the path that is absolute to the root form object. Any nested form paths will include the parent form path as part of the value for the provided path.
These definitions are used within the new "paths" construct which defines the following paths that describe a component.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-XXXX
Description
This pull requests refactors the "eachComponentData" method to ensure that all of the paths described above are accounted for and can then be used for any component or data references throughout the SDK as well as the renderer.
Breaking Changes / Backwards Compatibility
There are a few things that should be considered "breaking" with this PR.
For example.
Dependencies
None
How has this PR been tested?
New automated tests written.
Checklist: