"expand" support implementation #684
gunnartorfis
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our OpenAPI schema has an "expand" parameter on some of our GET endpoints.
It expands on a relation if provided and returns the object instead of the foreign key string.
We're using the React Query generator.
Without expand
useGetUser()
With expand
useGetUser({ expand: ['company'] })
I'm wondering how it'd be best to automatically type this depending on if the expand param is provided (note that you could expand multiple attributes). Currently we are just doing user.company as Company but that isn't ideal for obvious reasons.
I'd be happy to contribute to the repo but I wanted to get some feedback on how it'd be implemented in the cleanest way.
Beta Was this translation helpful? Give feedback.
All reactions