Skip to content

Make name in ScanExecutionPolicyCommit mutation mandatory

What does this MR do and why?

We added name field in ScanExecutionPolicyCommit graphql mutation as a non-mandatory field to make it backward compatible with frontend. However now that #342695 (closed) is finished, we need to make it required.

Corresponding issue: #343009 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Screenshot_2023-04-24_at_6.23.58_PM

How to set up and validate locally

  1. Go to /-/graphql-explorer
  2. Type a query like:
mutation updatePolicy($input: ScanExecutionPolicyCommitInput!) {
  scanExecutionPolicyCommit(input: $input) {
    branch
    errors
  }
}

with an input like

{
  "input": {
    "fullPath": "testscanresultpolicies/license-approval-policies-test",
    "operationMode": "REPLACE",
    "policyYaml": ""
  }
}
  1. Check the result
{
  "errors": [
    {
      "message": "Variable $input of type ScanExecutionPolicyCommitInput! was provided invalid value for name (Expected value to not be null)",
      "locations": [
        {
          "line": 1,
          "column": 23
        }
      ],
      "extensions": {
        "value": {
          "fullPath": "testscanresultpolicies/license-approval-policies-test",
          "operationMode": "REPLACE",
          "policyYaml": ""
        },
        "problems": [
          {
            "path": [
              "name"
            ],
            "explanation": "Expected value to not be null"
          }
        ]
      }
    }
  ]
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Marcos Rocha

Merge request reports

Loading