GraphQL .NET - 结果中的扩展

GraphQL .NET - extensions in results

我开始使用 GraphQL for .NET Core 3.1 (https://github.com/graphql-dotnet/graphql-dotnet)。我根据我在网上看到的内容构建了一个简单的示例(目前还没有很多关于它的信息)。

当我进行查询时,我得到如下结果:

{
  "data": {
    "orders": [
      {
        "id": "e9c4325e-4d4c-42f6-963e-be1ad71a5b36",
        "created": "2020-07-18"
      },
      {
        "id": "12926137-cf6f-4b53-8848-443659e50823",
        "created": "2020-07-18"
      },
      {
        "id": "3c0d782d-15b1-474d-8ca9-01e33dad8e00",
        "created": "2020-07-19"
      },
      {
        "id": "befbcd57-7814-4134-9f17-fb45672e44c0",
        "created": "2020-07-19"
      }
    ]
  },
  "extensions": {
    "tracing": {
      "Version": 1,
      "StartTime": "2020-07-18T19:45:15.5554022Z",
      "EndTime": "2020-07-18T19:45:15.6044022Z",
      "Duration": 49108500,
      "Parsing": {
        "StartOffset": 16700,
        "Duration": 1102700
      },
      "Validation": {
        "StartOffset": 1131500,
        "Duration": 421899
      },
      "Execution": {
        "Resolvers": [
          {
            "Path": [
              "orders"
            ],
            "ParentType": "Query",
            "FieldName": "orders",
            "ReturnType": "[OrderType]",
            "StartOffset": 1756600,
            "Duration": 45168300
          },
          {
            "Path": [
              "orders",
              0,
              "id"
            ],
            "ParentType": "OrderType",
            "FieldName": "id",
            "ReturnType": "String!",
            "StartOffset": 46995100,
            "Duration": 79099
          },
          {
            "Path": [
              "orders",
              0,
              "created"
            ],
            "ParentType": "OrderType",
            "FieldName": "created",
            "ReturnType": "Date!",
            "StartOffset": 47081299,
            "Duration": 219500
          },
          {
            "Path": [
              "orders",
              1,
              "id"
            ],
            "ParentType": "OrderType",
            "FieldName": "id",
            "ReturnType": "String!",
            "StartOffset": 47313299,
            "Duration": 6199
          },
          {
            "Path": [
              "orders",
              1,
              "created"
            ],
            "ParentType": "OrderType",
            "FieldName": "created",
            "ReturnType": "Date!",
            "StartOffset": 47322400,
            "Duration": 4599
          },
          {
            "Path": [
              "orders",
              2,
              "id"
            ],
            "ParentType": "OrderType",
            "FieldName": "id",
            "ReturnType": "String!",
            "StartOffset": 47329300,
            "Duration": 599
          },
          {
            "Path": [
              "orders",
              2,
              "created"
            ],
            "ParentType": "OrderType",
            "FieldName": "created",
            "ReturnType": "Date!",
            "StartOffset": 47331600,
            "Duration": 499
          },
          {
            "Path": [
              "orders",
              3,
              "id"
            ],
            "ParentType": "OrderType",
            "FieldName": "id",
            "ReturnType": "String!",
            "StartOffset": 47333799,
            "Duration": 400
          },
          {
            "Path": [
              "orders",
              3,
              "created"
            ],
            "ParentType": "OrderType",
            "FieldName": "created",
            "ReturnType": "Date!",
            "StartOffset": 47335900,
            "Duration": 399
          }
        ]
      }
    }
  }
}

这是我的查询:

query {
  orders {
    id,
    created
  }
}

为什么我在响应对象上得到 extensions?我没有在任何示例中看到它,它比 'data' 结果本身更大——这违背了 GraphQL 保存数据传输的目的之一。

配置服务时,检查是否将 options.EnableMetrics 设置为 false,如下所示:

        services.AddGraphQL(options =>
        {
            options.EnableMetrics = false;
            options.ExposeExceptions = true;
            
        }).AddSystemTextJson(deserializerSettings => { }, serializerSettings => { })
            .AddWebSockets()
            .AddDataLoader()
            .AddGraphTypes(typeof(ItemSchema));

那应该删除扩展数据。