Skip to content

Commit

Permalink
[#328] update path parameter documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonny Bakker committed Sep 5, 2024
1 parent 03909e5 commit a9a808a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/objects/api/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,13 @@ paths:
- in: path
name: index
schema:
type: string
pattern: ^\d+$
type: number
required: true
- in: path
name: uuid
schema:
type: string
format: uuid
description: Unique identifier (UUID4)
required: true
tags:
- objects
Expand Down
17 changes: 16 additions & 1 deletion src/objects/api/v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from django.conf import settings
from django.db import models

from drf_spectacular.utils import extend_schema, extend_schema_view
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import OpenApiParameter, extend_schema, extend_schema_view
from rest_framework import mixins, viewsets
from rest_framework.decorators import action
from rest_framework.generics import get_object_or_404
Expand Down Expand Up @@ -124,6 +125,20 @@ def history(self, request, uuid=None):
@extend_schema(
description="Retrieve the specified OBJECT given an UUID and INDEX.",
responses={"200": HistoryRecordSerializer()},
parameters=[
OpenApiParameter(
name="index",
location=OpenApiParameter.PATH,
required=True,
type=OpenApiTypes.NUMBER,
),
OpenApiParameter(
name="uuid",
location=OpenApiParameter.PATH,
required=True,
type=OpenApiTypes.UUID,
),
]
)
@action(
detail=True,
Expand Down

0 comments on commit a9a808a

Please sign in to comment.