Add errors to SecurityPolicyProjectCreated subscription

What does this MR do and why?

This deprecates the error_messages field and adds a new errors field to be consistent with GraphQL mutations. errors will return an array of strings containing all error messages.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Create a new group or project and note the full path.
  2. Subscribe to the subscription, you can use graphql-susbcription-client for this.:
    subscription {
        securityPolicyProjectCreated(fullPath: "full-path-to-your-group-or-project") {
            project {
                name
            },
            status,
            errorMessage,
            errors
        }
    }
  3. call the securityPolicyProjectCreateAsync mutation:
    mutation SecurityPolicyProjectCreateAsync {
        securityPolicyProjectCreateAsync(input: { fullPath: "full-path-to-your-group-or-project"} ) {
            errors
        }
    }
    # cURL command
    curl --location 'http://localhost:3000/api/graphql' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer YOUR_API_TOKEN' \
    --data '{"query":"mutation {\n  securityPolicyProjectCreateAsync(input: {\n      fullPath: \"full-path-to-your-group-or-project\"\n    }) {\n    errors\n  }\n}","variables":{}}'
  4. After a few seconds the subscription should be triggered sending the project name:
    {"result":{"data":{"securityPolicyProjectCreated":{"name":"verify-issue-464329 - Security policy project"}}},"more":true}

Related to #495518 (closed)

Merge request reports

Loading