Add ability to use urlKeys
with serializers, improve DX around parser "groups"
#689
-
In our codebase we work with serializers a lot to create A further thought that came to mind was an API that would allow us to create a group of parsers that has group-level configuration: const parsers = createParsers(
{
page: parseAsInteger,
size: parseAsInteger,
sort: parseAsCustomSortObject,
query: parseAsString
},
{ urlKeys: { query: "q" } }
) It would be nice if this parsers object could be use isomorphically when creating a serializer, or in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I like this idea! We could potentially make the urlKey a function to process the internal keys, so you could implement your kebab-case proposal in #688 this way: const parsers = createParsers(
{
commentsAfter: parseAsString,
commentCount: parseAsInteger,
},
{ urlKeys: makeKebabCase }
);
// Not sure what would be the most practical type for input & output here:
function makeKebabCase(input: ??): ?? |
Beta Was this translation helpful? Give feedback.
-
urlKeys support for the serializer is being worked on in #720, and should land in 2.1.0. |
Beta Was this translation helpful? Give feedback.
urlKeys support for the serializer is being worked on in #720, and should land in 2.1.0.