diff --git a/CHANGELOG.md b/CHANGELOG.md index c516455b9c..2af5501302 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to ## Added - Add yarn cli to generate joanie api client in TypeScript +- Add course query param to openapi schema on route products.retrieve ### Removed diff --git a/src/backend/joanie/core/api.py b/src/backend/joanie/core/api.py index 74d2cb8de9..1b64fdc2c3 100644 --- a/src/backend/joanie/core/api.py +++ b/src/backend/joanie/core/api.py @@ -6,6 +6,8 @@ from django.http import HttpResponse from django.utils.translation import gettext_lazy as _ +from drf_yasg import openapi +from drf_yasg.utils import swagger_auto_schema from rest_framework import mixins, pagination, permissions, viewsets from rest_framework.decorators import action from rest_framework.exceptions import ValidationError as DRFValidationError @@ -110,6 +112,14 @@ def get_serializer_context(self): return context + @swagger_auto_schema( + manual_parameters=[ + openapi.Parameter("course", in_=openapi.IN_QUERY, type=openapi.TYPE_STRING) + ], + ) + def retrieve(self, *args, **kwargs): + return super().retrieve(*args, **kwargs) + # pylint: disable=too-many-ancestors class EnrollmentViewSet(