Description
Is your feature request related to a problem? Please describe.
Workday Peakon currently has a large REST API based on the JSONAPI specification. We're in the process of defining an OpenAPI spec for the API and using feTS for typing the client/server interaction. However, OpenAPI does not support sparse fieldsets and inclusion of related resources, which results in poor type safety. These features mean that the response type varies depending on the request.
Describe the solution you'd like
In a perfect world, feTS would understand the query parameters fields
and include
from the JSONAPI spec, and alter the response type correspondingly.
I've drafted a small example of how this could work as a user of the library here: https://github.com/andreas/fets-jsonapi/blob/master/index.ts
It's unclear to me whether this fits in core feTS, or whether it would be more suitable as an extension library or plugin.
Describe alternatives you've considered
Accepting poor type safety 😭
Additional context
As mentioned, this might be slightly outside the core remit of feTS, but @Urigo encouraged me to open an issue here 🙂