Skip to content

Creating an "empty" PartijIdentificator blocks any future PartijIdentificator creation #593

@stevenbal

Description

@stevenbal

Product versie / Product version

2.15.0

Omschrijf het probleem / Describe the bug

Ran into this while reviewing an unrelated PR locally:

Apparently it is possible to do a POST on /klantinteracties/api/v1/partij-identificatoren with an "empty" PartijIdentificator by either specifying an empty JSON body {} or no body at all even, and Open Klant will respond with a 201. After this however, any POST to this same endpoint any body will result in a 400 error:

{
  "type": "http://localhost:8000/ref/fouten/ValidationError/",
  "code": "invalid",
  "title": "Ongeldige invoerwaarde.",
  "status": 400,
  "detail": "Ongeldige invoerwaarde.",
  "instance": "urn:uuid:22a7b2c9-1ffd-4c47-8851-e1d0cc9e8264",
  "invalidParams": [
    {
      "name": "__all__",
      "code": "invalid",
      "reason": "`PartijIdentificator` moet uniek zijn, er bestaat er al een met deze gegevenscombinatie."
    }
  ]
}

And this is not resolved until the "empty" PartijIdentificator is deleted

Stappen om te reproduceren / Steps to reproduce

  1. Do a POST on /klantinteracties/api/v1/partij-identificatoren without a body
  2. Try to do a POST again but with a valid body
  3. Observe the 400 error

Verwacht gedrag / Expected behavior

In any case, having this empty PartijIdentificator should not block all subsequent PartijIdentificator from being created.

Additionally, I'm not sure what the use case is for an empty Partijidentificator, so perhaps we should disallow that from being created as well

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Bug.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions