Skip to content

Add support for object deserialization #9

@BusHero

Description

@BusHero

Add support for object deserialization

I want to be able to create parsers of such a form:

Parser.ParseObject(propertyName => propertyName switch
{
    "object" => from _ in Parser.ParseString("list")
                select Func.Updater<NavigationPage<TItem>>(Func.Id),
    "results" => from results in Parser.ParseType<TItem[]>()
                 select Func.Updater<NavigationPage<TItem>>(page => page with { Results = results }),
    "next_cursor" => from nextCursor in Parser.OptionalGuid
                     select Func.Updater<NavigationPage<TItem>>(page => page with { NextCursor = nextCursor }),
    "has_more" => from hasMore in Parser.Bool
                  select Func.Updater<NavigationPage<TItem>>(page => page with { HasMore = hasMore }),
    _ => Parser.FailedUpdater<NavigationPage<TItem>>()
})

Metadata

Metadata

Assignees

Labels

featureNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions