I'm curious if this sounds crazy or not, but I'm looking to take the GQL queries Payload CMS makes possible and automatically make them available on the Next.JS side of my application.
Is there a tool or common methodology for this? I noticed types and schema are exportable by default. Not sure if these are related to a potential solution.
I discussed this with my team and it seems like the tradeoff is to either use REST to not have to define GQL requests and have less control over the request size or use GQL but have to maintain the Query strings.
We opted for the latter and just to improve our interface for making requests. If there's any feedback as to why this would be a terrible idea, let me know lol.
not sure if I understand the problem 10=%, but wouldn't exporting the GQL Schemas and importing them in your IDE do that? It should give you autocompletion in your IDE
autocompletion isn't a huge concern for me atm. but yeah you're right that that should do that for me.
The issue is that any time I update fields in Payload, I have to go over to the Next.js side and make sure it's sync'd up.
Ultimately though, it's hard to tell what fields you want to keep and want to exclude in an automated fashion so we prefer to keep that maintenance layer going and to just do what we can to make that a clean process.
I think the IDE can automatically download / update the gql definitions! There's a fancy plugin for intellijs which does that, for example
I swear to god this was mentioned somewhere in this discord but I cannot find it - it was months ago
I think I used this plugin for intellij
you can add a remote schema there
and in there you specify the gql endpoint or sth like that
interesting... I'll def take a look! Thanks @Alessio 🍣
oh shame on me
I insulted intellij by calling it
Get help straight from the Payload team with an Enterprise License.