Skip to content

Upload scalar support for the schema wrapping #2795

Closed
@mikeconley12

Description

@mikeconley12

Is your feature request related to a problem? Please describe.

I'm using @graphql-tools/[email protected] package with [email protected]. And I have code similar to this:

const wrappedSchema = wrapSchema({
  schema,
  transforms: [
    new RenameTypes(name => {
      // ...
    }),
  ],
})

The schema has the Upload scalar from the graphql-upload package. When I run my code I have the following error: Error: ‘Upload’ scalar serialization unsupported.. The serialize method is called by the wrapSchema function.

Please see the links:

  1. return transformInputValue(type, value, (t, v) => t.serialize(v));

  2. const serializedValue = serializeInputValue(varType, variableValues[varName]);

Describe the solution you'd like

Is it possible to avoid calling the serialize method when using the wrapSchema function? Or is there another solution?

Describe alternatives you've considered

I defined my own version of the Upload scalar:

const GraphQLUpload = new GraphQLScalarType({
  name: 'Upload',
  description: 'The `Upload` scalar type represents a file upload.',
  parseValue: (value: any) => value,
  parseLiteral () {
    throw new Error('‘Upload’ scalar literal unsupported.')
  },
  serialize (value) {
    return value
  },
})

This solved the error, but it doesn't seem safe

Additional context

My Node.js version is v14.16.0 and I'm using Ubuntu 20.04

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