Questions tagged [dto]
Data Transfer Objects are for moving data between processes.
99 questions
0
votes
2
answers
186
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 ...
0
votes
2
answers
165
views
How could I map a complex DTO to a Domain Aggregate in a Repository?
I'm working on a TypeScript application designed with DDD and using layered architecture. My infra layer has a repository that fetches a complex, nested DTO. My current implementation maps this DTO ...
2
votes
0
answers
145
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 = "...
0
votes
3
answers
480
views
Do I really need this many (DTO) types for mapping a simple object to CRUD & database?
Say I'm building my own backend framework (really I'm just learning) and I have a simple class:
class User {
String email
String passwordHash
Date birthdate
Int getAge() {
...
1
vote
3
answers
579
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, ...
0
votes
1
answer
427
views
DTO Interfaces naming convention in PHP
It might be that my question would sound a bit stupid but I would like to find the best way for naming my DTO interfaces. In my PHP application I have following DTO types:
Simple (which contains a ...
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(),...
1
vote
5
answers
1k
views
DTO vs POJO (Entity) on POST request
If I have for example a User POJO like the following
@AllArgsConstructor
public class User {
@Id
private final String id;
private String username;
private String password;
private Date createdDate;...
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 ...
1
vote
4
answers
3k
views
Validating data classes with nullable properties that should never be null
When retreiving data with an api and saving it in a DTO, some values are nullable: null on initial class initialization but VS also warns you for this. For example, an employee:
public class ...
2
votes
1
answer
378
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 ...
0
votes
1
answer
3k
views
Three layer architecture and using DTOs to transfer data between layers
I have a 3 layer architecture application with presentation layer, business layer and data access layer. UI -> BLL -> DAL UI Layer has reference to only BLL and BLL refer only to DAL.
My BLL has ...
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 ...
-1
votes
1
answer
504
views
Do usecase-class work with domain-model or data-model at cleanarchitecture?
I interessted in the "usecases" and "how they interacts with the "context" at "clean architecture".
If I understand right, there will be two contexts.
First is the ...
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:
...