My IntEnum class:
class Role(IntEnum):
client = 1
manager = 2
admin = 3
What I got in generated openapi.json:
{
enum: [1, 2, 3],
title: "Role",
type: "integer"
}
What I need:
{
enum: {
client: 1,
manager: 2,
admin: 3
},
title: "Role",
type: "integer"
}
Is it possible?🙏🏼
Thanks everyone for your attention, but I found a solution:)
I should to override __get_pydantic_json_schema__
method in all my classes where I need custom schema generation.