This gives a couple of type errors on endpoint setup:
File "/Users/ankush.govil/work/external-integration/venv/lib/python3.10/site-packages/fastapi/openapi/utils.py", line 103, in get_openapi_operation_parameters
"schema": field_schema(
File "pydantic/schema.py", line 247, in pydantic.schema.field_schema
File "pydantic/schema.py", line 215, in pydantic.schema.get_field_info_schema
File "pydantic/schema.py", line 985, in pydantic.schema.encode_default
File "pydantic/json.py", line 90, in pydantic.json.pydantic_encoder
TypeError: Object of type 'ModelMetaclass' is not JSON serializable
Also, If I able to comment this type issue the request model example in swagger is coming as
FastAPI supports using pydantic models to define JSON request body for REST API endpoints;
I need the FHIR resources model to be used as a request in FastAPI Going through the README; it doesn't seems to be compatible with pydantic model.
An example is shown of Patient resource from release 5.1.1, with python 3.10 FastAPI 0.85.0 and pydantic 1.10.2:
This gives a couple of type errors on endpoint setup:
File "/Users/ankush.govil/work/external-integration/venv/lib/python3.10/site-packages/fastapi/openapi/utils.py", line 103, in get_openapi_operation_parameters "schema": field_schema( File "pydantic/schema.py", line 247, in pydantic.schema.field_schema File "pydantic/schema.py", line 215, in pydantic.schema.get_field_info_schema File "pydantic/schema.py", line 985, in pydantic.schema.encode_default File "pydantic/json.py", line 90, in pydantic.json.pydantic_encoder TypeError: Object of type 'ModelMetaclass' is not JSON serializable
Also, If I able to comment this type issue the request model example in swagger is coming as
Does FastAPI support these FHIR resources as a request model in pydantic?