mirror of https://github.com/tiangolo/fastapi.git
Allow setting schema generator instance
This means one can follow an approach similar to https://github.com/pydantic/pydantic/issues/7376#issuecomment-1763462208 when dealing with generics.
This commit is contained in:
parent
040ad986d4
commit
89ec41f5ef
|
|
@ -450,6 +450,7 @@ def get_openapi(
|
|||
contact: Optional[Dict[str, Union[str, Any]]] = None,
|
||||
license_info: Optional[Dict[str, Union[str, Any]]] = None,
|
||||
separate_input_output_schemas: bool = True,
|
||||
schema_generator: Optional[GenerateJsonSchema] = None,
|
||||
) -> Dict[str, Any]:
|
||||
info: Dict[str, Any] = {"title": title, "version": version}
|
||||
if summary:
|
||||
|
|
@ -471,7 +472,7 @@ def get_openapi(
|
|||
operation_ids: Set[str] = set()
|
||||
all_fields = get_fields_from_routes(list(routes or []) + list(webhooks or []))
|
||||
model_name_map = get_compat_model_name_map(all_fields)
|
||||
schema_generator = GenerateJsonSchema(ref_template=REF_TEMPLATE)
|
||||
schema_generator = schema_generator or GenerateJsonSchema(ref_template=REF_TEMPLATE)
|
||||
field_mapping, definitions = get_definitions(
|
||||
fields=all_fields,
|
||||
schema_generator=schema_generator,
|
||||
|
|
|
|||
Loading…
Reference in New Issue