fastapi-filter icon indicating copy to clipboard operation
fastapi-filter copied to clipboard

drop support for comma separated strings in favor is native lists

Open mhamid3d opened this issue 8 months ago • 2 comments

FastAPI does not natively support comma separated lists in query parameters. Instead, lists are ingested via repeating key patterns. Forcing comma separated lists also breaks docs and schemas. It is preferred to be consistent with how FastAPI natively handles lists.

In order for FastAPI to parse a field as a list, it must be either annotated with a Query or have its default value be a Query. We can do this in FilterDepends. Checking for Union types is no longer needed and splitting comma string is no longer needed.

mhamid3d avatar Mar 05 '25 14:03 mhamid3d

Deploy Preview for fastapi-filter ready!

Name Link
Latest commit 704992e0c2377b87aebf97d85fc729df67a146d0
Latest deploy log https://app.netlify.com/sites/fastapi-filter/deploys/67c86bd00c87550008385b0b
Deploy Preview https://deploy-preview-620--fastapi-filter.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Mar 05 '25 14:03 netlify[bot]

As this will not pass checks because of tests are using comma separated strings, I will just leave this PR as a reference in case the future maintainer needs a hint on how to support native python lists

mhamid3d avatar Mar 06 '25 01:03 mhamid3d