Prevent FES from checking nested properties#7824
Prevent FES from checking nested properties#7824davepagurek merged 2 commits intoprocessing:dev-2.0from
Conversation
|
Hi @davepagurek May I request to have a look at this PR. Based on the discussion happened in #7752 and as per the comment, I have planned to do it in two stages. One of which is in this PR - preventing FES to mistakenly checking the nested parameters (other positional parameters). The second stage that I am thinking is to make the properties of the Optional params to be more informative like a syntax below: [
"String",
"String?",
{
"type": "Object",
"optional": true,
"properties": {
"successCallback": "function(p5.Geometry)?",
"failureCallback": "function(Event)?",
"normalize": "boolean?",
"flipU": "boolean?",
"flipV": "boolean?"
}
}
]The additional key as CC: @ksen0 @limzykenneth |
|
The code looks good so far @IIITM-Jay! Could you run |
|
For the second stage, it might make sense to apply the same format to all parameters. Currently, it looks like there are two different ways a parameter might be optional, either ending with a [
{ "type": "String", "optional": true },
{ "type": "String", "optional": true },
{
"type": "Object",
"optional": true,
"properties": {
"successCallback": { "type": "Function", "optional": true, parameters: [{ type: "p5.Geometry" }] },
"failureCallback": { "type": "Function", "optional": true, parameters: [{ type: "Event" }] },
"normalize": { "type": "boolean", "optional": true },
"flipU": { "type": "boolean", "optional": true },
"flipV": { "type": "boolean", "optional": true }
}
}
]Some upsides would be:
Some downsides:
|
|
Yeah Sure! |
davepagurek
left a comment
There was a problem hiding this comment.
Awesome, those parameterData.json changes look like what we'd expect, so I think this is good to go when the automated tests finish!
yes, I totally agree with this. Just a small observation from my side, here the first two are from your comments:
|
|
The tests failed but I'm pretty sure it's just due to a flaky test (#7823), I'm rerunning them now |
Yes, @davepagurek I have already seen this and then after your suggestions I honestly felt to open a second PR for second stage possible more detailed and changes. |
|
Thanks a lot @davepagurek! for your time once again for insights and review. |
|
@all-contributors please add @IIITM-Jay for code |
|
I've put up a pull request to add @IIITM-Jay! 🎉 |
No issues @davepagurek ! we will fix this too! 🤗 , but will dig into this one first.! |
Addresses #7752
Approach:
.includes()string method. If the parameter name contains a (.) (likeoptions.extrude), we assume it’s nested, so skip it.t.namedoes not include a dot (.). Eg.optionswill be included, butoptions.extrudewill be ignored.Additional Issues Fix/ Changes Made:
entry.paramsis checked with fallback now to prevent run time errors to throw in case of missing (i.e.,undefined)if-elseblock is reduced to avoid redundancy.Observations/ Results
Consider the list of
paramsas below:Before with the existing code,
After modifications, it will get documented as:
Testing/ Validation
Validated the logic to see the changes in
parameterData.jsonartifact so generated. It modified the parameters of the overload function as expected.PS: I have committed the file to visualize and validate the changes so occurerd.