Browse Source

make compatible with 3.8

pull/13767/head
Konstantin Zangerle 1 month ago
parent
commit
64f8856924
  1. 5
      fastapi/openapi/utils.py

5
fastapi/openapi/utils.py

@ -100,7 +100,7 @@ def _get_openapi_operation_parameters(
field_mapping: Dict[ field_mapping: Dict[
Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue Tuple[ModelField, Literal["validation", "serialization"]], JsonSchemaValue
], ],
field_docstring: Dict[str, str] | None = None, field_docstring: Optional[Dict[str, str]] = None,
separate_input_output_schemas: bool = True, separate_input_output_schemas: bool = True,
) -> List[Dict[str, Any]]: ) -> List[Dict[str, Any]]:
parameters = [] parameters = []
@ -240,6 +240,9 @@ def get_openapi_operation_metadata(
operation["description"] = "\n\n".join( operation["description"] = "\n\n".join(
[i.value for i in route.parsed_docstring if i.kind == "text"] [i.value for i in route.parsed_docstring if i.kind == "text"]
) )
operation["description"] = operation["description"].split("\f")[0].strip()
if not operation["description"]:
del operation["description"]
if route.description: if route.description:
operation["description"] = route.description operation["description"] = route.description
operation["description"] = operation["description"].split("\f")[0].strip() operation["description"] = operation["description"].split("\f")[0].strip()

Loading…
Cancel
Save