-
Notifications
You must be signed in to change notification settings - Fork 53
Fix deserialization multiple args #77
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
Fix deserialization multiple args #77
Conversation
|
FixDeserialazation -> FixDeserialization |
|
could you specify in the title of the commit that it is realated to the param serializer. E.g: |
| { | ||
| w | " if (parameters[\"" + groupLabel + "\"][\"" + parameterName + "\"].asBool())" | ||
| | " {" | ||
| | " deserializedVectorFlaggedArgs.push_back(\"" + flag + "\");" |
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.
deserialazation -> deserialization
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.
When you write
Multiple arguments can either be flagged or positional
do you mean
Argument described using "multiple=true" can either be flagged or positional
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.
Yes. I'll fix that.
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.
When an multiple argument is present ...
->
Argument described using "multiple=true" are found in both JSON and in the command line, similarly to other arguments, the values of the JSON are ignored.
|
Tests are failing with |
|
Nice work overall 👍 After fixing the remaining issues, we should be in good shape |
The longflag has a higher priority over the flag.
…alization The code wasn't handling multiple parameters correctly and crashing when trying to deserialize arrays of arrays. This commit addresses that. Arguments using "multiple=true" can either be flagged or positional. - When they are positional, they must be the last argument of the CLI. In this case, the infrastructure already handles this. - When they are flagged, we need to detect that the argument allows for multiple flag/value pairs. To do so, we introduce the map called deserializedMultipleArgsMap. It stores a map of flag to vector of values. Json can populate that map based on the values it reads. Otherwise the command line parsing will populate this map. When an argument using "multiple=true" is present in the JSON and in the command line, simirarly than with other arguments, the values of the JSON are ignored. Testing for all the types that support the multiple argument is added.
The JSONModuleDescription did not escape the already escaped quote marks correctly, causing build error: error: expected ';' after top level declarator " \"Default\" : \"\\"1\\"\",\n" Escaping the escape character fixes this. A parameter with a string default with quotes is also added to testing to make sure that this works. Reported-by: Andrey Fedorov <fedorov@bwh.harvard.edu> Tested-by: Andrey Fedorov <fedorov@bwh.harvard.edu> Thanks: Andrey Fedorov <fedorov@bwh.harvard.edu>
d607f3b to
768beb7
Compare
|
@jcfr: Thanks for all the comments ! I uploaded an updated version with all the fixes you suggested. |
|
Thanks 👍 |
|
👍 |
Following the concerns raised in the Slicer's #576 (Slicer/Slicer#576), this addresses:
This also adds more testing and factorizes some of the testing infrastructure to be more easily extendable.
@jcfr, @thewtex: PTAL