Added field `id` for the graphql Packages::Protection::RuleType
requested to merge gitlab-community/gitlab:416381-protected-packages-graphql-mutation-create-package-protection-rule-follow-up-add-field-if-to-graphql-schema-types-packages-protection-ruletype into master
What does this MR do and why?
- New field
id
for the graphql typePackages::Protection::RuleType
- This new field
id
allows to retrieve the id of the ressourcePackages::Protection::Rule
that can be used in other graqhql mutations
Screenshots or screen recordings
- No frontend -related change; this MR includes more backend and documentation -related changes
- The following screenshot shows that we are a now able to retrieve the field
id
in the response for the graphql mutationcreatePackagesProtectionRule
mutation {
createPackagesProtectionRule(
input: {
projectPath: "flightjs/Flight"
packageNamePattern: "@flight/flight-1-3-*"
packageType: NPM
pushProtectedUpToAccessLevel: MAINTAINER
}
) {
packageProtectionRule {
id
}
errors
}
}
How to set up and validate locally
- Enable feature flag via
rails c
Feature.enable(:packages_protected_packages)
- Now, you should be able to send mutation requests with the query declaration
packageProtectionRule
containing the field id
curl --request POST \
--url http://gdk.test:3000/api/graphql \
--header 'Authorization: Bearer ypCa3Dzb23o5nvsixwPA' \
--header 'Content-Type: application/json' \
--cookie 'perf_bar_enabled=true; BetterErrors-2.10.1-CSRF-Token=0b882179-5e4a-431b-a420-2be3701cece8' \
--data '{"query":"mutation {\n\tcreatePackagesProtectionRule(\n\t\tinput: {\n\t\t\tprojectPath: \"flightjs/Flight\"\n\t\t\tpackageNamePattern: \"@flight/flight-1-3-*\"\n\t\t\tpackageType: NPM\n\t\t\tpushProtectedUpToAccessLevel: MAINTAINER\n\t\t}\n\t) {\n\t\tpackageProtectionRule {\n\t\t\tid\n\t\t\tpackageNamePattern\n\t\t\tpackageType\n\t\t\tpushProtectedUpToAccessLevel\n\t\t}\n\t\terrors\n\t}\n}\n"}'
Todos
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR. -
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides -
Wait for MR Query declaration error for graphql createPacka... (!134244 - merged)
-
Related to #416381 (closed)
Edited by Gerardo Navarro