export function TypeDefsTemplate(names: string[]) {
let accum = `import { mergeTypeDefs } from '@graphql-tools/merge';
import SDLInputs from './sdl-inputs';
import User from './User/typeDefs';
export default mergeTypeDefs([
SDLInputs,`;
for (const name of names) {
accum += ` ${name},\n`;
}
accum += `]);
`;
return accum;
}
should be
export function TypeDefsTemplate(names: string[]) {
let accum = `import { mergeTypeDefs } from '@graphql-tools/merge';
import SDLInputs from './sdl-inputs';\n`
for(const name of names) {
accum+= `import ${name} from './${name}/typeDefs';\n`
}
accum +=`export default mergeTypeDefs([
SDLInputs,`;
console.log(names);
for (const name of names) {
accum += ` ${name},\n`;
}
accum += `]);
`;
return accum;
}
as there are compile errors from not importing generated models other than the hard-coded User when starting the api after generating multiple schema models.
I think in templates/type-defs.ts the code :
should be
as there are compile errors from not importing generated models other than the hard-coded
User
when starting the api after generating multiple schema models.