medkhabt/lol_notes

POST deaths requires too many parameters

Closed this issue · 4 comments

The model to POST a new DEATH is as follows:

{
  "game": {
    "champion": "KAISA",
    "createdOn": "2021-06-13T18:44:31.796Z",
    "id": 0,
    "predicate": {},
    "role": "ADC"
  },
  "id": 0,
  "minute": 10,
  "reason": {
    "description": "",
    "id": 104,
    "predicate": {}
  }
}

When it should only require game and reason ID.

Alternatively, using the model above with all the required data returns this error:

"message": "could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",
  "path": "/deaths"

You didn't specify the game id, and when creating a Death instance using that model, you don't need to specify all the fields for related game and reason.
For exemple you can do this instead:

{ "game": { "id": 1 }, "minute": 10, "reason": { "id": 104 } }

Using your request still returns an internal server error

"message": "could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement",
  "path": "/deaths"

Hi, I tried to generate the same problem but couldn't.

Screen Shot 2021-06-14 at 13 31 32

Screen Shot 2021-06-14 at 13 31 49

The issue has been discussed privately, and we concluded that it isn't an issue.