-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Closed
Labels
featureNew feature or requestNew feature or requestinvestigatequestionQuestion or problemQuestion or problemquestion-migratereviewed
Description
While implementing filtering API recently and I came across a problem with parsing list of comma-separated ids from query string:
Example:
GET /api/items?id=1,3,5
I know this type of parsing can be easily done by declaring id parameter as str and parsing it inside the function but then we're missing awesome OpenAPI doc features.
Please find the PR #2078 with proposed solution.
OpenAPI Docs: https://swagger.io/docs/specification/serialization/
Comments regarding code changes:
- all changes should be backward compatible
- there's no support for
style=deepObjectas it would require more changes (because query params cannot be non-scalar values at the moment) - in case multiple values are present (e.g.
?id=1&id=2,3) andexplode=False, only last value is parsed (in this case2,3); it's consistent with the currently implemented behaviour in case of declaring parameter as non-sequence (e.g.str) and receiving more than one value in query string
Kludex, ycd, daxartio, yarobob, atomicflag and 17 more
Metadata
Metadata
Assignees
Labels
featureNew feature or requestNew feature or requestinvestigatequestionQuestion or problemQuestion or problemquestion-migratereviewed