graphiql icon indicating copy to clipboard operation
graphiql copied to clipboard

Validate `graphql-config` using `vscode-graphql` and the available schema json

Open acao opened this issue 3 years ago • 6 comments

This is just a few lines of code!

https://raw.githubusercontent.com/kamilkisiela/graphql-config/master/config-schema.json https://code.visualstudio.com/Docs/languages/json#_mapping-a-schema-in-an-extension

I feel like if I write anything more about it, I'll officially have had spent more time planning this than implementing it as usual 😆

acao avatar Jul 30 '22 23:07 acao

CC @dotansimha , @dotansimha and @kamilkisiela! this is a quick easy win I have planned, just so it's on your radar

acao avatar Aug 01 '22 11:08 acao

CC @dotansimha and @dotansimha

kamilkisiela avatar Aug 01 '22 11:08 kamilkisiela

I was thinking of even suggesting it as a standalone extension. Then folks can use it without vscode-graphql, and say with the standalone vscode syntax extension we just released, and graphql-eslint, whatever works for folks! 🤷🏻‍♀️

acao avatar Aug 01 '22 11:08 acao

CC @B2o5T as well of course haha!

acao avatar Aug 01 '22 11:08 acao

perhaps there could be a thin client to a say, GraphQL.graphql-config extension, (or if you want to publish it yourselves and we can depend on it), where we do a bit of user-driven validation messaging as well perhaps?

as you may know, we have a graphql-config namespace in settings already staked out for you for vscode haha! there is graphql-config.load.baseDir and legacy and other parameters for loadConfig, and other settings iirc

another thing to consider is that we have extensions that want to load graphql for query exection/etc, and many more in userland who are looking to load graphql-config, so we could make a shared interface for that that wraps loadConfig with logic for common vscode extension client validation notifications/etc that you only see once no matter how many of these extensions that use the graphql-config vscode extensions you are running

acao avatar Aug 01 '22 11:08 acao

also noting this is only for .json, but here is one lead for .yaml:

https://github.com/redhat-developer/vscode-yaml#extension-settings

there are ways we could also just handle actual graphql-config validation messages as notifications on editor or save regardless of the format. to use graphql-config, itself, then errors would need to come back with positional metadata for where the error occurred in the file

acao avatar Aug 02 '22 12:08 acao