-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Prevent FES from checking nested properties #7824
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
Prevent FES from checking nested properties #7824
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! |
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.
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.name
does not include a dot (.
). Eg.options
will be included, butoptions.extrude
will be ignored.Additional Issues Fix/ Changes Made:
entry.params
is checked with fallback now to prevent run time errors to throw in case of missing (i.e.,undefined
)if-else
block is reduced to avoid redundancy.Observations/ Results
Consider the list of
params
as below:Before with the existing code,
After modifications, it will get documented as:
Testing/ Validation
Validated the logic to see the changes in
parameterData.json
artifact 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.