Skip to content

Commit 13d4fd8

Browse files
committed
Update le-utils and validation
1 parent ebc2a42 commit 13d4fd8

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

contentcuration/contentcuration/viewsets/recommendation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from automation.utils.appnexus import errors
66
from django.http import HttpResponseServerError
77
from django.http import JsonResponse
8-
from le_utils.validators import embed_topics_request
8+
from le_utils.constants import embed_topics_request
99
from rest_framework.permissions import IsAuthenticated
1010
from rest_framework.views import APIView
1111

@@ -15,6 +15,10 @@
1515
logger = logging.getLogger(__name__)
1616

1717

18+
def validate_recommendations_request(data):
19+
jsonschema.validate(instance=data, schema=embed_topics_request.SCHEMA)
20+
21+
1822
class RecommendationView(APIView):
1923

2024
permission_classes = [
@@ -29,7 +33,7 @@ def post(self, request):
2933
# Remove and store override_threshold as it isn't defined in the schema
3034
override_threshold = request_data.pop("override_threshold", False)
3135

32-
embed_topics_request.validate(request_data)
36+
validate_recommendations_request(request_data)
3337
except jsonschema.ValidationError as e:
3438
logger.error("Schema validation error: %s", str(e))
3539
return JsonResponse(

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"jquery": "^2.2.4",
7272
"jspdf": "https://github.com/parallax/jsPDF.git#b7a1d8239c596292ce86dafa77f05987bcfa2e6e",
7373
"jszip": "^3.10.1",
74-
"kolibri-constants": "^0.2.11",
74+
"kolibri-constants": "^0.2.12",
7575
"kolibri-design-system": "5.2.0",
7676
"lodash": "^4.17.21",
7777
"material-icons": "0.3.1",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ djangorestframework==3.15.1
55
psycopg2-binary==2.9.10
66
django-js-reverse==0.10.2
77
django-registration==3.4
8-
le-utils>=0.2.11
8+
le-utils>=0.2.12
99
gunicorn==23.0.0
1010
django-postmark==0.1.6
1111
jsonfield==3.1.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jsonschema-specifications==2024.10.1
154154
# via jsonschema
155155
kombu==5.5.2
156156
# via celery
157-
le-utils==0.2.11
157+
le-utils==0.2.12
158158
# via -r requirements.in
159159
packaging==25.0
160160
# via

0 commit comments

Comments
 (0)