NZ Scotty
NZ Scotty

Reputation: 125

GraphQL returning data result + much more

I have a Dotnetcore 3.0 project (Project1) calling another Dotnetcore 3.0 project (Project2) at Graphql endpoints using graphql-dotnet library

Project2 is working fine and as expected and only returning a "data" object when being hit from either GraphiQL or postman. But when get the value from Project1 calling Project2 for the data I get an object response like this

    {
  "data": {
    "member": {
      "forename": "IT",
      "email": "[email protected]                                                                                                                                                                                                                                             ",
      "name": "Test"
    }
  },
  "errors": null,
  "query": "query{\n  member(memberNo: \"MYMEMBERNUMBER\"){\n    forename\n    email\n    name\n  }\n}\n",
  "document": {
    "originalQuery": "query{\n  member(memberNo: \"MYMEMBERNUMBER\"){\n    forename\n    email\n    name\n  }\n}\n",
    "children": [
      {
        "children": [
          {
            "children": [
              {
                "children": [
                  {
                    "children": [
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": 26,
                              "end": 39,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 16,
                          "end": 25,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": null
                  },
                  {
                    "children": [],
                    "sourceLocation": null
                  },
                  {
                    "children": [
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 45,
                          "end": 63,
                          "line": 0,
                          "column": 0
                        }
                      },
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 58,
                          "end": 72,
                          "line": 0,
                          "column": 0
                        }
                      },
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 68,
                          "end": 76,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 39,
                      "end": 78,
                      "line": 0,
                      "column": 0
                    }
                  }
                ],
                "sourceLocation": {
                  "start": 9,
                  "end": 78,
                  "line": 0,
                  "column": 0
                }
              }
            ],
            "sourceLocation": {
              "start": 5,
              "end": 79,
              "line": 0,
              "column": 0
            }
          }
        ],
        "sourceLocation": {
          "start": 0,
          "end": 79,
          "line": 0,
          "column": 0
        }
      }
    ],
    "operations": [
      {
        "name": null,
        "nameNode": null,
        "operationType": 0,
        "directives": [],
        "variables": [],
        "selectionSet": {
          "selections": [
            {}
          ],
          "children": [
            {
              "children": [
                {
                  "children": [
                    {
                      "children": [
                        {
                          "children": [],
                          "sourceLocation": {
                            "start": 26,
                            "end": 39,
                            "line": 0,
                            "column": 0
                          }
                        }
                      ],
                      "sourceLocation": {
                        "start": 16,
                        "end": 25,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": null
                },
                {
                  "children": [],
                  "sourceLocation": null
                },
                {
                  "children": [
                    {
                      "children": [
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": {
                            "start": -1,
                            "end": -1,
                            "line": 0,
                            "column": 0
                          }
                        }
                      ],
                      "sourceLocation": {
                        "start": 45,
                        "end": 63,
                        "line": 0,
                        "column": 0
                      }
                    },
                    {
                      "children": [
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": {
                            "start": -1,
                            "end": -1,
                            "line": 0,
                            "column": 0
                          }
                        }
                      ],
                      "sourceLocation": {
                        "start": 58,
                        "end": 72,
                        "line": 0,
                        "column": 0
                      }
                    },
                    {
                      "children": [
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": null
                        },
                        {
                          "children": [],
                          "sourceLocation": {
                            "start": -1,
                            "end": -1,
                            "line": 0,
                            "column": 0
                          }
                        }
                      ],
                      "sourceLocation": {
                        "start": 68,
                        "end": 76,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": {
                    "start": 39,
                    "end": 78,
                    "line": 0,
                    "column": 0
                  }
                }
              ],
              "sourceLocation": {
                "start": 9,
                "end": 78,
                "line": 0,
                "column": 0
              }
            }
          ],
          "sourceLocation": {
            "start": 5,
            "end": 79,
            "line": 0,
            "column": 0
          }
        },
        "children": [
          {
            "children": [
              {
                "children": [
                  {
                    "children": [
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": 26,
                              "end": 39,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 16,
                          "end": 25,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": null
                  },
                  {
                    "children": [],
                    "sourceLocation": null
                  },
                  {
                    "children": [
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 45,
                          "end": 63,
                          "line": 0,
                          "column": 0
                        }
                      },
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 58,
                          "end": 72,
                          "line": 0,
                          "column": 0
                        }
                      },
                      {
                        "children": [
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": null
                          },
                          {
                            "children": [],
                            "sourceLocation": {
                              "start": -1,
                              "end": -1,
                              "line": 0,
                              "column": 0
                            }
                          }
                        ],
                        "sourceLocation": {
                          "start": 68,
                          "end": 76,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 39,
                      "end": 78,
                      "line": 0,
                      "column": 0
                    }
                  }
                ],
                "sourceLocation": {
                  "start": 9,
                  "end": 78,
                  "line": 0,
                  "column": 0
                }
              }
            ],
            "sourceLocation": {
              "start": 5,
              "end": 79,
              "line": 0,
              "column": 0
            }
          }
        ],
        "sourceLocation": {
          "start": 0,
          "end": 79,
          "line": 0,
          "column": 0
        }
      }
    ],
    "fragments": [],
    "sourceLocation": null
  },
  "operation": {
    "name": null,
    "nameNode": null,
    "operationType": 0,
    "directives": [],
    "variables": [],
    "selectionSet": {
      "selections": [
        {}
      ],
      "children": [
        {
          "children": [
            {
              "children": [
                {
                  "children": [
                    {
                      "children": [],
                      "sourceLocation": {
                        "start": 26,
                        "end": 39,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": {
                    "start": 16,
                    "end": 25,
                    "line": 0,
                    "column": 0
                  }
                }
              ],
              "sourceLocation": null
            },
            {
              "children": [],
              "sourceLocation": null
            },
            {
              "children": [
                {
                  "children": [
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": {
                        "start": -1,
                        "end": -1,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": {
                    "start": 45,
                    "end": 63,
                    "line": 0,
                    "column": 0
                  }
                },
                {
                  "children": [
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": {
                        "start": -1,
                        "end": -1,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": {
                    "start": 58,
                    "end": 72,
                    "line": 0,
                    "column": 0
                  }
                },
                {
                  "children": [
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": null
                    },
                    {
                      "children": [],
                      "sourceLocation": {
                        "start": -1,
                        "end": -1,
                        "line": 0,
                        "column": 0
                      }
                    }
                  ],
                  "sourceLocation": {
                    "start": 68,
                    "end": 76,
                    "line": 0,
                    "column": 0
                  }
                }
              ],
              "sourceLocation": {
                "start": 39,
                "end": 78,
                "line": 0,
                "column": 0
              }
            }
          ],
          "sourceLocation": {
            "start": 9,
            "end": 78,
            "line": 0,
            "column": 0
          }
        }
      ],
      "sourceLocation": {
        "start": 5,
        "end": 79,
        "line": 0,
        "column": 0
      }
    },
    "children": [
      {
        "children": [
          {
            "children": [
              {
                "children": [
                  {
                    "children": [
                      {
                        "children": [],
                        "sourceLocation": {
                          "start": 26,
                          "end": 39,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 16,
                      "end": 25,
                      "line": 0,
                      "column": 0
                    }
                  }
                ],
                "sourceLocation": null
              },
              {
                "children": [],
                "sourceLocation": null
              },
              {
                "children": [
                  {
                    "children": [
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": {
                          "start": -1,
                          "end": -1,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 45,
                      "end": 63,
                      "line": 0,
                      "column": 0
                    }
                  },
                  {
                    "children": [
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": {
                          "start": -1,
                          "end": -1,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 58,
                      "end": 72,
                      "line": 0,
                      "column": 0
                    }
                  },
                  {
                    "children": [
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": null
                      },
                      {
                        "children": [],
                        "sourceLocation": {
                          "start": -1,
                          "end": -1,
                          "line": 0,
                          "column": 0
                        }
                      }
                    ],
                    "sourceLocation": {
                      "start": 68,
                      "end": 76,
                      "line": 0,
                      "column": 0
                    }
                  }
                ],
                "sourceLocation": {
                  "start": 39,
                  "end": 78,
                  "line": 0,
                  "column": 0
                }
              }
            ],
            "sourceLocation": {
              "start": 9,
              "end": 78,
              "line": 0,
              "column": 0
            }
          }
        ],
        "sourceLocation": {
          "start": 5,
          "end": 79,
          "line": 0,
          "column": 0
        }
      }
    ],
    "sourceLocation": {
      "start": 0,
      "end": 79,
      "line": 0,
      "column": 0
    }
  },
  "perf": [
    {
      "category": "operation",
      "subject": null,
      "metadata": null,
      "start": 0,
      "end": 24.5424,
      "duration": 24.5424
    },
    {
      "category": "document",
      "subject": "Building document",
      "metadata": null,
      "start": 0.016900000000000002,
      "end": 0.2521,
      "duration": 0.2352
    },
    {
      "category": "document",
      "subject": "Validating document",
      "metadata": null,
      "start": 0.2647,
      "end": 0.7371000000000001,
      "duration": 0.4724000000000001
    },
    {
      "category": "execution",
      "subject": "Executing operation",
      "metadata": null,
      "start": 0.7574000000000001,
      "end": 24.5392,
      "duration": 23.7818
    }
  ],
  "exposeExceptions": false,
  "extensions": null
}

The service that is getting data from Project2 is mapping the data and returning the object successfully. so I don't understand why Im getting all this extra data when there is a result success??

Upvotes: 2

Views: 264

Answers (1)

NZ Scotty
NZ Scotty

Reputation: 125

Thanks to Xadam for the response. Read the docs!

Fixed by setting this on the controller

var executionOptions = new ExecutionOptions
            {
                Schema = _schema,
                Query = query.Query,
                Inputs = inputs,
                EnableMetrics = false
            };

Upvotes: 3

Related Questions