Questions tagged [dto]
Data Transfer Objects are for moving data between processes.
99 questions
0 votes
2 answers
195 views
Is exposing full backend entities to a Vue frontend a bad practice? A case for DTOs?
I am doing the frontend for a Java Spring backend. The project uses JavaFX for the front but I a migrating it for web usage (with VueJS). When I make an API call to retrieve an object, I am receiving ...
2 votes
0 answers
151 views
When Should We Separate DTOs from REST API Serialization Classes? [closed]
We know that combining a domain entity, a DTO, and a REST API serialization class into one won't pass code review: @JsonInclude(JsonInclude.Include.NON_NULL) @Data @Builder @Entity @Table(name = "...
1 vote
3 answers
605 views
Autogenerate DTO classes?
Yesterday I screwed up: One of the classes of my C# contained a property, called "DeliverdQuantity" (yep, there's a spelling mistake indeed). When I saw that, I decided to correct that, ...
1 vote
1 answer
216 views
DTOs and Single-responsibility principle
I'm developing a PHP application and trying to understand DTOs in context of single-responsibility principle. Being more specific, is it a bad practice having helper methods like toArray(), getValue(),...
3 votes
4 answers
2k views
Is it a code smell to modify a data transfer object (DTO) within a loop in a Spring service controller?
I have a Spring service that acts as an adapter for another service in my company. The service receives a request to generate push notifications for a given user and needs to call the other service ...
2 votes
1 answer
384 views
How to properly use Data Transfer Objects
I feel something is wrong with my approach handling MVP and the Repository Pattern. I'm making an album winform app just to practice MVP, crud and the Repos. Pattern. First some code. The model: using ...
1 vote
2 answers
2k views
Is it OK to return different DTOs for the same endpoint when the user is logged in vs when it is anonymous?
Say that I have a REST endpoint for a chess server. If I'm not logged in and do a GET on /games I could get all running games like: { running_games: [ ..... ] } but if I'm logged in I ...
0 votes
3 answers
2k views
CRUD service with or without DTOs
I'm about to create a service providing a simple CRUD Json REST-API. The main requirement is that documents stored/received always conform to a schema provided as JSON schema. So here's the thing: ...