-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Validate required fields in sql_json API #21003
fix: Validate required fields in sql_json API #21003
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21003 +/- ##
==========================================
- Coverage 66.34% 66.18% -0.16%
==========================================
Files 1767 1768 +1
Lines 67312 67367 +55
Branches 7144 7144
==========================================
- Hits 44656 44586 -70
- Misses 20828 20953 +125
Partials 1828 1828
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@hughhhh @betodealmeida Can you review it? |
Hi @EugeneTorap, Thanks for adding validation on the endpoint. Do you mind following the Mashmallow validation schema for the requesting validation? Here are some examples. |
Thanks, will do it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the restructuring modules and adding more tests for key functions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, left some no-blocking comments in the test case.
self.assertDictEqual(resp_data, failed_resp) | ||
self.assertEqual(rv.status_code, 400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same before
self.assertDictEqual(resp_data, failed_resp) | ||
self.assertEqual(rv.status_code, 400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same before
self.assertEqual(resp_data.get("status"), "success") | ||
self.assertEqual(rv.status_code, 200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same before
resp_data = json.loads(rv.data.decode("utf-8")) | ||
self.assertDictEqual(resp_data, failed_resp) | ||
self.assertEqual(rv.status_code, 400) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no blocking, nits
resp_data = json.loads(rv.data.decode("utf-8")) | |
self.assertDictEqual(resp_data, failed_resp) | |
self.assertEqual(rv.status_code, 400) | |
assert rv.json == failed_resp | |
assert rv.status_code == 400 |
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file necessary?
fix #20873 issues.
SUMMARY
sql_json API has two required fields:
We need to validate these fields if they are
None
and send user an understandable error if one of the fields is missing.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION