Automapper solves this. Composable projections to your DTOs/ endpoint return types. You can do some very powerful things with it. For example, in a past project I encrypted/unencrypted a property containing a secure message by defining a function to do so and setting up Automapper to automatically apply the function when mapping to/from the DTO that is sent/received by the API.