-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add partial elements #775
Add partial elements #775
Conversation
@@ -26,6 +26,5 @@ Inspect external instances (their ID and parsed XML) after parsing or provide cu | |||
|
|||
### API | |||
- `ExternalInstanceParser#addFileInstanceParser` | |||
- `ExternalInstanceparsser#addProcessor` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like addFileInstanceParser
replaced this, so I wanted to take the opportunity to clean up the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don’t feel fully comfortable with having to first create partial elements and then fill them in as opposed to only creating the elements that need to exist. But let’s experiment with this and see how it feels and performs, I may very well warm up to it! I’ll also refresh my memory on the reference verification that happens at form parse time.
Slight preference for squashing.
new Pair<>("1", "Item 1") | ||
), true)); | ||
|
||
File tempFile = TempFileUtils.createTempFile("fale-instance", "fake"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fale -> fake
Agreed! I realized when working on 5f9fc09 that our current implementation should also work for a version where a |
Work towards getodk/collect#5623
This adds the ability to provide "partial" parses of external instances using a custom
FileInstanceParser
:JavaRosa will allow partial parses for parsing/deserializing forms (by passing
partial
astrue
), but will require a "full" parse (partial
asfalse
) if it needs to resolve a reference currently involving a partialTreeElement
.Clients can also populate partial elements at an instance level by calling
DataInstance#populatePartialElements
. This will allow plugins to populate partials before they are resolved to avoid full parses (from aFilterStrategy
for example).What has been done to verify that this works as intended?
New tests. I've also built a toy implementation in Collect to validate that the API feels correct.
Why is this the best possible solution? Were any other approaches considered?
There's a few different approaches that I've discussed in different chats and also in getodk/collect#5623 (like fallbacks for individual elements rather than full parses for example). This approach has ended up winning out, so unless there's anything that feels incorrect here I don't think there's that much that needs to be pointed out.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
There should be very little risk here as the new code will only kick in if "activated" by a client. The big risk is that there's some edge case I've missed that we'll run into down the road when adding in these new features.