Skip to content

Commit

Permalink
🩹(schema): add course query param to product retrieve route
Browse files Browse the repository at this point in the history
course is a mandatory query param for product.retrieve.
we need it in order to correctly generate javascript api client.
  • Loading branch information
rlecellier committed Feb 28, 2023
1 parent f3580f2 commit 3e65532
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions src/backend/joanie/core/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 3e65532

Please sign in to comment.