ZenSoftware / zen

⛩ Nest + Prisma + Apollo + Angular 🏮 Full Stack GraphQL Starter Kit ⛩
185 stars 32 forks source link

Validation errors in graphql/paljs/typedefs #25

Closed johnkm516 closed 2 years ago

johnkm516 commented 2 years ago

I think in templates/type-defs.ts the code :

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.

ZenSoftware commented 2 years ago

Oh geeze, I'm surprised I left that in there. It has been fixed with https://github.com/ZenSoftware/zen/commit/5bc8b63eff6a0e6c9f6afca1d8dcd135753b7da6

Thanks John!