VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.88k forks source link

"Live" GraphQL export to .graphql files #2517

Closed SachaG closed 4 years ago

SachaG commented 4 years ago

Currently you can run Vulcan.getGraphQLSchema() to generate a single schema.graphql file that contains your entire GraphQL schema for debugging purposes. A nice and fairly easy way to improve this would be to:

  1. Make this automatic on any code change
  2. Split out this file into one file per collection
eric-burel commented 4 years ago

Also a bit related: https://github.com/VulcanJS/Vulcan/issues/2479, switching to Mongoose could allow us to export database schema too

eric-burel commented 4 years ago

You may want to check that this feature is safe in production, as creating a file may fail in rare case (permissions issue for example). It should either run only in dev or getGraphqlSchema be wrapped in a try catch.

Also do you think it can run before the schema is made executable? See https://github.com/VulcanJS/Vulcan/issues/2536, currently debugging an invalid schema is tricky because it makes app startup failing and does not output the incriminated schema, so you have to log manually. It could be way easier to debug if we simply export a .graphql file before trying to actually make it executable in Apollo.