Expose approval rules in MergeRequest GraphQL object
Why are we doing this work
There's been a customer question about using the GraphQL API to see MR vulnerability-check approvals. This is currently only possible in the REST API.
On top of being a customer request, it's also part of the GraphQL Vision:
anything possible in the REST API should also be possible in the GraphQL API.
Relevant links
- REST Get the approval state of merge requests
- GraphQL MergeRequest
Non-functional requirements
-
Documentation: as required by GraphQL implementation -
Feature flag: N/A -
Performance: TBC -
Testing: specs
Implementation plan
-
backend Introduce a new field for the MergeRequestGraphQL type calledapproval_stateand its type with the following fields;-
approval_rules_overwrittenBoolean not null -
ruleswith the type of a collection ofApprovalRule(not null). This is a new type with the following fields;-
idID not null -
nameString not null -
rule_typeEnum defined inApprovalProjectRulemodel not null -
approvals_requiredInteger not null -
approvedBoolean not null -
overriddenBoolean not null -
contains_hidden_groupsBoolean not null -
source_ruletype of anApprovalRulecan be null -
eligible_approverslist of Users -
userslist of Users -
approved_bylist of Users -
groupslist of Groups
-
-
Note: We can check the existing entity and presenter classes to figure out how these fields are populated on REST API to implement similar logic or use existing ones on GraphQL API.
/cc @matt_wilson
Edited by Alan (Maciej) Paruszewski