Skip to content

Support unpacking/packing of props #217

@birnbuazn

Description

@birnbuazn

We often have the situation, where a more complex domain model must be mapped to an api with a flat request/response model.

For example:

data class Car(
  val engine: Engine
  val numberOfWheels: Int
)

data class Engine(
  val horsePower: Int
)

should be mapped to

data class CarResponse(
  val horsePower: Int
  val numberOfWheels: Int
)

I didn't find an easy way to tell Mappie, that I want all properties of the child (Engine) mapped to the response (CarResponse) .

It might be easy/obvious in this case to just map this single property, but things get a little unwieldy, if there are a lot of child properties involved.

Same is true the other way round as well. Imagine a flat request model, which has to be mapped to a more structured domain model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions