kapilpanchal123 commented on code in PR #5126: URL: https://github.com/apache/fineract/pull/5126#discussion_r2465455103
########## fineract-core/src/main/java/org/apache/fineract/portfolio/account/data/AccountTransferRequest.java: ########## @@ -0,0 +1,79 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.account.data; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import java.io.Serial; +import java.io.Serializable; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.apache.fineract.validation.constraints.Locale; + +@Getter +@Setter +@NoArgsConstructor +public class AccountTransferRequest implements Serializable { Review Comment: > "The API DTO to Service DTO is the same object,"-> But it SHOULD NOT! Service layer DTO and API layer DTO many situations has different datatype (see "date" of BusinessDateDTO and "date" of BusinessDateUpdateRequest), and ALWAYS has different annotations! For example @LocalDate(dateField = "date", formatField = "dateFormat", localeField = "locale") is there on BusinessDateUpdateRequest to enforce bean validation, which is not applicable for BusinessDateUpdateRequest. > > I hope it helps to understand better why i am saying API layer DTOs (request and response) MUST BE different than service layer DTO. These DTOs are for different purposes with different configuration! They should not be mixed! I think this is where the importance of typesafety comes in, as we are not dealing with JsonStrings which are then parsed and validated at a later stage. The request and response objects the filtering is happening right before the API logic is executed. Jakarta validation. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
