Skip to content

Conversation

@Namyts
Copy link
Contributor

@Namyts Namyts commented Jan 6, 2026

I would like my IDE (VSCode) to understand the expected schema for the gqlgen.yml file. I generated, proofread, and quickly tested this schema file.

This removes the slightly frustrating choice of commenting out most properties and their descriptions in my gqlgen.yml vs cleaning up the file and having to refer back to the documentation whenever I make changes.

There may be difficulties keeping this in sync with the source ./init-templates/gqlgen.yml.gotmpl, but overall this standard is probably more useful long-term

To use the following to the top of the gqlgen.yml:

# yaml-language-server: $schema=[LINK TO THIS FILE]

I have:

  • Added tests covering the bug / feature (see testing)
  • Updated any relevant documentation (see docs)

@Namyts Namyts marked this pull request as ready for review January 6, 2026 11:26
@Namyts Namyts requested a review from StevenACoffman as a code owner January 6, 2026 11:26
@Namyts
Copy link
Contributor Author

Namyts commented Jan 6, 2026

Looks like this.

image

@coveralls
Copy link

Coverage Status

coverage: 0.0%. remained the same
when pulling 1adeccb on Namyts:patch-1
into 319534b on 99designs:master.

@StevenACoffman
Copy link
Collaborator

Thanks! This is very useful! Sorry for the delay in getting back to you. We should at least document that this is even an option for folks. It looks like this same config would also work for other IDE's like JetBrains (GoLand)?

What should the default schema location be? "https://raw.githubusercontent.com/99designs/gqlgen/refs/heads/master/schemas/gqlgen.schema.json"

Is there some authoritative place we should consider registering our config schema? It looks like maybe schemastore maybe? Looking at
https://github.com/SchemaStore/schemastore/pull/5273/changes it seems like a PR like this:

    {
      "name": "gqlgen GraphQL server go generate configuration",
      "description": "gqlgen configuration to go generate a GraphQL server. See https://gqlgen.com/config/",
      "fileMatch": [
        "**/gqlgen.yaml", 
        "**/gqlgen.yml"
      ],
      "url": "https://raw.githubusercontent.com/99designs/gqlgen/refs/heads/master/schemas/gqlgen.schema.json"
    },

We could add a configuration option so that they could add (and override the default) the schema location when we init a new gqlgen config.

golangci-lint uses their own configuration schema to enable configuration verification but chose not to embed their configuration schema into their binary in golangci/golangci-lint#4646 . However I get rate limit flakiness in my CI as a result, so I'm kind of personally annoyed by this decision on their part.

We could alternatively try moving this file into the docs/static/ directory, like we do for main.css, so people can access it using https://gqlgen.com/gqlgen.schema.json by default. (At least, I think so, but the website's Hugo render.com setup was made by 99designs folk before my time and is unclear to me.) That might allow more generous rate limits? Or less? I don't have any idea.

@StevenACoffman StevenACoffman merged commit 61591af into 99designs:master Jan 10, 2026
16 of 18 checks passed
@Namyts
Copy link
Contributor Author

Namyts commented Jan 12, 2026

Thanks for merging!

SchemaStore could be a good idea 👀

It seems to support versioning, hosting, and even storing the schema itself - all of which would solve the rate limiting issues. But probably best (like you suggested) to point to this repo, keep default as master, and per-version use the tags https://raw.githubusercontent.com/99designs/gqlgen/refs/tags/v0.17.86/gqlgen.schema.json. Might be a good idea to create a github action to create a PR whenever the schema file is modified. SchemaStore seems to have considered code ownership to automate PR approvals!

For the file location within this repo - completely up to you (I am just happy it exists 😅 ). It's a meta file so a schema folder or keeping in the root make sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants