I was messing around with your library and ran into an issue with optional parameters, specifically using Media.GetVideoEncoderConfigurationOptions. Originally, I could only get the function to complete by specifying both parameters, but it seems based on the specification that I should be able to use the function without needing to supply the params to get 'generic' configuration options for the device.
After some digging, it seems like the issue can be traced to function. When passed no parameters in the calling function, the resulting object passed to this function is something like
which causes the function to throw an error at Object.keys later in the recursive chain when evaluating undefined. I believe the problem can be solved by replacing the line with return params ? reducer(params)(reqNode)() : ''. However, I am not to familiar with typescipt as well as the other effects this may have in the library. Does this seem correct? Another option would be to add a line like if (!obj[key]) return acc; before this line
The resulting strings w/params and without params after making this change:
Hi @patrickmichalina,
I was messing around with your library and ran into an issue with optional parameters, specifically using Media.GetVideoEncoderConfigurationOptions. Originally, I could only get the function to complete by specifying both parameters, but it seems based on the specification that I should be able to use the function without needing to supply the params to get 'generic' configuration options for the device.
After some digging, it seems like the issue can be traced to function. When passed no parameters in the calling function, the resulting object passed to this function is something like
which causes the function to throw an error at
Object.keys
later in the recursive chain when evaluating undefined. I believe the problem can be solved by replacing the line withreturn params ? reducer(params)(reqNode)() : ''
. However, I am not to familiar with typescipt as well as the other effects this may have in the library. Does this seem correct? Another option would be to add a line likeif (!obj[key]) return acc;
before this lineThe resulting strings w/params and without params after making this change:
<trt:GetVideoSourceConfigurationOptions><trt:ProfileToken>recording</trt:ProfileToken><trt:ConfigurationToken>0</trt:ConfigurationToken></trt:GetVideoSourceConfigurationOptions>
<trt:GetVideoSourceConfigurationOptions></trt:GetVideoSourceConfigurationOptions>
which my device correctly interprets.