-
Notifications
You must be signed in to change notification settings - Fork 52
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
Skip FileListPreprocessor for autofill=false parameters #423
base: master
Are you sure you want to change the base?
Conversation
This commit changes the API of ModuleService and DefaultModuleService to include an optional parameter 'acrossTypes' that allows checking for solitary unresolved parameters within all inputs/outputs independent of their type, while maintaining the backwards compatible method signatures. We can then replace some duplicated logic in helper methods of FilePreprocessor and FileListPreprocessor by a call to 'moduleService.getSingleInput()', which makes them respect an 'autoFill=false' parameter annotation and avoid calling uiService.chooseFile/chooseFiles for those parameters. The intended behavior is verified by two new tests that, before this commit, are failing on their last assertion.
2aa1968
to
4168b3e
Compare
return result; | ||
} | ||
|
||
private ModuleItem<?> getSingleItem(final Module module, | ||
final Collection<Class<?>> types, final Iterable<ModuleItem<?>> items) | ||
final Collection<Class<?>> types, final Iterable<ModuleItem<?>> items, boolean acrossTypes) | ||
{ | ||
ModuleItem<?> result = null; | ||
|
||
for (final ModuleItem<?> item : items) { | ||
final String name = item.getName(); | ||
if (!item.isAutoFill()) continue; // skip unfillable inputs | ||
if (module.isInputResolved(name)) continue; // skip resolved inputs |
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.
While working on this pull request, I noticed that the above line is specific to inputs only, so the method probably doesn't show the intended behavior when called with outputs.
The current unit tests seem to miss the method signatures specific to outputs (getSingleOutput
).
I'll open a separate issue for this.
Sorry it's taken me so long to look at this. I now have a dedicated PR review day per week, and this one is on my shortlist right now to review, but I'm trying to apply the 80/20 rule to do the easiest ones first. My hangup on this one is the addition of the |
53b6733
to
3dc99c9
Compare
This pull request is a work in progress.This pull request changes the API of
ModuleService
andDefaultModuleService
to include an optional parameterboolean acrossTypes
that allows checking for solitary unresolved parameters within all inputs/outputs independent of their type, while maintaining the backwards-compatible method signatures.This allows to replace some duplicated logic in helper methods of
FilePreprocessor
andFileListPreprocessor
by a call tomoduleService.getSingleInput()
, which makes them respect anautoFill=false
parameter annotation and avoid callinguiService.chooseFile/chooseFiles
for those parameters.The intended behavior is verified by two new tests that, before this PR, were failing on their last assertion.
NB: The tests added here call
uiService.setHeadless(false)
in order to set their custom default UI.