Description
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure Mesh package versions under
package.json
matches yours.
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
Using the naming-convention
transform in "bare" mode, it doesn't correctly transform nested field argument Input
types. See below for a specific example. PR with a fix is incoming!
To Reproduce
Consider a base schema like:
type Mutation {
createUser(user: UserInput): User
}
type User {
id: ID
first_name: String
last_name: String
interests: [UserInterests!]!
custom_fields: [UserCustomField!]
}
type UserCustomField {
field_name: String!
value: String
}
input UserInput {
first_name: String
last_name: String
custom_fields: [UserCustomFieldInput!]
}
input UserCustomFieldInput {
field_name: String!
value: String
}
then using the naming-convention transform to transform field names to camelCase would yield the following schema:
type Mutation {
createUser(user: UserInput): User
}
type User {
id: ID
firstName: String
lastName: String
interests: [UserInterests!]!
customFields: [UserCustomField!]
}
type UserCustomField {
fieldName: String!
value: String
}
input UserInput {
firstName: String
lastName: String
customFields: [UserCustomFieldInput!]
}
input UserCustomFieldInput {
fieldName: String!
value: String
}
which is all as it should be. However if you try calling the mutation createUser
with the user
argument set to
{
firstName: 'James'
lastName: 'Sharp',
customFields: [{fieldName: 'test', value: 'value'}]
}
You'll find that fieldName
in the customFields
doesn't get transformed back to field_name
in onward resolvers, and so the data is essentially lost. The root level fields are transformed fine, but not any nested ones
Expected behavior
It should transform the nested inputs back correctly