Skip to content
Snippets Groups Projects

Add a rule to enforce resolver type annotations

Merged Alex Kalderimis requested to merge ajk-rubocop-resolver-type into master
All threads resolved!

What does this MR do?

This MR adds a new Rubocop rule: Graphql/ResolverType.

This rule enforces that every resolver declares its type explicitly using a top level DSL method.

The reasons for this are:

  • Executable documentation: developers can see what a resolver returns
  • SSOT for field metadata. We currently are being wasteful in this regard, since fields that have resolver classes can inherit the resolver's field options. There is never a reason for a field to override the type, so we should encourage fields with resolvers to delegate to the resolver for all metadata. For this to work, the resolvers will need to have this metadata defined in all cases, so this cop is the first step.
  • Enable better testing of resolvers. To test resolvers properly we need to generate fields for them. To do this we need a type definition.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Luke Duncalfe

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Luke Duncalfe
  • Luke Duncalfe
  • Setting label ~"group::ecosystem" based on @alexkalderimis's group.

  • @alexkalderimis Thank you for this!

    Some suggestions for you to chew over!

  • unassigned @.luke

  • Alex Kalderimis resolved all threads

    resolved all threads

  • Thanks for the tips on writing cops - that helped a lot!

    Back to you, @.luke

    :cricket:

  • assigned to @.luke and unassigned @alexkalderimis

  • Alex Kalderimis added 39 commits

    added 39 commits

    • e558efb0...8b281570 - 38 commits from branch master
    • fdede89b - Add a rule to enforce resolver type annotations

    Compare with previous version

  • Luke Duncalfe
  • Setting label(s) devopscreate sectiondev based on ~"group::ecosystem".

  • Luke Duncalfe resolved all threads

    resolved all threads

  • Luke Duncalfe changed title from Add a rule to enforce resolver type annotations to hAdd a rule to enforce resolver type annotations

    changed title from Add a rule to enforce resolver type annotations to hAdd a rule to enforce resolver type annotations

  • Luke Duncalfe changed milestone to %13.6

    changed milestone to %13.6

  • Luke Duncalfe added 1 commit

    added 1 commit

    • 88811216 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Luke Duncalfe approved this merge request

    approved this merge request

  • Luke Duncalfe enabled an automatic merge when the pipeline for b77bc1d8 succeeds

    enabled an automatic merge when the pipeline for b77bc1d8 succeeds

  • Thanks, @alexkalderimis! Looks great!

    This will merge when the pipeline succeeds :rocket: (I applied !47375 (comment 445940477) and set to squash commits).

  • Luke Duncalfe changed title from hAdd a rule to enforce resolver type annotations to Add a rule to enforce resolver type annotations

    changed title from hAdd a rule to enforce resolver type annotations to Add a rule to enforce resolver type annotations

  • merged

  • Luke Duncalfe mentioned in commit df48e12c

    mentioned in commit df48e12c

  • mentioned in issue #281697 (closed)

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • 🤖 GitLab Bot 🤖 added 1 deleted label and removed devopscreate label

    added 1 deleted label and removed devopscreate label

  • added typemaintenance label and removed tooling (archive) label

  • 🤖 GitLab Bot 🤖 added devopsmanage label and removed 1 deleted label

    added devopsmanage label and removed 1 deleted label

  • 🤖 GitLab Bot 🤖 resolved all threads

    resolved all threads

  • Doug Stull mentioned in merge request !147148 (merged)

    mentioned in merge request !147148 (merged)

  • Please register or sign in to reply
    Loading