hasura / hasura/graphql-engine

Support for renaming fields without breaking existing clients

Open
#6,984 1 comment 12 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Related to https://github.com/hasura/graphql-engine/issues/2695 as well as https://github.com/hasura/graphql-engine/issues/2943 is the ability to evolve a schema by renaming fields.

Currently a field rename that does not break existing clients is cumbersome -- it requires a rename of the field in Hasura plus a computed field with the old name to return the same value.

The alias feature is *almost* perfect here, except adding an "alias" removes the original name from the schema (the usage of the word "alias" doesn't seem correct here either -- alias is generally used as an "additional" name for something, not as a complete replacement of the original name).

If an alias could be set without dropping the original name, we could rename fields, and then add a deprecated alias from the old name to the new name. Existing clients would continue to work, but would get deprecation warnings.

Contributor guide

Open the contributing guide

Research direction

Start by reading the related issues 2695 and 2943 and the discussion in this issue. The change is done when a renamed field can retain its original schema name as a deprecated alias, allowing existing clients to continue working while receiving deprecation warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.