drf-spectacular:将描述添加到 HTTP_204

drf-spectacular: Add description to HTTP_204

@extend_schema(                                                                                                                    
    request=MyRequestSerializer,                                                                             
    responses={200: MyResponseSerializer(many=True),                                                         
               204: None,                                                                                    
               },                                                                                            
    examples=[                                                                                               
       OpenApiExample(                                                                                       
           '204',                                                                                            
           status_codes=['204'],                                                                             
           summary="My documentation summary",                                                               
           description="My documentation description",                                                       
          response_only=True,                                                                                
       ),                                                                                                    
   ....]                                                                                                     
)

这是我尝试过的,但我得到的是

drf-spectacular 版本 0.15.1 添加了 OpenApiResponse 功能。此片段来自测试用例:

from drf_spectacular.utils import OpenApiResponse, extend_schema

@extend_schema(
    description='creation description', 
    responses={
        201: OpenApiResponse(response=int, description='creation with int response.'),
        204: OpenApiResponse(description='creation with no response.'),
        223: None,
})