question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Exception if there's a root path in spec

See original GitHub issue

Just 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mtennoecommented, Jan 9, 2020

Merged and published as 3.0.3. Thanks @sjwilczynski! Please reopen if it doesnt solve the problem for you @VentyCZ

1reaction
sjwilczynskicommented, Jan 8, 2020

Created a PR for that.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found