Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • No, can just use User for everything Commented Oct 12, 2024 at 16:28
  • @Ewan That makes no sense to me. I can't provide my internal User to external APIs, otherwise they can just access all secret fields and change passwords and whatever. Also I can't even transmit it over protocols like HTTP like that, I need to convert it to JSON first anyways? Commented Oct 12, 2024 at 16:40
  • Why do you consider it problematic to create custom types for each specific request? Especially in this day and age, AI easily creates exactly the DTOs and mappers for your needs in seconds. Are you facing any issues with your approach? Commented Oct 12, 2024 at 17:49
  • @RikD That's a good question I haven't really considered. I guess I just find it cumbersome, repetitive boilerplate? There have been no other issues thus far, I guess I'm just looking for a better alternative, not really a "fix". Commented Oct 12, 2024 at 17:55
  • IMO the issue I see here is a focus on data rather than behavior. It may seem insignificant but something like CreateUserRequest or UserInfo conveys a lot more information and feels more intentional even if the data is the same. DTOs like you've defined them have a way of become grab bags of data because they don't have a "place" and aren't part of a bigger picture. Commented Oct 26, 2024 at 2:27