Skip to content

#441 breaks the use with raw GraphQLScalarType from library such as graphql-upload-minimal #1166

@oosawy

Description

@oosawy

When updating nexus from 1.1.0 to latest, the following error occurs.
And I found out it can no longer use GraphQLScalarType since 1.2.0-next.14 introduced #983

Error: Schema must contain uniquely named types but contains multiple types named "Upload".
    at new GraphQLSchema (/home/projects/stackblitz-starters-gbnfra/node_modules/graphql/type/schema.js:194:15)
    at makeSchemaInternal (/home/projects/stackblitz-starters-gbnfra/node_modules/nexus/dist/builder.js:1153:20)
    at makeSchema (/home/projects/stackblitz-starters-gbnfra/node_modules/nexus/dist/makeSchema.js:16:84)

Reproduction:

https://stackblitz.com/edit/stackblitz-starters-gbnfra?file=package.json,index.js

Workaround:

cxport const FileUpload = scalarType({
  ...GraphQLUpload,
  asNexusMethod: "upload",
})


const Query = queryType({
  definition(t) {
    t.field('account', {
      type: Account,
      args: {
        avatar: arg({ type: FileUpload }),
      },
    })
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions