Skip to content

Added field `id` for the graphql Packages::Protection::RuleType

What does this MR do and why?

  • New field id for the graphql type Packages::Protection::RuleType
  • This new field id allows to retrieve the id of the ressource Packages::Protection::Rule that can be used in other graqhql mutations

🛠 with at Siemens

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 mutation createPackagesProtectionRule
mutation {
	createPackagesProtectionRule(
		input: {
			projectPath: "flightjs/Flight"
			packageNamePattern: "@flight/flight-1-3-*"
			packageType: NPM
			pushProtectedUpToAccessLevel: MAINTAINER
		}
	) {
		packageProtectionRule {
			id
		}
		errors
	}
}

image

How to set up and validate locally

  1. Enable feature flag via rails c
Feature.enable(:packages_protected_packages)
  1. 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.

Related to #416381 (closed)

Edited by Gerardo Navarro

Merge request reports