Open poppelaars opened 1 month ago
Not yet, but good idea. The closest thing now is the typing.Literal
:
from typing import Literal
class MyModel(esorm.ESModel):
fruit: Literal['banana', 'pear']
But I will implement Enum
in the next release.
Could you take into account the support for fastapi swagger documentation? As far as I understand fastapi uses the str subclass to generate swagger documentation.
https://stackoverflow.com/questions/64160594/fastapi-enum-type-models-not-populated https://github.com/pydantic/pydantic/discussions/4967
FastAPI is just using Pydantic, as ESORM. So it should work out of the box. I'm using ESORM with FastAPI in one of my project, and it works very well.
Maybe a noob question.
I am trying to integrate esorm with fastapi and would like to use an Enumeration type.
Source: https://docs.pydantic.dev/2.0/usage/types/enums/
Is there a way to specify an Enum as an elasticsearch 'keyword' inside my model class?