I’m in the process of upgrading my project to Pydantic >2 and have run into the following error:
AttributeError: 'ModelField' object has no attribute '_type_display'
I discovered that ModelField was replaced in Pydantic 2.x, yet I’m still seeing ModelField in my code. Here’s the method where the error occurs:
def _query_param_dict(self, query_param):
"""Transform query param (ModelField) to dict for jinja2"""
as_str = f"{query_param.name}"
type_display = query_param._type_display()
From what I understand, Pydantic 2 has removed ModelField, but I can’t figure out why it’s still being used or how to replace it properly.
1