Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@4F2E4A2E
Last active January 28, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4F2E4A2E/d8da9003f561762a6b4631efbeb2e5e1 to your computer and use it in GitHub Desktop.
Save 4F2E4A2E/d8da9003f561762a6b4631efbeb2e5e1 to your computer and use it in GitHub Desktop.
const {GraphQLServer} = require('graphql-yoga');
const swaggerGraphQLSchema = require('swagger-to-graphql');
const API_BASE_URL = 'http://petstore.swagger.io/v2';
swaggerGraphQLSchema('./schema/petstore.swagger.json')
.then(schema => {
const options = {
port: 4000
};
const server = new GraphQLServer({
schema,
context: {
GQLProxyBaseUrl: API_BASE_URL
}
});
server.start(options, () => console.log('Server is running on localhost:' + options.port))
})
.catch(e => {
throw e;
});
@4F2E4A2E
Copy link
Author

Swagger v2 type file currently not supported. Save change the swagger file type definition into object or string like this:

--- petstore.swagger.json
+++ petstore.swagger.json
@@ -408,7 +408,7 @@
             "in": "formData",
             "description": "file to upload",
             "required": false,
-            "type": "file"
+            "type": "object"
           }
         ],
         "responses": {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment