Bug Description
When sending an empty string ("") for the description field in the POST /transactions endpoint, Midaz returns an incorrect error code. The field is optional and should accept either a valid string value, null, or be omitted entirely from the request payload — but the error response when an empty string is provided uses a wrong/misleading error code.
Steps to Reproduce
- Send a
POST request to /v1/transactions (or /v1/transactions/json)
- Include
"description": "" (empty string) in the request body
- Observe the error response
Expected Behavior
- If
description is provided, it should be a non-empty string
- If not needed, the field should be sent as
null or omitted from the payload
- When an empty string is sent, the error code returned should accurately describe the validation failure (e.g., invalid value for optional field)
Actual Behavior
The error code returned for an empty string description is incorrect/misleading, making it harder for clients to understand and handle the error properly.
Additional Context
Reported by the operations team based on client feedback. The description field behavior itself is correct (rejects empty strings), but the mapped error code needs to be fixed to properly communicate the issue to API consumers.
Bug Description
When sending an empty string (
"") for thedescriptionfield in thePOST /transactionsendpoint, Midaz returns an incorrect error code. The field is optional and should accept either a valid string value,null, or be omitted entirely from the request payload — but the error response when an empty string is provided uses a wrong/misleading error code.Steps to Reproduce
POSTrequest to/v1/transactions(or/v1/transactions/json)"description": ""(empty string) in the request bodyExpected Behavior
descriptionis provided, it should be a non-empty stringnullor omitted from the payloadActual Behavior
The error code returned for an empty string
descriptionis incorrect/misleading, making it harder for clients to understand and handle the error properly.Additional Context
Reported by the operations team based on client feedback. The
descriptionfield behavior itself is correct (rejects empty strings), but the mapped error code needs to be fixed to properly communicate the issue to API consumers.