marshmallow-code / marshmallow-code/flask-smorest
Allowing partial response with return fields specified through a query param
- Dominant language
- Python
- Stars
- 717
- Forks
- 77
- Avg merge
- 7h 49m
- Merged PRs (30d)
- 3
Description
We are looking to make a number of endpoints allow a `only` (or `select`?) query param that essentially would forward the fields (with appropriate sanity checking) to the return schema as an `only=` argument. Allowing us for example to run things like `GET /pets/123?select=status` and get a compact response.
While this seems doable if we implement our own serialisation, or maybe even by running the response twice (first through our partial schema, then through smorest's default wrapper), it would of course be a lot nicer if we could somehow specify (at endpoint or api level) that a given query param can be used for that purpose.
In a way, this should probably be implemented similarly to pagination, but we are not entirely sure about the best way to go.
Is this something you have given thought to? any opinions on that? If we were to work on a PR, would you consider merging it?
Contributor guide
Research direction
Start by reviewing the endpoint- and API-level configuration, the pagination handling, and the response-schema serialization path mentioned in the issue. A complete change would establish how an only/select query parameter is validated and forwarded to response schemas, with behavior and documentation for compact endpoint responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, openapi, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100