[BUG] Exception if there's a root path in spec
See original GitHub issueJust tried to integrate this library into my project and I just found a case where the library fails.
There is an issue with the getPathToMethodName function.
When I have a root path (/) in the paths object of the spec, the library crashes: “Cannot read property ‘toUpperCase’ of undefined”.
It’s caused by line 116, but originates from line above.
If the result variable is an empty string it throws.
I “fixed” it by doing this before calling the getTypescriptCode function:
if (spec.paths.hasOwnProperty('/')) {
let prop = spec.paths['/'];
delete spec.paths['/'];
spec.paths['/index'] = prop;
}
This solution fixes the issue partially, because now the target path in the generated code is wrong.
The solution to the issue might be using an alias for the / path, like index for example.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
BUG! exception in phase 'semantic analysis' - Stack Overflow
I use Groovy/Spock for testing It has two dependencies - jars build with Apache Maven 3.1.1 and jdk 1.8. I build the jars...
Read more >Can't find a root directory while resolving a config file path.
I expected that the test suite runs with the specified configuration because when I do jest --showConfig it shows my rootDir as /Users/code/ ......
Read more >A folder that is created under the root of the system drive is ...
A folder that is created under the root of the system drive is missing entries in its security descriptor, which may cause some...
Read more >Upgrading your build from Gradle 6.x to the latest
If your build still uses this deprecated feature, consider refactoring the build to have the root directory match the physical root of the...
Read more >Solve “unable to find valid certification path to requested target”
It does this by checking whether the root certificate authority who signed it is present in its internal trusted list. If it does...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Merged and published as 3.0.3. Thanks @sjwilczynski! Please reopen if it doesnt solve the problem for you @VentyCZ
Created a PR for that.