wayfair-incubator / node-froid

Project generated via @wayfair-incubator oss-template
MIT License
15 stars 1 forks source link

fix: include all enum values in FROID schema #26

Closed gwardwell closed 9 months ago

gwardwell commented 9 months ago

Description

When an enum is used in a key, only one enum definition is included from one of the subgraphs (and perhaps not the owning subgraph). This means Node FROID schema will only include a partial enum definition if the enum differs across subgraphs. Here's an example:

# Subgraph A
type Foo @key(fields: "enumField") {
  enumField: UsedEnum!
}

enum UsedEnum {
  A
}
# Subgraph B
enum UsedEnum {
  B
} 
# Node FROID schema
enum UsedEnum {
  B
}

type Foo @key(fields: "enumField") implements Node {
  id: ID!
  enumField: UsedEnum!
}

Solution

For the above subgraph schema, the enum definitions should be combined so all values are present:

# Node FROID schema
enum UsedEnum {
  A
  B
}

type Foo @key(fields: "enumField") implements Node {
  id: ID!
  enumField: UsedEnum!
}

Type of Change

Checklist

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (58ab7b4) 95.83% compared to head (2c4d875) 95.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #26 +/- ## ========================================== + Coverage 95.83% 95.87% +0.04% ========================================== Files 22 22 Lines 889 898 +9 Branches 252 254 +2 ========================================== + Hits 852 861 +9 Misses 37 37 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.