Project

General

Profile

Bug #32177

Result key for saved object should not be camel case

Added by Ondřej Pražák 3 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:
1) Have a mutation with a result field that has underscore in a field name

module Mutations
  module MyModel
    class Create < CreateMutation 
      # description, graphql_name, resource_class, argument methods omited
      # make sure result field has more than 1 word, reproducible with :my_model, not reproducible with :mymodel
      field :my_model, Types::MyModel, 'The newly created MyModel', null: true
    end
  end
end

2) Execute mutation, query for the new record attributes in response

mutation MyModel($name: String!) {
  myModel(input: {name: $name}) {
    myModel {
      name
    }
    errors {
      path
      message
    }
  }
}

3) Response will show null even though the record was created

{
  "data": {
    "createMyModel": {
      "myModel": null
      "errors": []
    }
  }
}

Associated revisions

Revision 3d90a2ca (diff)
Added by Ondřej Pražák 3 months ago

Fixes #32177 - Return result key as snake case symbol

GraphQL mutations' `result_key` method was returning camel cased symbols, causing the results returned to be incorrect as the query expected them to be snake cased.

History

#1 Updated by The Foreman Bot 3 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8410 added

#2 Updated by The Foreman Bot 3 months ago

  • Fixed in Releases 2.5.0 added

#3 Updated by Tomer Brisker 3 months ago

  • Category set to API
  • Fixed in Releases deleted (2.5.0)

#4 Updated by Ondřej Pražák 3 months ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Tomer Brisker about 2 months ago

  • Fixed in Releases 2.5.0 added

Also available in: Atom PDF