-
Notifications
You must be signed in to change notification settings - Fork 756
Open
Labels
FOSSHack 2026FOSSHack 2026 HackathonFOSSHack 2026 HackathonbackendFlask backend issuesFlask backend issuesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Description
The `option_greeks.py` endpoint returns validation errors in a different format than all other endpoints. This breaks API consistency.
Affected File
- `restx_api/option_greeks.py` (lines 99-100)
Current Behavior
```python
option_greeks.py returns:
{"status": "error", "errors": err.messages}
e.g., {"status": "error", "errors": {"symbol": ["Missing data for required field."]}}
All other endpoints return:
{"status": "error", "message": "Human-readable error message"}
```
What to Do
Standardize to match the project convention:
```python
Before
except ValidationError as err:
return make_response(jsonify({
"status": "error",
"errors": err.messages
}), 400)
After
except ValidationError as err:
return make_response(jsonify({
"status": "error",
"message": "Validation error",
"errors": err.messages # Keep for details, but add "message" key
}), 400)
```
Acceptance Criteria
- Response includes standard `"message"` key
- Detailed validation errors preserved in `"errors"` key
- Consistent with other endpoint error responses
Skills You'll Learn
- API design consistency
- Error response patterns (REST API best practices)
- Flask-RESTX response formatting
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FOSSHack 2026FOSSHack 2026 HackathonFOSSHack 2026 HackathonbackendFlask backend issuesFlask backend issuesbugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers