Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding player with non-nullable data is allowed! #4

Open
omar84 opened this issue Apr 2, 2019 · 0 comments
Open

Adding player with non-nullable data is allowed! #4

omar84 opened this issue Apr 2, 2019 · 0 comments

Comments

@omar84
Copy link

omar84 commented Apr 2, 2019

adding a player with mutation:

mutation ($player: PlayerInput!){
  createPlayer(player: $player){
    id
    name
    birthDate
  }
}

and variables:

{
  "player":{
    "name":"test"
  }
}

creates the player, with no validation for any field.

then reading the player generates the following error:

{
  "data": {
    "player": {
      "name": "test",
      "birthDate": "0001-01-01",
      "birthPlace": null,
      "weightLbs": 0
    }
  },
  "errors": [
    {
      "message": "GraphQL.ExecutionError: Cannot return null for non-null type. Field: birthPlace, Type: String!.\r\n   at GraphQL.Execution.ExecutionStrategy.ValidateNodeResult(ExecutionContext context, ExecutionNode node)\r\n   at GraphQL.Execution.ExecutionStrategy.ExecuteNodeAsync(ExecutionContext context, ExecutionNode node)",
      "locations": [
        {
          "line": 5,
          "column": 5
        }
      ],
      "path": [
        "player",
        "birthPlace"
      ]
    }
  ]
}

can you add validation please so that bad data can not be saved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant