Validate request fields in sql_json API
We use postman/insomnia http client to call/test all superset API.
And we found that /superset/sql_json/ API don't have validation for required fields. For example if we don't provide sql field in JSON body of request we get such error: "message": "Failed to execute query '164' - 'None': 'NoneType' object has no attribute 'strip'" and then Query History record is created with sql column is null (db table - query)
How to reproduce the bug
- Call
loginAPI to auth - Call
/superset/sql_json/API withoutsqlfield - See response error
- See error for
/api/v1/query/API
Expected results
We have to validate required fields for /superset/sql_json/ API .
Actual results
There's no validation for /superset/sql_json/ API .
Columns sql has null value in db table - query.
/api/v1/query/ API is broken with error message is "error": "'NoneType' object has no attribute 'strip'"
Screenshots

Environment
(please complete the following information):
- browser type and version:
- superset version:
superset version - python version:
python --version - node.js version:
node -v - any feature flags active:
Checklist
Make sure to follow these steps before submitting your issue - thank you!
- [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ ] I have reproduced the issue with at least the latest released version of superset.
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar.
Additional context
Add any other context about the problem here. @michael-s-molina @kgabryje @codyml @zhaoyongjie @diegomedina248 @jinghua-qa @geido @AAfghahi @srinify