File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change
1
+ import re
1
2
from typing import (
2
3
TYPE_CHECKING ,
3
4
Any ,
@@ -320,12 +321,11 @@ def add_api_operation(
320
321
include_in_schema : bool = True ,
321
322
openapi_extra : Optional [Dict [str , Any ]] = None ,
322
323
) -> None :
323
- if "{uuid:" in path :
324
- # django by default convert strings to UUIDs
325
- # but we want to keep them as strings to let pydantic handle conversion/validation
326
- # if user whants UUID object
327
- # uuidstr is custom registered converter
328
- path = path .replace ("{uuid:" , "{uuidstr:" )
324
+ path = re .sub (r"\{uuid:(\w+)\}" , r"{uuidstr:\1}" , path , flags = re .IGNORECASE )
325
+ # django by default convert strings to UUIDs
326
+ # but we want to keep them as strings to let pydantic handle conversion/validation
327
+ # if user whants UUID object
328
+ # uuidstr is custom registered converter
329
329
330
330
if path not in self .path_operations :
331
331
path_view = PathView ()
You can’t perform that action at this time.
0 commit comments