-
Notifications
You must be signed in to change notification settings - Fork 303
Description
Describe the bug
Calling get_schema on a drf_spectacular.generators.SchemaGenerator sometimes returns a schema with a very odd description string of "The type of the None singleton."
{
"openapi": "3.0.3",
"info": {
...
},
"paths": {
...
"/myapi/v1/thing/lookup/{lookup}/": {
"get": {
"operationId": "thing_lookup_retrieve",
"description": "The type of the None singleton.",
"parameters": [
{
...This first occurred when upgrading from Python 3.12 to 3.13 although I haven't yet 100% convinced myself that the python version is the cause (we had to upgrade several other unrelated-as-far-as-I-can-see packages to get 3.13 support) but certainly the drf-spectacular version remains unchanged at drf-spectacular==0.26.2.
To Reproduce
It's a private project however the rough shape of the view code in question is like this:
class LookupView(generics.RetrieveAPIView):
permission_classes = [...]
authentication_classes = [...]
action = "lookup"
lookup_field = "xyz__iexact"
lookup_url_kwarg = "lookup"
class ThingLookupView(LookupView):
queryset = Thing.objects.all()
serializer_class = ThingSerializerHowever I have stepped through in a debugger to get_description and observed that in this case action_or_method == None and thus action_doc ends up as "The type of the None singleton."
Expected behavior
The "description" should continue to be omitted, as it was before.