euniversal / umei-api-specification

UMEI API specifications
Apache License 2.0
3 stars 0 forks source link

Add new error codes #84

Closed cdmNSIDE closed 2 years ago

cdmNSIDE commented 2 years ago

Hello @narve

I have added several new error codes. They will be used when the user tries to post, put or patch a resource that is not valid. Those new errors will be used in the "type" field of the "ProblemDetails" object of a "ValidationError".

Let's imagine that the user wants to create an order that contains two errors: "NonZeroFirstQuantity" and "InconsistentPeriods". In that case, we will return an "InvalidOrder" which is a bit more generic and we will describe both mistakes in the "validation-errors" list of the "ValidationError".

By the way, in our case we will not return a "NonZeroFirstQuantity" even if it's the only error found in the order (we will return an "InvalidOrder"). But it doesn't hurt keeping it in the UMEI