Skip to content

Commit

Permalink
Fixed a validation issue with type-graphql@2.0.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aminlatifi committed Jan 31, 2023
1 parent 411b69f commit c14be31
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/createSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Container } from 'typedi';
import { userCheck } from '../auth/userCheck';
import { GraphQLSchema } from 'graphql';
import { NonEmptyArray } from 'type-graphql';
import config from '../config';

const createSchema = async (): Promise<GraphQLSchema> => {
// James: removing for safety. We shouldn't need to do this again except on a local dev machine
Expand All @@ -14,11 +15,16 @@ const createSchema = async (): Promise<GraphQLSchema> => {
// const { defaultUser } = await seedDatabase()
// }

const environment = config.get('ENVIRONMENT') as string;
// build TypeGraphQL executable schema
const schema = await TypeGraphQL.buildSchema({
resolvers: getResolvers() as NonEmptyArray<Function>,
container: Container,
authChecker: userCheck,
validate: {
forbidUnknownValues: false,
enableDebugMessages: environment !== 'production',
},
});
return schema;
};
Expand Down

0 comments on commit c14be31

Please sign in to comment.