feat: id parameter (not working)

This commit is contained in:
indyandie 2024-03-06 23:17:01 -06:00
parent 77a4570b15
commit 89e55332c9
No known key found for this signature in database
GPG key ID: FDB83C1AED3933E1
2 changed files with 15 additions and 4 deletions

View file

@ -5164,10 +5164,10 @@ components:
minimum: -2147483648
contest_combos:
type: object
required:
- normal
- super
properties:
required:
- normal
- super
normal:
type: object
required:

View file

@ -4,7 +4,8 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from django.shortcuts import get_object_or_404
from django.http import Http404
from drf_spectacular.utils import extend_schema, extend_schema_view
from drf_spectacular.utils import extend_schema, extend_schema_view, OpenApiParameter
from drf_spectacular.types import OpenApiTypes
from .models import *
from .serializers import *
@ -39,6 +40,16 @@ class NameOrIdRetrieval:
idPattern = re.compile(r"^-?[0-9]+$")
namePattern = re.compile(r"^[0-9A-Za-z\-\+]+$")
@extend_schema(
parameters=[
OpenApiParameter(
name="id",
description="This parameter can be a string or an integer.",
location=OpenApiParameter.PATH,
type=OpenApiTypes.STR,
),
]
)
def get_object(self):
queryset = self.get_queryset()
queryset = self.filter_queryset(queryset)