Skip to content

Conversation

itsRems
Copy link
Owner

@itsRems itsRems commented Sep 3, 2023

Feature desc

This adds support for gql-like picking of the return schema you want.

Picking will support object and array payloads.

When picking arrays, you will be able to define a sub-pick for the type of the contained elements (this will loop to resolve), as well as how many elements to keep from the array

This won't be as good as advanced GQL - where different resolvers can be added -, but that's because this isn't the point.
This feature is purely here to help reduce the response size and help frontend devs improve perfomance by only picking what they need - while not requiring any additional work from backend devs

Client Side

Clients will be responsible for providing picking support (by integrating utils from the core package), and if picking is enabled, a structured JSON header must be sent to the server.

Server Side

A onSend hook will be added to fastify, checking for the pick header, and if present, it will pick the data from the wanted fields before returning it

@itsRems itsRems marked this pull request as draft September 3, 2023 04:03
@itsRems
Copy link
Owner Author

itsRems commented Sep 3, 2023

super early tests
image
image
image

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 this pull request may close these issues.

1 participant