Skip to content
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

object notation should be optional #87

Closed
phra opened this issue Apr 25, 2017 · 2 comments
Closed

object notation should be optional #87

phra opened this issue Apr 25, 2017 · 2 comments

Comments

@phra
Copy link

phra commented Apr 25, 2017

hi,

when i'm trying to generate a type and a mutation from this example schema, the generator will crashes because of missing 'type' property on the field.

'use strict'

var mongoose = require('mongoose')
var example= new mongoose.Schema({
	title: String
})

module.exports = mongoose.model('Example', example)

changing the schema in this way make the generator works again:

'use strict'

var mongoose = require('mongoose')
var example= new mongoose.Schema({
	title: { type: String, }
})

module.exports = mongoose.model('Example', example)
@sibelius
Copy link
Collaborator

this is probably a problem with the way with parse mongoose schema in this function: https://github.com/lucasbento/create-graphql/blob/master/packages/generator/src/utils.js#L134

do you wanna send a PR fixing this?

@phra
Copy link
Author

phra commented Apr 27, 2017

Nice!

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

No branches or pull requests

3 participants