Repository navigation
feat(tables_db): add client-side row validation against table schema closes #134 - #162
GauravPatil2515 wants to merge 1 commit into
Conversation
Signed-off-by: Gaurav Patil <gauravpatil2516@gmail.com>
|
This library is auto-generated by the Appwrite SDK Generator, and does not accept pull requests directly. To learn more about how you can help us improve this SDK, please check the contributing guide. |
馃數 Tier A 路 Mergeable after minor fixes
This change adds optional schema-based validation to
Note @GauravPatil2515 does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve.
Fix with agent prompt### Issue 1
appwrite/services/tables_db.py:4463-4464
**Cover validation through create_row**
The new tests call `validate_row_data` directly, while the existing `TablesDB.create_row` test omits `schema`; none verifies that invalid data is rejected before `client.call`. A regression in this integration hook could therefore leave the suite green while the advertised request guard no longer works.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.馃搨 Walkthrough 路 4
馃攪 Filtered out 路 1Findings Hansi considered but did not post.
Reviewed |
| if schema is not None: | ||
| validate_row_data(data, schema) |
There was a problem hiding this comment.
Cover validation through create_row
The new tests call validate_row_data directly, while the existing TablesDB.create_row test omits schema; none verifies that invalid data is rejected before client.call. A regression in this integration hook could therefore leave the suite green while the advertised request guard no longer works.
Prompt To Fix With AI
This is a comment left during a code review.
Path: appwrite/services/tables_db.py
Line: 4463-4464
Comment:
**Cover validation through create_row**
The new tests call `validate_row_data` directly, while the existing `TablesDB.create_row` test omits `schema`; none verifies that invalid data is rejected before `client.call`. A regression in this integration hook could therefore leave the suite green while the advertised request guard no longer works.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.馃煛 Minor 路 testing 路 Reply if this doesn't apply.
Description
Resolves #134
This PR introduces optional client-side schema validation for
TablesDB.create_rowbefore network requests are dispatched, catching common data type errors and missing required attributes early with descriptive error messages.Changes Made
validate_row_datainappwrite/utils/validator.pysupporting Appwrite primitive types (string,text,integer,float,boolean,array, etc.)schemaparameter intoTablesDB.create_rowinappwrite/services/tables_db.pytest/test_validator.pycovering valid payloads, missing required fields, type mismatches, and array validationHow Has This Been Tested?
python3 -m unittest test/test_validator.py) - all 6 tests pass cleanlyschema=None(default), no validation overhead or behavior changes occur