graphql-binding / graphql-static-binding

Generate static binding files for a GraphQL schema
MIT License
24 stars 7 forks source link

(Optionally) include typeDefs in generated .ts (.js) file #48

Open Fonz001 opened 6 years ago

Fonz001 commented 6 years ago

I'd like to use my own bindings in the browser, but the typeDefs aren't available (fs.readFile). A solution is to import the typeDefs separately (fetch in the browser). But I'd prefer to have the typedefs available in the generated .ts file, like Prisma does.

Could this be included in the default generator? (binding-ts) .

(Or maybe have this available as option for the default generator)

kbrandwijk commented 6 years ago

I like the idea, but I'd like to get some more feedback on this. Including typeDefs by default for a large schema will significantly increase file size. On the other hand, you'll need the schema anyway, so it might just as well be in that file.

Re configuration option. I currently don't see other cases for providing configuration options, so I don't want to do that right now. The issue being that such options will bubble up all the way to either graphql prepare command line options, or additional graphql-config extension options.

Fonz001 commented 6 years ago

I agree that configuration option for this might be an overkill 👍 If default including is not desired, we could also make a binding-typedefs-ts . But I think that default including is better.