Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

JSONSchema Validation For Filters #1783

Merged
merged 4 commits into from Mar 23, 2017

Conversation

Projects
None yet
3 participants
Contributor

pik commented Jan 8, 2017

  • Errors are now raised for invalid filter properties
  • Easier to test / human-readable (compared to the for-loops from before)
  • Adds invalid filter tests

Also the that the room_event_filter schema supplied by the spec does not actually function in all cases e.g. ##1782 - should probably be addressed, adding test cases and either by adding the missing functionality or limiting the schema.

Can one of the admins verify this patch?

Can one of the admins verify this patch?

Can one of the admins verify this patch?

synapse/api/filtering.py
+ "timeline": {
+ "$ref": "#/definitions/room_event_filter"
+ },
+ "accpount_data": {
@erikjohnston

erikjohnston Jan 19, 2017

Owner

typo accpount_data

Owner

erikjohnston commented Mar 23, 2017

looks good to me, just requires a rebase

Owner

erikjohnston commented Mar 23, 2017

@matrixbot ok to test

pik added some commits Mar 23, 2017

check_valid_filter using JSONSchema
 * add invalid filter tests

Signed-off-by: pik <alexander.maznev@gmail.com>
Add valid filter tests, flake8, fix typo
Signed-off-by: pik <alexander.maznev@gmail.com>
use jsonschema.FormatChecker for RoomID and UserID strings
 * use a valid filter in rest/client/v2_alpha test

Signed-off-by: pik <alexander.maznev@gmail.com>
Add jsonschema to python_dependencies.py
Signed-off-by: pik <alexander.maznev@gmail.com>
Owner

erikjohnston commented Mar 23, 2017

Thanks!

@erikjohnston erikjohnston merged commit 6af0096 into matrix-org:develop Mar 23, 2017

3 of 4 checks passed

Sytest Dendron (Merged PR) Build finished.
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Merged PR) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment