Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[go-graphql-spa-version] Provide explicit schema file #10

Open
Marcial1234 opened this issue Nov 16, 2024 · 1 comment · May be fixed by #12
Open

[go-graphql-spa-version] Provide explicit schema file #10

Marcial1234 opened this issue Nov 16, 2024 · 1 comment · May be fixed by #12

Comments

@Marcial1234
Copy link

Marcial1234 commented Nov 16, 2024

Currently the GraphQL schema is linked to a URL (roundest-go.fly.dev/graphql), however it's preferable to have explicit schemas to then codegen the Go types, and general reproduction of the project not having to rely on deployed data.

My current intent is to reverse engineer the current schema so that the project doesn't rely on a deployed schema - although it could also be reversed engineered from the Go-backend code - to then tie in gql.tada (sources: Theo, and Fireship) for codegen, types, and syntax highlighting. These were the main pain points Theo mentioned on his video of these versions.

@Marcial1234 Marcial1234 changed the title [GraphQL-versions] Provide explicit schema file [go-graphql-spa-version] Provide explicit schema file Nov 16, 2024
@Marcial1234
Copy link
Author

Marcial1234 commented Nov 16, 2024

For other issues:

  • I do believe Theo's frustration with GraphQL field asserts can be mitigated using qgl.tada as asserting every schema field (e.g. [Foo!]!), as it uses a tsconfig plugin and LSP for type safety. However, the code savings are negligible (I implemented it but decided not to include it in the above PR). In Theo's gql.tada video itself it also included syntax highlighting for "unused" field, but couldn't replicate it. This method might have saved him frustration with his current codegen approach.
  • Code Gen in go is possible, but to have DB annotations it'd require extra config (if using https://github.com/99designs/gqlgen per LLMs suggestions) that's equivalent to the hard-coded typings. With graphql-codegen-go they auto populate code similar to the current go-structs, but they auto gen many all possible types that aren't used which will increase the "LOC" metric.

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 a pull request may close this issue.

1 participant