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

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

Open
benjie opened this issue Apr 29, 2024 · 2 comments
Open

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

benjie opened this issue Apr 29, 2024 · 2 comments

Comments

@benjie
Copy link
Member

benjie commented Apr 29, 2024

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

@benjie
Copy link
Member Author

benjie commented Apr 30, 2024

Related: graphql/graphql-js#4018

@benjie
Copy link
Member Author

benjie commented Apr 30, 2024

Turns out Self also doesn't exist; and both are for the reason outlined in the graphql-js issue above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🌱 In Progress
Development

No branches or pull requests

1 participant