Skip to content

Typegen, resolvers, and gatsby config #27

@interim17

Description

@interim17

Use Case

There are a number of ways we could leverage gatsby features like graphqlTypegen, the gatsby node APIs, graphql files (.gql) to make development in this framework easier and more typesafe.

I think we can avoid runtime bugs.

Gatsby can autogenerate very exact typing for the schema created in its APIs like createSchemaCustomization, createResolvers etc.

The scope of addressing this could vary but I see these as possible subtasks:

  • configure gatsby to use graphqlTypegen: true, generate and commit the types file
  • refactor one (or more) files to use the generated types in place of manual typing
  • adjust and update schema customization to fit this more precise typing
  • migrate some (or all) of the string literal in createSchemaCustomization to .gql files to leverage IDE support in writing schemas
  • use resolvers for new schema in place of downstream data unpacking functions to ensure fields are present and populated according to various logic
  • install vitest and write test suites for resolvers (important especially if resolvers are untyped/raw javascript)
  • stretch: consider TS migration for aspects of gatsby config

In general I think this will be a good modernizing push and will make for a smoother dev experience and less runtime weirdness.

I started working on this while trying to address Issue #7 but frankly it's a big topic and not worth serving as a roadblock to small front end features.

That said, refactoring takes more time the larger a codebase gets so I'd rather work on this sooner than later.

Acceptance Criteria

Please describe how you know this is done

Details

Please provide any helpful specifications

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions