nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.45k stars 391 forks source link

fix(graphql): ensure scalarsMap in buildSchemaOptions is respected #3219

Closed ssut closed 2 months ago

ssut commented 2 months ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

What is the current behavior?

The scalarsMap in buildSchemaOptions was not used even though it was defined.

This PR also fixes issues like #3204 by correctly merging the scalarsMap, ensuring that duplicate ScalarsTypeMap entries are ignored by their type. e.g.

buildSchemaOptions: {
  numberScalarMode: 'integer',
  scalarsMap: [
    {
      type: Date,
      scalar: GraphQLDateTime,
    },
  ],
}

What is the new behavior?

This PR ensures that the scalarsMap in buildSchemaOptions is respected and correctly merged with the scalarsMap from ScalarsExplorerService.

Does this PR introduce a breaking change?

Other information

kamilmysliwiec commented 2 months ago

lgtm

kamilmysliwiec commented 2 months ago

Sounds like this PR might have introduced a regression https://github.com/nestjs/graphql/issues/3244