@@ -518,6 +518,8 @@ def generate_api_docs_as_docstring(model: Type[BaseModel],
518518
519519 # Format the argument documentation with 12 spaces indent for args
520520 arg_line = f"{ indent } { field_name } ({ type_str } ): "
521+ if status := field_info .get ("status" , None ):
522+ arg_line += f":tag:`{ status } ` "
521523 if field_description :
522524 arg_line += field_description .split ('\n ' )[0 ] # First line with type
523525
@@ -557,20 +559,21 @@ class ApiParamTagger:
557559 '''
558560
559561 def __call__ (self , cls : Type [BaseModel ]) -> None :
560- self .process_pydantic_model (cls )
562+ """ The main entry point to tag the api doc. """
563+ self ._process_pydantic_model (cls )
561564
562- def process_pydantic_model (self , cls : Type [BaseModel ]) -> None :
565+ def _process_pydantic_model (self , cls : Type [BaseModel ]) -> None :
563566 """Process the Pydantic model to add tags to the fields.
564567 """
565568 for field_name , field_info in cls .model_fields .items ():
566569 if field_info .json_schema_extra and 'status' in field_info .json_schema_extra :
567570 status = field_info .json_schema_extra ['status' ]
568- self .amend_pydantic_field_description_with_tags (
571+ self ._amend_pydantic_field_description_with_tags (
569572 cls , [field_name ], status )
570573
571- def amend_pydantic_field_description_with_tags (self , cls : Type [BaseModel ],
572- field_names : list [str ],
573- tag : str ) -> None :
574+ def _amend_pydantic_field_description_with_tags (self , cls : Type [BaseModel ],
575+ field_names : list [str ],
576+ tag : str ) -> None :
574577 """Amend the description of the fields with tags.
575578 e.g. :tag:`beta` or :tag:`prototype`
576579 Args:
0 commit comments