-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with showing results #7
Comments
ping @djhi |
Yes, that's due to conflicting references to the |
Different |
@djhi I ran into a similar error as the original poster even when I created a brand new project with no other dependencies. I made a repo you can use to try it out: https://github.com/acusti/graphql-schema-from-json-test/. From that repo, I’ve listed the relevant files below. Here’s {
"name": "a",
"version": "1.0.0",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"graphql-schema-from-json": "^0.0.3"
}
} Here’s const getSchemaFromData = require('graphql-schema-from-json').default;
const { printSchema } = require('graphql');
const data = {
posts: [
{ id: 1, title: "Lorem Ipsum", views: 254, user_id: 123 },
{ id: 2, title: "Sic Dolor amet", views: 65, user_id: 456 },
],
users: [
{ id: 123, name: "John Doe" },
{ id: 456, name: "Jane Doe" }
],
comments: [
{ id: 987, post_id: 1, body: "Consectetur adipiscing elit", date: new Date('2017-07-03') },
{ id: 995, post_id: 1, body: "Nam molestie pellentesque dui", date: new Date('2017-08-17') }
]
}
// Get the schema as a JSON object
const schema = getSchemaFromData(data);
// Print the GQL for this schema
console.log(printSchema(schema)); When I run
When I then run
Platform versions:
|
As a follow-up, I did another test that uses yarn resolutions to make {
"name": "a",
"version": "1.0.0",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"graphql": "0.12.3",
"graphql-schema-from-json": "0.0.3"
},
"resolutions": {
"graphql-schema-from-json/graphql": "0.12.3"
}
} Looking in
|
I have the same issue, even when I lock in to the same version of graphql that graphql-schema-from-json uses: package.json{
"name": "tools",
"version": "0.0.0",
"private": true,
"scripts": {
"genSchema": "babel-node genSchema"
},
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-3": "^6.24.1",
"graphql-schema-from-json": "0.0.3",
"graphql": "~0.11.7"
},
"babel": {
"presets": [
"env",
"stage-3"
]
}
} genSchema.jsimport getSchemaFromData from 'graphql-schema-from-json'
import { printSchema } from 'graphql'
const data = {
posts: [
{ id: 1, title: 'Lorem Ipsum', views: 254, user_id: 123 },
{ id: 2, title: 'Sic Dolor amet', views: 65, user_id: 456 }
],
users: [
{ id: 123, name: 'John Doe' },
{ id: 456, name: 'Jane Doe' }
],
comments: [
{ id: 987, post_id: 1, body: 'Consectetur adipiscing elit', date: new Date('2017-07-03') },
{ id: 995, post_id: 1, body: 'Nam molestie pellentesque dui', date: new Date('2017-08-17') }
]
}
// Get the schema as a JSON object
const schema = getSchemaFromData(data)
// Print the GQL for this schema
console.log(printSchema(schema)) ERROR
|
schema looks like this:
|
I am also running into this issue. Do you have an ETA on a fix? |
No, but you're welcome to investigate too and send a pull request ;) |
That's fair. You should drop a note in the readme that says the project doesn't work until this issue is fixed. |
I made this, which is not as complete, but it fit my purpose and doesn't throw errors. It also works for protobuf & jsonschema. |
ping @djhi |
are we having a fix for this issue? |
While this is brocken i recomend this workarround: |
I used the code in the example & ran 'npm start'
The text was updated successfully, but these errors were encountered: