KRYSTALM7 opened a new issue, #161:
URL: https://github.com/apache/fineract-loan-origination/issues/161

   ## Problem
   
   Invalid request bodies are currently reported as `HTTP 500` instead of `HTTP 
400 Bad Request`.
   
   Examples include:
   
   - Missing required fields
   - Null values
   - Invalid currency
   - Invalid amounts
   - Invalid applicant data
   - Values exceeding configured validation limits
   - Non-numeric fields supplied for numeric properties
   
   ## Root Cause
   
   Bean validation and JSON deserialization exceptions are falling through to 
the generic exception handler.
   
   Relevant exceptions include:
   
   - `MethodArgumentNotValidException`
   - `HandlerMethodValidationException`
   - `HttpMessageNotReadableException`
   
   ## Proposed Fix
   
   Add explicit exception handlers that return `400`.
   
   Validation responses should include field-level errors where appropriate.
   
   Malformed JSON or invalid type conversion should return a clear 
request-format error.
   
   ## Acceptance Criteria
   
   - [ ] Bean validation failures return `400`.
   - [ ] Invalid JSON returns `400`.
   - [ ] Invalid numeric values return `400`.
   - [ ] Field validation errors are included in the response where applicable.
   - [ ] No invalid request is persisted.
   
   ## Regression Tests
   
   - [ ] Missing amount → `400`
   - [ ] Negative amount → `400`
   - [ ] Invalid currency → `400`
   - [ ] Invalid applicant → `400`
   - [ ] Non-numeric product ID → `400`
   - [ ] Invalid JSON → `400`
   
   ## Dependencies 
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to