Skip to content

Commit 3324eee

Browse files
committed
Merge branch 'release-1.1'
2 parents af4df17 + 3cc5eea commit 3324eee

File tree

13 files changed

+4678
-109
lines changed

13 files changed

+4678
-109
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["es2015", "stage-0"],
3+
"plugins": ["add-module-exports"]
4+
}

.flowconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[ignore]
2+
3+
[include]
4+
5+
[libs]
6+
7+
[options]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ npm-debug.log
2424
dump.rdb
2525
bundle.js
2626

27-
dist
27+
lib
2828
coverage
2929
.nyc_output
3030
flow-coverage

bin/swagger2graphql.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
var argv = require('yargs').argv;
3+
var build = require('../lib');
4+
var graphql = require('graphql');
5+
6+
if (argv.help) {
7+
console.log('\nUsage: swagger2graphql --swagger=/path/to/schema.json');
8+
}
9+
10+
if (!argv.swagger) {
11+
console.log('\nPlease provide path to swagger schema. \n--help for usage example');
12+
}
13+
14+
build(argv.swagger).then(schema => {
15+
console.log(graphql.printSchema(schema));
16+
});

example.js renamed to example/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
require('babel-polyfill');
12
const express = require('express');
23
const app = express();
3-
var graphqlHTTP = require('express-graphql');
4-
var graphql = require('graphql');
5-
var graphQLSchema = require('./lib');
4+
const graphqlHTTP = require('express-graphql');
5+
const graphQLSchema = require('../lib');
66

7-
graphQLSchema('./test/fixtures/petstore.json').then(schema => {
7+
graphQLSchema(`${__dirname}/../test/fixtures/petstore.yaml`).then(schema => {
88
app.use('/graphql', graphqlHTTP(() => {
99
return {
1010
schema,
@@ -16,7 +16,7 @@ graphQLSchema('./test/fixtures/petstore.json').then(schema => {
1616
}));
1717

1818
app.listen(3009, 'localhost', () => {
19-
console.info(`http://localhost:3009/graphql`);
19+
console.info('http://localhost:3009/graphql');
2020
});
2121
}).catch(e => {
2222
console.log(e);

example/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "swagger-example",
3+
"version": "1.0.0",
4+
"license": "MIT",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "node example.js"
8+
},
9+
"dependencies": {
10+
"babel-polyfill": "^6.23.0",
11+
"express": "^4.15.3",
12+
"express-graphql": "^0.6.6",
13+
"graphql": "^0.10.1",
14+
"swagger-to-graphql": "../."
15+
}
16+
}

0 commit comments

Comments
 (0)