diff --git a/packages/apollo-language-server/src/graphqlTypes.ts b/packages/apollo-language-server/src/graphqlTypes.ts index dea9dd152b..19c7fd9572 100644 --- a/packages/apollo-language-server/src/graphqlTypes.ts +++ b/packages/apollo-language-server/src/graphqlTypes.ts @@ -1722,6 +1722,7 @@ export interface IntrospectionDirectiveInput { description?: string | null; locations: IntrospectionDirectiveLocation[]; args: IntrospectionInputValueInput[]; + isRepeatable?: boolean | null; } /** @@ -1765,6 +1766,7 @@ export interface IntrospectionSchemaInput { mutationType?: IntrospectionTypeRefInput | null; subscriptionType?: IntrospectionTypeRefInput | null; directives: IntrospectionDirectiveInput[]; + description?: string | null; } /** diff --git a/packages/apollo/src/commands/client/codegen.ts b/packages/apollo/src/commands/client/codegen.ts index 221575fb90..bd7a4350a2 100644 --- a/packages/apollo/src/commands/client/codegen.ts +++ b/packages/apollo/src/commands/client/codegen.ts @@ -187,6 +187,19 @@ export default class Generate extends ClientCommand { // are valid documents project.validate(); + // to prevent silent erroring of syntax errors, we check the project's + // documents to make sure there are no errors. If there are, we error here + // instead of project initialization + for (const document of this.project.documents) { + if (document.syntaxErrors.length) { + const errors = document.syntaxErrors.map( + e => + `Syntax error in ${document.source.name}: ${e.message}\n` + ); + throw new Error(errors.toString()); + } + } + const operations = Object.values(this.project.operations); const fragments = Object.values(this.project.fragments);