Skip to content

Allowing partial response with return fields specified through a query param #762

@zedrdave

Description

@zedrdave

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions