Skip to content

Auto should not use implicit conversion functions #45

@ncreep

Description

@ncreep

Hi,

Currently io.fintrospect.formats.Auto uses implicit functions in various methods. E.g.:

def Out[OUT](svc: Service[Request, OUT], successStatus: Status = Status.Ok)
            (implicit transform: OUT => R): Service[Request, Response]

This can be problematic, for example in cases where one is trying to serialize raw JSON (e.g., Play's JsValue). Since in this case OUT =:= R , and Fintrospect's built-in implicit conversion competes with the standard library's <:< (which extends Function1).

The workaround for this particular problem is to pass the implicit argument explicitly. But a more general solution would be to introduce a dedicated type for the conversions that take place in Auto. This will avoid polluting the implicit scope with a common type and thus won't compete with the standard library (or anything else for that matter).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions