How to make the following work with pydantic?
from typing import Type
import pydantic
class InputField(pydantic.BaseModel):
name: str
type: Type
InputField.parse_raw('{"name": "myfancyfield", "type": "str"}')
It fails with
pydantic.error_wrappers.ValidationError: 1 validation error for InputField
type
a class is expected (type=type_error.class)
But I need to parse this from json, so I don't have the option to directly pass the Type object to the __init__
method.