Questions tagged [dto]
Data Transfer Objects are for moving data between processes.
97 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
2
votes
0
answers
138
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
410
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
495
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
344
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
184
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
347
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
2k
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
475
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:
...
0
votes
1
answer
1k
views
Mapping destination object from multiple source objects vs constructing using multiple source objects (as in constructor)
Lets say we have DTO class with 15 properties. Usually DTOs like these are mapped from other objects. But sometimes some DTOs may use values from multiple objects. In these cases, should we "Map" or "...
0
votes
0
answers
412
views
.Net Core Api - multiple Dto’s for single entity
I want to know the best Practice is about having multiple dto’s for different use cases.
Let’s say we have an api with a set of controllers to handle requests coming from a administration backend and ...