Skip to content

Commit

Permalink
fix camel case problem
Browse files Browse the repository at this point in the history
  • Loading branch information
zworkb committed Apr 18, 2024
1 parent 3749e77 commit 06bafbc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/edutap/wallet_google/models/primitives/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ def __new__(cls: type["CamelCaseAliasEnum"], value: str) -> "CamelCaseAliasEnum"
[(x.capitalize() if count != 0 else x) for count, x in enumerate(parts)]
)

# TODO: fix this so that UPPER_CASE andupperCase work
obj._value_ = camel
cls._value2member_map_[camel] = obj
cls._member_map_[camel] = obj
# create a second object with the camelcase name
# creating an alias only does not work out since
# pydantic checks for the value in the enum and not only the name
camel_obj= object.__new__(cls)
camel_obj._value_ = camel
cls._value2member_map_[camel] = camel_obj
cls._member_map_[camel] = camel_obj
cls._member_names_.append(camel)
return obj

Expand Down

0 comments on commit 06bafbc

Please sign in to comment.