Skip to content

Current enum value isn't present on GraphQLEnumType_values_value scope #2035

Closed
@benjie

Description

const makeDeprecateEnumsPlugin = (enumTypeName: string, enumValues: string[], deprecationReason: string): GraphileConfig.Plugin => ({
  name: `DeprecateEnumsPlugin_${enumTypeName}_${enumValues.join("_")}`,
  value: "0.0.0",

  schema: {
    hooks: {
      GraphQLEnumType_values_value(value, build, context) {
        if (context.Self.name !== enumTypeName) return value;
        if (!enumValues.includes(context.scope.OH_NO_THIS_DOESNT_EXIST_YET)) return value;
        return {
          ...value,
          deprecationReason,
        }
      }
    }
  }
});

Should be equivalent to the fieldName on the GraphQLObjectType_fields_field scope. enumValueName?

Hipri: sylv

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions