Skip to content

Add ability hide GraphQL fields via feature flag

Sean Arnold requested to merge sarnold-197129-graphql-feature-flag into master

What does this MR do?

This adds the functionality of easily hiding a GraphQL field behind a feature flag.

This can be done like so:

    field :id, GraphQL::STRING_TYPE,
      null: false,
      description: 'ID of the item',
      feature_flag: :test_feature

When the feature_flag option is given, we:

  • Append the description to indicate it's behind a feature flag.
  • Check if the Feature flag is enabled, by overriding the visible? method. If it is not enabled, we return a Field 'xxx' doesn't exist on type 'xxx' error.

Does this MR meet the acceptance criteria?

Conformity

Related to #197129 (closed)

Edited by Sean Arnold

Merge request reports

Loading