Skip to content

Chaining codecs #1286

@kamilkloch

Description

@kamilkloch

In this api: https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder
a 200 respose can be of 2 unrelated shapes: successful response, or a (business) error response.
The most straightforward way to model it is via Either[ErrorResponse, BuySellOrderResponse].
Unfortunately, currently there is no possibility to derive codec for Either[A, B] given codecs for A and B, or to chain codecs via fallbackTo.

Arguably, such functionalliy drastically lowers the bar for writing custom codecs. Sometimes, a small performance penalty in exchange for easy code is the price the user agrees to pay. And, for ultimate performance, there always remains an option to write a custom low-level codec.

Relates to #1139, #1269

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions