|
1 | 1 | import { flags } from "@oclif/command"; |
2 | 2 | import { table } from "heroku-cli-util"; |
3 | | -import { introspectionFromSchema } from "graphql"; |
| 3 | +import { introspectionFromSchema, printSchema } from "graphql"; |
4 | 4 | import chalk from "chalk"; |
5 | | -import { gitInfo, GitContext } from "../../git"; |
| 5 | +import { gitInfo } from "../../git"; |
6 | 6 | import { ProjectCommand } from "../../Command"; |
7 | 7 | import { validateHistoricParams } from "../../utils"; |
8 | 8 | import { |
9 | 9 | CheckSchema_service_checkSchema, |
10 | 10 | CheckSchema_service_checkSchema_diffToPrevious_changes as Change, |
11 | | - ChangeSeverity |
| 11 | + ChangeSeverity, |
| 12 | + CheckSchemaVariables |
12 | 13 | } from "apollo-language-server/lib/graphqlTypes"; |
13 | 14 | import { ApolloConfig } from "apollo-language-server"; |
14 | 15 | import moment from "moment"; |
@@ -268,18 +269,26 @@ export default class ServiceCheck extends ProjectCommand { |
268 | 269 | }); |
269 | 270 |
|
270 | 271 | task.output = "Validating schema"; |
| 272 | + const variables: CheckSchemaVariables = { |
| 273 | + id: configName, |
| 274 | + // @ts-ignore |
| 275 | + // XXX Looks like TS should be generating ReadonlyArrays instead |
| 276 | + schema: introspectionFromSchema(schema).__schema, |
| 277 | + tag: flags.tag, |
| 278 | + gitContext: await gitInfo(this.log), |
| 279 | + frontend: flags.frontend || config.engine.frontend, |
| 280 | + ...(historicParameters && { historicParameters }) |
| 281 | + }; |
| 282 | + const { schema: _, ...restVariables } = variables; |
| 283 | + this.debug("Variables sent to Engine:"); |
| 284 | + this.debug(restVariables); |
| 285 | + this.debug("SDL of introspection sent to Engine:"); |
| 286 | + this.debug(printSchema(schema)); |
271 | 287 |
|
272 | 288 | const newContext: typeof ctx = { |
273 | | - checkSchemaResult: await project.engine.checkSchema({ |
274 | | - id: configName, |
275 | | - // @ts-ignore |
276 | | - // XXX Looks like TS should be generating ReadonlyArrays instead |
277 | | - schema: introspectionFromSchema(schema).__schema, |
278 | | - tag: flags.tag, |
279 | | - gitContext: await gitInfo(this.log), |
280 | | - frontend: flags.frontend || config.engine.frontend, |
281 | | - ...(historicParameters && { historicParameters }) |
282 | | - }), |
| 289 | + checkSchemaResult: await project.engine.checkSchema( |
| 290 | + variables |
| 291 | + ), |
283 | 292 | config, |
284 | 293 | shouldOutputJson: !!flags.json, |
285 | 294 | shouldOutputMarkdown: !!flags.markdown |
|
0 commit comments