I have a Pydantic model like
from datetime import datetime
from pydantic import BaseModel, Field
class MainModel(BaseModel):
name: str = Field(
"example",
title='The name',
description='The name assigned',
)
date: datetime = Field(
datetime.now(),
title='Date',
description='The date of creation...',
)
Pydantic makes it easy to print out the model schema with MainModel.schema_json(). Once I have initialized an object of MainModel, such as
example = MainModel(
name="test",
date=datetime.now()
)
I can print json/dict of example by example.dict(), however, additional markup information like title and description aren't included. Is it possible to print these together, or will I need to do some sort of dict join between MainModel.schema_json() and example.dict()?