`GraphQLFactory.mergeTypesByPaths` not working with multiple patterns
Following code
const typeDefs = this.graphQLFactory.mergeTypesByPaths(
`src/@core/**/*.graphqls`,
`src/${process.env.APP_NAME}/**/*.graphqls`
);
will only generate type definitions for first pattern: src/@core/**/*.graphqls, all next patterns not merged.
Manual merging fixes this issue:
import { fileLoader, mergeTypes } from 'merge-graphql-schemas';
const coreTypes = fileLoader(`src/@core/**/*.graphqls`);
const appTypes = fileLoader(`src/${process.env.APP_NAME}/**/*.graphqls`);
const types = coreTypes.concat(appTypes);
const typeDefs = mergeTypes(types);
@ph55 I found the same issue. Having a look at the source code https://github.com/nestjs/graphql/blob/master/lib/graphql.factory.ts#L43 seems to be the cause of the problem: a pattern potentially matches many files, which are then read and returned as an array of strings. A simple solution is just to deep flatten the argument to mergeTypes instead of simply spreading it. I hope this is an easy fix for you, @kamilmysliwiec 😄
Fixed in 5.1.0
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.