API not returning useful validation error when FED submitted with undesired datetime format
- Dominant language
- JavaScript
- Stars
- 23
- Forks
- 62
- Avg merge
- 24m
- Merged PRs (30d)
- 1
Description
**Describe the bug in current situation**
When an alteration filing is posted to the API with a FED, the API returns with a 500 internal server error. Note that the corresponding FE ticket is https://app.zenhub.com/workspaces/entity-5bf2f2164b5806bc2bf60531/issues/bcgov/entity/6763
**Impact of this bug**
If the FE fix is deployed there is not much impact. The API should still be fixed to protect itself pro-actively from invalid inputs.
**Steps to Reproduce**
Steps to reproduce the behavior:
1. Post to filings endpoint (e.g. https://legal-api-dev.pathfinder.gov.bc.ca/api/v1/businesses/BC1230084/filings) with payload similar to the following in Postman. Note that the effectiveDate date format is the key thing here. This is what triggers the API 500 error.
```
{
"filing": {
"header": {
"name": "alteration",
"certifiedBy": "",
"date": "2021-03-20",
"folioNumber": "",
"isFutureEffective": true,
"effectiveDate": "2021-03-25T10:02:00.000Z"
},
"business": {},
"alteration": {}
}
}
```
2. API throws 500 error.
**Actual/ observed behavior/ results**

**Expected behavior**
Validation error message should be returned by BE endpoint indicating that the date time format was invalid.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.