Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Couldn't get the example to work.. #1

Open
srl295 opened this issue Jan 29, 2015 · 1 comment
Open

Couldn't get the example to work.. #1

srl295 opened this issue Jan 29, 2015 · 1 comment

Comments

@srl295
Copy link

srl295 commented Jan 29, 2015

var fetchSchema = require('fetch-swagger-schema');
var swaggerNodeClient = require('swagger-node-client');

fetchSchema('http://petstore.swagger.wordnik.com/api/api-docs', function(error, schema){
   if(error) return console.error(error);
   //console.log('Schema:', schema); 

   // Assuming the variable schema exists
   var api = swaggerNodeClient(schema);

});

returns

  [TypeError: Cannot read property 'forEach' of undefined]

seems to be coming out of swagger-client-generator's processSchema() function.

@unsetbit
Copy link
Contributor

unsetbit commented Feb 9, 2015

Hmm, I'm pretty sure this is due to the switch to 2.0 (fetch-swagger-schema was written against Swagger 1.2). That url no longer resolves to the swagger json. I did a quick search but couldn't find where the 1.2 example petstore example has moved to (if it has been moved at all).

I think the short-term solution is setting up a mirror of the old version of the petstore api docs. The long-term solution is to update this library to support Swagger 2.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants