Update all DAST on-demand scan GraphQL endpoints to return the payload

Problem to solve

Currently, most GraphQL mutations respond with the payload but the DAST on-demand scan mutations all return the ID. The purpose of this issue is to bring the DAST on-demand scan mutations inline with the others.

The following discussion from !40208 (merged) should be addressed:

  • @dbalexandre started a discussion: (+1 comment)

    I noticed that the other mutations return the resource along with the errors instead in case o success/error. Something like this:

    diff --git a/ee/app/graphql/mutations/dast_scanner_profiles/update.rb b/ee/app/graphql/mutations/dast_scanner_profiles/update.rb
    index 0e8e85024db..ecb740330d7 100644
    --- a/ee/app/graphql/mutations/dast_scanner_profiles/update.rb
    +++ b/ee/app/graphql/mutations/dast_scanner_profiles/update.rb
    @@ -39,11 +39,7 @@ module Mutations
             service = ::DastScannerProfiles::UpdateService.new(project, current_user)
             result = service.execute(service_args)
     
    -        if result.success?
    -          { id: result.payload.to_global_id, errors: [] }
    -        else
    -          { errors: result.errors }
    -        end
    +        { dast_scanner_profile: result[:payload], errors: result.errors || [] }
           end
     
           private

    What do you think about this approach?

/cc @philipcunningham

Affected Mutations

  • DAST Site Profile mutations
    • dastSiteProfileCreate
    • dastSiteProfileUpdate
  • DAST Scanner Profile mutations
    • dastScannerProfileCreate
    • dastScannerProfileUpdate
Edited by Dheeraj Joshi