Replies: 3 comments
|
Agreed. I'm actually having to write an extra function to map the keys just to keep the API consistent for the FE |
0 replies
|
Sure, please send over a PR 👍🏽 |
0 replies
|
Hey, I also needed this feature, so I implemented it in this PR Happy to adjust it if there’s a better approach 👍 |
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 ! 🙂
All reactions