Skip to content

Dealing with empty object from API service #642

Open
@Rizary

Description

@Rizary

Hi, what is the best to handle when we got name: {} (this is from nodejs backend) response from api service, meanwhile what i want is to assume it is 'name: {first: "", last: ""}` so I can parse it to
Person {firstName :: Maybe Text, lastName :: Maybe Text} ?

supposed that I have the following types:
https://gist.github.com/Rizary/3b3865a145853cf04df7fad4e348a5c3

I finally use optional but actually that's not what I want, because I can't parsed the name: {} as name: {first: "", last: ""}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions