-
Notifications
You must be signed in to change notification settings - Fork 67
Error parsing enum value on query #281
Copy link
Copy link
Open
Labels
Description
Describe the bug
When try to send enum values the payload send is the string of the class
To Reproduce
Execute the following code:
from enum import Enum
class OptionType(Enum):
OP1 = 'FirstOp'
OP2 = 'SecondOp'
OP3 = 'ThirdOp'
class SomeAPI(Consumer):
@returns.json()
@get("/path")
def list_elements(self,
option_type: Query(type=OptionType),
page: Query(type=int) = 0,
limit: Query(type=int) = 100
):
""" Get list """
...
if __name__ == '__main__':
session = requests.Session()
client = SomeAPI('http://localhost:5000', client=session)
resp = client.list_elements(option_type=OptionType.OP1)The payload send to the server is:
{'option_type': 'OptionType.OP1', 'page': '0', 'limit': '100'}
Expected behavior
The payload expected is:
{'option_type': 'FirstOp', 'page': '0', 'limit': '100'}
Additional context
I think the issue is on the function Sequence.convert
Reactions are currently unavailable