Skip to content

Commit

Permalink
Add separate view for the old path and update api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
SmittieC committed Jan 17, 2025
1 parent 91bf738 commit 9d63482
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions api-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,9 @@ paths:
schema:
$ref: '#/components/schemas/CreateChatCompletionResponse'
description: ''
/api/participants/:
/api/participants:
post:
operationId: update_participant_data
description: Upsert participant data for all specified experiments in the payload
summary: Update Participant Data
tags:
- Participants
Expand Down
2 changes: 1 addition & 1 deletion apps/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]

urlpatterns = [
path("participants/", views.update_participant_data, name="update-participant-data"),
path("participants/", views.update_participant_data_old, name="update-participant-data-old"),
# Duplicate update-participant-data without a trailing "/" for backwards compatibility
path("participants", views.update_participant_data, name="update-participant-data"),
path("openai/<uuid:experiment_id>/chat/completions", openai.chat_completions, name="openai-chat-completions"),
Expand Down
12 changes: 12 additions & 0 deletions apps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ def get_queryset(self):
@api_view(["POST"])
@permission_required("experiments.change_participantdata")
def update_participant_data(request):
return _update_participant_data(request)


@extend_schema(exclude=True)
@api_view(["POST"])
@permission_required("experiments.change_participantdata")
def update_participant_data_old(request):
# This endpoint is kept for backwards compatibility of the path with a trailing "/"
return _update_participant_data(request)


def _update_participant_data(request):
"""
Upsert participant data for all specified experiments in the payload
"""
Expand Down

0 comments on commit 9d63482

Please sign in to comment.