You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This configuration with parameterMacro works correctly with 3.0.0 definition and this is added to each MYPARAM parameter:
Default value : test
But when I change the API definition to 3.1.0 the list of methods does not load completely and this error occurs in the console:
swagger-ui-bundle.js:2 TypeError: Invalid value used as weak map key
at WeakMap.set (<anonymous>)
at computeEdges (swagger-ui-bundle.js:2:783849)
at swagger-ui-bundle.js:2:783924
at Array.forEach (<anonymous>)
at ArraySlice.forEach (swagger-ui-bundle.js:2:510902)
at computeEdges (swagger-ui-bundle.js:2:783900)
at swagger-ui-bundle.js:2:783924
at Array.forEach (<anonymous>)
at ArraySlice.forEach (swagger-ui-bundle.js:2:510902)
at computeEdges (swagger-ui-bundle.js:2:783900)
The whole problem seems in expected result of the function. When the parameterMacro function "does not return", then this error occurs. When I remove the condition and always return something, it loads OK and every parameter default is set to the returned value.
I have not found what value to return when I do not want to set the default value. I have also tried returning "null", but it is also used as a default value to all parameters:
It should be possible to return values only for selected parameters. When the function does not return anything or maybe when it returns null, it should not raise the error above and properly load the definition and fill the "default value" only when the function returns something.
The text was updated successfully, but these errors were encountered:
mclei-asw
changed the title
Bug with parameterMacro in 3.1.0 with returns
Bug with parameterMacro in 3.1.0 in returns
May 15, 2025
I have fixed it by attached patch. I don't know whether all occurrences are required, but at least one of them solves the problem when parameterMacro does not return any value.
Q&A
Content & configuration
Describe the bug you're encountering
This configuration with parameterMacro works correctly with 3.0.0 definition and this is added to each MYPARAM parameter:
But when I change the API definition to 3.1.0 the list of methods does not load completely and this error occurs in the console:
The whole problem seems in expected result of the function. When the parameterMacro function "does not return", then this error occurs. When I remove the condition and always return something, it loads OK and every parameter default is set to the returned value.
I have not found what value to return when I do not want to set the default value. I have also tried returning "null", but it is also used as a default value to all parameters:
then in the UI I see this for all params:
Expected behavior
It should be possible to return values only for selected parameters. When the function does not return anything or maybe when it returns null, it should not raise the error above and properly load the definition and fill the "default value" only when the function returns something.
The text was updated successfully, but these errors were encountered: