sails-graphql
sails-graphql copied to clipboard
generateSchema(sails.models)
using
import { generateSchema } from 'sails-graphql';
generateSchema(sails.models);
causes
TypeError: Cannot read property 'charAt' of undefined
Client.js
module.exports = {
attributes: {
id: {
type: 'string',
primaryKey: true,
required: true
},
firstname: {
type: 'string'
},
lastname: {
type: 'string'
},
therapists: {
unique: true,
collection: "therapist",
via: "clients"
}
}
};
Therapist.js
module.exports = {
attributes: {
id: {
type: 'string',
primaryKey: true,
required: true
},
firstname: {
type: 'string'
},
lastname: {
type: 'string'
},
clients: {
unique: true,
collection: "client",
via: "therapists"
}
}
};
+1
+1
The root of this problem appears to be when types, queries, and mutations are attempted to be created for waterline-generated join models. You can get around this by filtering the models with hasSchema == true
. However, this just opens up the door for many other issues. Overall, the library is not ready for use.
+1
+1
Any updates on this?
I tried @scottrhoyt solution for model that has schema. But still the same error appears. Any ideas guys?
I'm sorry for not looking at this project for a very long time. I just created it for fun a few years ago and didn't expect that it can be useful for someone else. Honestly, I forgot that it even exists :) I'll look into this issue in the near future.