yarax / swagger-to-graphql

Swagger to GraphQL API adapter
MIT License
924 stars 150 forks source link

Error from node-request-by-swagger #142

Closed mckernanin closed 5 years ago

mckernanin commented 5 years ago

I'm getting errors from node-request-by-swagger. Here's the repo: https://github.com/mckernanin/eveql You can run it with npx now dev -p 4000. Open playground at http://localhost:4000/api/, and try to run the following query:

{
  get_alliances
}

I get an error like this (partial stack trace):

"TypeError: Cannot read property 'get' of undefined",
"    at /private/var/folders/kh/023qgpds3_gf9c3q8ll27k9w0000gn/T/zeit-fun-03f877bd92c6e/api/node_modules/node-request-by-swagger/index.js:17:28",
"    at Array.forEach (<anonymous>)",
"    at Object.getRequestOptions [as default] (/private/var/folders/kh/023qgpds3_gf9c3q8ll27k9w0000gn/T/zeit-fun-03f877bd92c6e/api/node_modules/node-request-by-swagger/index.js:15:31)",
"    at Object.request (/private/var/folders/kh/023qgpds3_gf9c3q8ll27k9w0000gn/T/zeit-fun-03f877bd92c6e/api/node_modules/swagger-to-graphql/lib/swagger.js:176:61)",
"    at Object.<anonymous> (/private/var/folders/kh/023qgpds3_gf9c3q8ll27k9w0000gn/T/zeit-fun-03f877bd92c6e/api/node_modules/swagger-to-graphql/lib/index.js:78:36)",

It looks like your call to node-request-by-swagger has 3 parameters:

request(obj, {
    request: request,
    url: url,
    method: method,
}, '')

while the library is looking for 4 params:

function getRequestOptions(endpoint, fixture, baseUrl, schemaParameters) {}
mckernanin commented 5 years ago

Referencing the latest master branch in my package.json seems to have fixed the issue. A release would be great :D

0xR commented 5 years ago

Since release 1.9 we're not depending on request-by-swagger anymore. The latest master is released.

Can this issue be closed?

mckernanin commented 5 years ago

Yep, thanks!