Replies: 2 comments
-
|
Agreed. I'm actually having to write an extra function to map the keys just to keep the API consistent for the FE |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Sure, please send over a PR 👍🏽 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently, when serializing a Paginator, the pagination metadata is always output under the hardcoded key "metadata":
{ "data": [...], "metadata": { // always hardcoded ... } }This key cannot be changed, which is problematic because:
Proposed solution
Add a MetadataKey property to BaseSerializer, mirroring the existing wrap property, with a default value of "metadata".
The Wrappers generic should be extended with a MetadataKey type parameter so that the output type is fully inferred:
Happy to open a PR with these changes if the idea sounds good to you !
The transformer pattern is really a good idea ! 🙂
Beta Was this translation helpful? Give feedback.
All reactions