Skip to content

Commit 61399c0

Browse files
committed
refactor: Enum models also inherit from 'str'
So they can be compared with strings.
1 parent a505ad5 commit 61399c0

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

pydantic_scim2/responses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def unprocessable(cls, detail: str = "Unprocessable Entity") -> "SCIMError":
3333
return cls(detail=detail, status=422)
3434

3535

36-
class PatchOp(Enum):
36+
class PatchOp(str, Enum):
3737
replace = "replace"
3838
remove = "remove"
3939
add = "add"

pydantic_scim2/schema.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .resource import Meta
88

99

10-
class AttributeKind(Enum):
10+
class AttributeKind(str, Enum):
1111
string = "string"
1212
boolean = "boolean"
1313
decimal = "decimal"
@@ -18,21 +18,21 @@ class AttributeKind(Enum):
1818
complex = "complex"
1919

2020

21-
class Mutability(Enum):
21+
class Mutability(str, Enum):
2222
readOnly = "readOnly"
2323
readWrite = "readWrite"
2424
immutable = "immutable"
2525
writeOnly = "writeOnly"
2626

2727

28-
class Returned(Enum):
28+
class Returned(str, Enum):
2929
always = "always"
3030
never = "never"
3131
default = "default"
3232
request = "request"
3333

3434

35-
class Uniqueness(Enum):
35+
class Uniqueness(str, Enum):
3636
none = "none"
3737
server = "server"
3838
global_ = "global"

pydantic_scim2/service_provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ETag(BaseModel):
5959
"""A Boolean value specifying whether or not the operation is supported."""
6060

6161

62-
class AuthenticationSchemeKind(Enum):
62+
class AuthenticationSchemeKind(str, Enum):
6363
oauth = "oauth"
6464
oauth2 = "oauth2"
6565
oauthbearertoken = "oauthbearertoken"

pydantic_scim2/user.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Name(BaseModel):
3838
)
3939

4040

41-
class EmailKind(Enum):
41+
class EmailKind(str, Enum):
4242
work = "work"
4343
home = "home"
4444
other = "other"
@@ -63,7 +63,7 @@ class Email(BaseModel):
6363
)
6464

6565

66-
class PhoneNumberKind(Enum):
66+
class PhoneNumberKind(str, Enum):
6767
work = "work"
6868
home = "home"
6969
mobile = "mobile"
@@ -88,7 +88,7 @@ class PhoneNumber(BaseModel):
8888
)
8989

9090

91-
class ImKind(Enum):
91+
class ImKind(str, Enum):
9292
aim = "aim"
9393
gtalk = "gtalk"
9494
icq = "icq"
@@ -117,7 +117,7 @@ class Im(BaseModel):
117117
)
118118

119119

120-
class PhotoKind(Enum):
120+
class PhotoKind(str, Enum):
121121
photo = "photo"
122122
thumbnail = "thumbnail"
123123

@@ -138,7 +138,7 @@ class Photo(BaseModel):
138138
)
139139

140140

141-
class AddressKind(Enum):
141+
class AddressKind(str, Enum):
142142
work = "work"
143143
home = "home"
144144
other = "other"

0 commit comments

Comments
 (0)