Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FastAPI isn't handling well not basic type arguments: List, Dict, ... #150

Open
samuelvitorsaraiva opened this issue Sep 27, 2024 · 0 comments · Fixed by #152
Open

FastAPI isn't handling well not basic type arguments: List, Dict, ... #150

samuelvitorsaraiva opened this issue Sep 27, 2024 · 0 comments · Fixed by #152
Assignees

Comments

@samuelvitorsaraiva
Copy link
Collaborator

I was interacting with a Knauer Valve using the ComponentClient and trying to send a list (e.g., [[4, 0]]) as a parameter to a FastAPI endpoint. The issue arises because requests encodes the list in a format that FastAPI is not able to handle correctly.

Knauer Valve 16 position, toml file:
[device.test]
mac_address = "00:80:A3:CE:7E:CB"
network = "141.14.."

The failure occurs because FastAPI does not correctly parse this complex data format in query parameters by default.

The proposed solution is to inspect the params argument before making the request and, if necessary, serialize the list into a string manually.

@samuelvitorsaraiva samuelvitorsaraiva self-assigned this Sep 27, 2024
@samuelvitorsaraiva samuelvitorsaraiva linked a pull request Oct 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant