diff --git a/esmerald/openapi/models.py b/esmerald/openapi/models.py index a3db65c6..1cb1e276 100644 --- a/esmerald/openapi/models.py +++ b/esmerald/openapi/models.py @@ -38,7 +38,7 @@ class APIKey(SecurityScheme): type: Literal["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"] = Field( - default=SecuritySchemeType.apiKey, + default=SecuritySchemeType.apiKey.value, alias="type", ) param_in: APIKeyIn = Field(alias="in") @@ -47,7 +47,7 @@ class APIKey(SecurityScheme): class HTTPBase(SecurityScheme): type: Literal["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"] = Field( - default=SecuritySchemeType.http, + default=SecuritySchemeType.http.value, alias="type", ) scheme: str @@ -64,14 +64,14 @@ class OAuthFlow(OpenOAuthFlow): class OAuth2(SecurityScheme): type: Literal["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"] = Field( - default=SecuritySchemeType.oauth2, alias="type" + default=SecuritySchemeType.oauth2.value, alias="type" ) flows: OAuthFlows class OpenIdConnect(SecurityScheme): type: Literal["apiKey", "http", "mutualTLS", "oauth2", "openIdConnect"] = Field( - default=SecuritySchemeType.openIdConnect, alias="type" + default=SecuritySchemeType.openIdConnect.value, alias="type" ) openIdConnectUrl: str diff --git a/tests/routing/test_syntax_enum.py b/tests/routing/test_syntax_enum.py index c02da972..76d5a984 100644 --- a/tests/routing/test_syntax_enum.py +++ b/tests/routing/test_syntax_enum.py @@ -5,7 +5,7 @@ from esmerald import Gateway, JSONResponse, get from esmerald.testclient import create_client -pydantic_version = __version__[:3] +pydantic_version = ".".join(__version__.split(".")[:2]) class ItemType(str, Enum):