Skip to content
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

Validate tag length and set a limit of 1000 #8526

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion h/schemas/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class AnnotationSchema(JSONSchema):
"required": ["read"],
},
"references": {"type": "array", "items": {"type": "string"}},
"tags": {"type": "array", "items": {"type": "string"}},
"tags": {"type": "array", "items": {"type": "string", "maxLength": 1000}},
"target": {
"type": "array",
"items": {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/h/schemas/annotation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def test_it_does_not_raise_for_full_valid_data(self, pyramid_request, validate):
),
({"references": False}, "references: False is not of type 'array'"),
({"references": [False]}, "references.0: False is not of type 'string'"),
({"tags": ["tag" * 1000]}, f"tags.0: '{'tag' * 1000}' is too long"),
({"tags": False}, "tags: False is not of type 'array'"),
({"tags": [False]}, "tags.0: False is not of type 'string'"),
({"target": False}, "target: False is not of type 'array'"),
Expand Down
Loading