Skip to content

Naming Convention Transform Breaks Union Type Query #1592

Open
@ddcollins

Description

@ddcollins

Adding the naming convention transform:

transforms:
  # Global
  - namingConvention:
      typeNames: pascalCase
      enumValues: upperCase
      fieldNames: camelCase

Results in the following error:

"originalError": {
    "name": "TypeError",
    "message": "Cannot read property 'getFields' of undefined",
    "stack": [
        "TypeError: Cannot read property 'getFields' of undefined",
        "    at visitObjectValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4078:27)",
        "    at visitFieldValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4148:16)",
        "    at /app/node_modules/@graphql-tools/utils/index.cjs.js:4102:26",
        "    at Array.forEach (<anonymous>)",
        "    at visitObjectValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4089:31)",
        "    at visitFieldValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4152:16)",
        "    at /app/node_modules/@graphql-tools/utils/index.cjs.js:4135:35",
        "    at Array.map (<anonymous>)",
        "    at visitListValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4135:17)",
        "    at visitFieldValue (/app/node_modules/@graphql-tools/utils/index.cjs.js:4143:16)"
    ]
},

When trying to run the following query:

{
    items {
        course(limit:10) {
            id
            title
            description
            lessons {
                title
                subTitle
                canPreview
                description
                steps {
                    stepTitle
                    canPreview
                    item {
                        ... on LessonSlide {
                            content
                            status
                            imageUrl
                        }
                        ... on LessonVideo {
                            videoUrl
                        }
                    }
                }
            }
        }
    }

}

This query works fine when the naming convention transform is removed.
The query also works fine if I remove:

item {
    ... on LessonSlide {
        content
        status
        imageUrl
    }
    ... on LessonVideo {
        videoUrl
    }
}

The query is through my graphql handler.

Dependencies:

"@graphql-mesh/cli": "^0.15.*",
    "@graphql-mesh/graphql": "^0.13.*",
    "@graphql-mesh/json-schema": "^0.10.*",
    "@graphql-mesh/transform-encapsulate": "^0.1.20",
    "@graphql-mesh/transform-naming-convention": "^0.6.23",
    "@graphql-mesh/transform-resolvers-composition": "^0.7.*",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions