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.

ImportSpec error is not handle

See original GitHub issue

We should not destructure the param here ->

This can cause this kind of error:

> restful-react import --file ../documentation/docs/reference/api/idp.swagger.json --output src/components/queries/idp.tsx --transformer schema-transformer.js

                var openapi = _a.openapi;

TypeError: Cannot read property 'openapi' of undefined
    at /Users/lucasroesler/Code/contiamo/idp/ui/node_modules/restful-react/lib/bin/restful-react-import.js:249:34
    at /Users/lucasroesler/Code/contiamo/idp/ui/node_modules/call-me-maybe/index.js:13:28
    at processTicksAndRejections (internal/process/next_tick.js:74:9)
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:5

If something we have an error, the program break before the actual error handler 😅

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

dbtlrcommented, Dec 16, 2019

Any word on when this might be fixed? I’ve messed around with this a bit and found a potential solution, but I’m unsure of the downstream effects.

It seems like this is caused in the definition for swagger2openapi.d.ts, which needs to define data as optional for the convertObj callback to be valid.

swagger2openapi appears to use the call-me-maybe library, which follows gives the following response:

  • If promise is fulfilled, then it is called with the result of the promise: cb(null, result)
  • If promise is rejected, then it is called with the rejection error: cb(err)

The downstream effect that I can predict for this is that offending block needs to look more like this, as de-structuring no longer works when you fix the interface.

      swagger2openapi.convertObj(schema, {}, (err, data) => {
        if (err) {
        } else {

I don’t really like the way this looks and I’m not sure if there is any case where an undefined would be passed into resolve, however, in theory it would only happen on err anyway.

fabien0102commented, Dec 21, 2019

The real question is always, are yours specs really valid or the linter is failing? (I’m asking because we had the case previously, and appear that was a hole in the linter…)

Whatever, if you have a fix I will review your PR with pleasure before christmas, otherwise I will try to apply your solution on monday 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

while checking deployment option: invalid ovf ... - GitHub
I have noticed another (minor) issue that I will create a new ticket for though: the vsphere provider does not handle vApp Properties...
Read more >
How to Fix an Import Specification Error in Microsoft Access
“Run-Time error '3625': The text file specification 'My Saved Access Import Spec' does not exist. You cannot import, export, or link using ...
Read more >
Handling possible type of import errors - python - Stack Overflow
I am trying to handle possible errors seen during import operations at the beginning of the execution of python program.
Read more >
Import Spec Sections to the Admin Tool - Procore Support
How to bulk import project spec sections if your company has NOT enabled the Specifications tool on a project.
Read more >
Managed Object - OvfManager(vim.OvfManager) - VMware
Error handling. All result types contain warning and error lists. Warnings do not cause processing to fail, but the caller (typically, the user...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found