2
2
3
3
from __future__ import annotations
4
4
from .identificationlink import IdentificationLink , IdentificationLinkTypedDict
5
+ from clerk_backend_api import utils
5
6
from clerk_backend_api .types import (
6
7
BaseModel ,
7
8
Nullable ,
8
9
OptionalNullable ,
9
10
UNSET ,
10
11
UNSET_SENTINEL ,
11
12
)
13
+ from clerk_backend_api .utils import validate_open_enum
12
14
from enum import Enum
13
15
from pydantic import model_serializer
16
+ from pydantic .functional_validators import PlainValidator
14
17
from typing import List , Optional , Union
15
- from typing_extensions import NotRequired , TypedDict
18
+ from typing_extensions import Annotated , NotRequired , TypedDict
16
19
17
20
18
- class EmailAddressObject (str , Enum ):
21
+ class EmailAddressObject (str , Enum , metaclass = utils . OpenEnumMeta ):
19
22
r"""String representing the object's type. Objects of the same type share the same value."""
20
23
21
24
EMAIL_ADDRESS = "email_address"
22
25
23
26
24
- class OauthVerificationStatus (str , Enum ):
27
+ class OauthVerificationStatus (str , Enum , metaclass = utils . OpenEnumMeta ):
25
28
UNVERIFIED = "unverified"
26
29
VERIFIED = "verified"
27
30
FAILED = "failed"
28
31
EXPIRED = "expired"
29
32
TRANSFERABLE = "transferable"
30
33
31
34
32
- class OauthVerificationStrategy (str , Enum ):
35
+ class OauthVerificationStrategy (str , Enum , metaclass = utils . OpenEnumMeta ):
33
36
OAUTH_GOOGLE = "oauth_google"
34
37
OAUTH_MOCK = "oauth_mock"
35
38
FROM_OAUTH_GOOGLE = "from_oauth_google"
@@ -85,9 +88,13 @@ class OauthTypedDict(TypedDict):
85
88
86
89
87
90
class Oauth (BaseModel ):
88
- status : OauthVerificationStatus
91
+ status : Annotated [
92
+ OauthVerificationStatus , PlainValidator (validate_open_enum (False ))
93
+ ]
89
94
90
- strategy : OauthVerificationStrategy
95
+ strategy : Annotated [
96
+ OauthVerificationStrategy , PlainValidator (validate_open_enum (False ))
97
+ ]
91
98
92
99
expire_at : int
93
100
@@ -132,7 +139,7 @@ class AdminVerificationStatus(str, Enum):
132
139
VERIFIED = "verified"
133
140
134
141
135
- class VerificationStrategy (str , Enum ):
142
+ class VerificationStrategy (str , Enum , metaclass = utils . OpenEnumMeta ):
136
143
ADMIN = "admin"
137
144
138
145
@@ -146,7 +153,7 @@ class AdminTypedDict(TypedDict):
146
153
class Admin (BaseModel ):
147
154
status : AdminVerificationStatus
148
155
149
- strategy : VerificationStrategy
156
+ strategy : Annotated [ VerificationStrategy , PlainValidator ( validate_open_enum ( False ))]
150
157
151
158
attempts : OptionalNullable [int ] = UNSET
152
159
@@ -190,7 +197,7 @@ class VerificationStatus(str, Enum):
190
197
EXPIRED = "expired"
191
198
192
199
193
- class Strategy (str , Enum ):
200
+ class Strategy (str , Enum , metaclass = utils . OpenEnumMeta ):
194
201
PHONE_CODE = "phone_code"
195
202
EMAIL_CODE = "email_code"
196
203
EMAIL_LINK = "email_link"
@@ -212,7 +219,7 @@ class OtpTypedDict(TypedDict):
212
219
class Otp (BaseModel ):
213
220
status : VerificationStatus
214
221
215
- strategy : Strategy
222
+ strategy : Annotated [ Strategy , PlainValidator ( validate_open_enum ( False ))]
216
223
217
224
attempts : int
218
225
@@ -250,7 +257,7 @@ class EmailAddressTypedDict(TypedDict):
250
257
class EmailAddress (BaseModel ):
251
258
r"""Success"""
252
259
253
- object : EmailAddressObject
260
+ object : Annotated [ EmailAddressObject , PlainValidator ( validate_open_enum ( False ))]
254
261
r"""String representing the object's type. Objects of the same type share the same value.
255
262
256
263
"""
0 commit comments