Bug 36505: (follow-up) Consistent error codes in POST

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomas Cohen Arazi 2024-04-09 08:56:00 +02:00 committed by Katrin Fischer
parent 466882a6a2
commit 61816873bb
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 11 additions and 5 deletions

View File

@ -212,7 +212,7 @@ sub add {
{
return $c->render(
status => 400,
openapi => { error => "$_" }
openapi => { error => "$_", error_code => 'missing_mandatory_attribute' }
);
}
elsif (
@ -221,7 +221,7 @@ sub add {
{
return $c->render(
status => 400,
openapi => { error => "$_" }
openapi => { error => "$_", error_code => 'invalid_attribute_type' }
);
}
elsif (
@ -230,7 +230,7 @@ sub add {
{
return $c->render(
status => 400,
openapi => { error => "$_" }
openapi => { error => "$_", error_code => 'non_repeatable_attribute' }
);
}
elsif (
@ -239,7 +239,7 @@ sub add {
{
return $c->render(
status => 400,
openapi => { error => "$_" }
openapi => { error => "$_", error_code => 'attribute_not_unique' }
);
}
}

View File

@ -434,7 +434,13 @@
items:
$ref: "../swagger.yaml#/definitions/patron"
"400":
description: Bad parameter
description: |
Bad parameter. Possible `error_code` attribute values:
* `invalid_attribute_type`
* `attribute_not_unique`
* `non_repeatable_attribute`
* `missing_mandatory_attribute`
schema:
$ref: "../swagger.yaml#/definitions/error"
"401":