Skip to content

Commit

Permalink
refactor: Enum models also inherit from 'str'
Browse files Browse the repository at this point in the history
So they can be compared with strings.
  • Loading branch information
azmeuk committed May 24, 2024
1 parent a505ad5 commit 61399c0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pydantic_scim2/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def unprocessable(cls, detail: str = "Unprocessable Entity") -> "SCIMError":
return cls(detail=detail, status=422)


class PatchOp(Enum):
class PatchOp(str, Enum):
replace = "replace"
remove = "remove"
add = "add"
Expand Down
8 changes: 4 additions & 4 deletions pydantic_scim2/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .resource import Meta


class AttributeKind(Enum):
class AttributeKind(str, Enum):
string = "string"
boolean = "boolean"
decimal = "decimal"
Expand All @@ -18,21 +18,21 @@ class AttributeKind(Enum):
complex = "complex"


class Mutability(Enum):
class Mutability(str, Enum):
readOnly = "readOnly"
readWrite = "readWrite"
immutable = "immutable"
writeOnly = "writeOnly"


class Returned(Enum):
class Returned(str, Enum):
always = "always"
never = "never"
default = "default"
request = "request"


class Uniqueness(Enum):
class Uniqueness(str, Enum):
none = "none"
server = "server"
global_ = "global"
Expand Down
2 changes: 1 addition & 1 deletion pydantic_scim2/service_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ETag(BaseModel):
"""A Boolean value specifying whether or not the operation is supported."""


class AuthenticationSchemeKind(Enum):
class AuthenticationSchemeKind(str, Enum):
oauth = "oauth"
oauth2 = "oauth2"
oauthbearertoken = "oauthbearertoken"
Expand Down
10 changes: 5 additions & 5 deletions pydantic_scim2/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Name(BaseModel):
)


class EmailKind(Enum):
class EmailKind(str, Enum):
work = "work"
home = "home"
other = "other"
Expand All @@ -63,7 +63,7 @@ class Email(BaseModel):
)


class PhoneNumberKind(Enum):
class PhoneNumberKind(str, Enum):
work = "work"
home = "home"
mobile = "mobile"
Expand All @@ -88,7 +88,7 @@ class PhoneNumber(BaseModel):
)


class ImKind(Enum):
class ImKind(str, Enum):
aim = "aim"
gtalk = "gtalk"
icq = "icq"
Expand Down Expand Up @@ -117,7 +117,7 @@ class Im(BaseModel):
)


class PhotoKind(Enum):
class PhotoKind(str, Enum):
photo = "photo"
thumbnail = "thumbnail"

Expand All @@ -138,7 +138,7 @@ class Photo(BaseModel):
)


class AddressKind(Enum):
class AddressKind(str, Enum):
work = "work"
home = "home"
other = "other"
Expand Down

0 comments on commit 61399c0

Please sign in to comment.