-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
I am currently using your library for type-safe decoding of API responses, which sometimes contain arrays of items. In its current implementation, the D.array
decoder will throw an error if any of the items in the array fail to decode against the provided schema, like so:
export const item: D.Decoder<Item> = D.object({
id: D.uuidv4,
title: D.string,
});
export const paginatedItems: D.Decoder<PaginatedResponse<Item>> = D.object({
results: D.array(item),
next_page: D.optional(D.nullable(D.string)),
});
I'd like to propose a feature where the array decoder has a "resilient" or "filter" mode that continues decoding despite individual errors, collects these errors separately, and omits the failing items from the resulting array. This could provide a more user-friendly, error-resilient approach while still being within the bounds of the library's design philosophy.
Metadata
Metadata
Assignees
Labels
No labels