可空的 order 字段中有一个非空 total,但它解析为 null。result.data 包含什么?

来自 GraphQL
Node 24 进阶 2分钟

可空的 order 字段中有一个非空 total,但它解析为 null。result.data 包含什么?

JavaScript
const { buildSchema, graphql } = require("graphql");
const schema = buildSchema(`
  type Order { id: ID!, total: Int! }
  type Query { service: String!, order: Order }
`);
const result = await graphql({
  schema,
  source: `{ service order { id total } }`,
  rootValue: { service: "shop", order: { id: "o1", total: null } },
});
console.log(JSON.stringify(result.data));
在试验场中打开
报告错误