Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Unify DTOs for normal/verbose model #676

Merged

Conversation

martinfkaeser
Copy link
Contributor

@martinfkaeser martinfkaeser commented Dec 6, 2023

Verbose DTOs, like PhysicalPostalAddressVerboseDto or LegalEntityVerboseDto, are very tricky to integrate in our DTO interface hierarchy, because although they have the same properties, some properties have a completely different type (String vs some generic TypeKeyNameVerboseDto) and so don't allow easy sub-classing. As a workaroud we sometimes leave the type completely undefined (Any) or the verbose classes stay completely unrelated to the normal classes.

This PR proposes a solution:
With this a verbose DTO can be a subtype of its non-verbose version both containing full type information. In the Kotlin model the verbose property is a separate field (e.g. "typeVerbose") from which the key field (e.g. "type") is derived using a property getter. Just for the API model this separate field is renamed to the base name using @JsonProperty and @JsonIgnore.
The custom DataClassUnwrappedJsonDeserializer had to be adjusted that it now supports @JsonProperty.

This PR concludes #570

@martinfkaeser martinfkaeser force-pushed the refactor/UnifyNormalVerboseDTOs branch from 7f7ef3d to 5a5d655 Compare December 8, 2023 11:05
@martinfkaeser martinfkaeser changed the title Refactor: Unify postal address for normal/verbose model Refactor: Unify DTOs for normal/verbose model Dec 8, 2023
@martinfkaeser martinfkaeser marked this pull request as ready for review December 8, 2023 11:16
@nicoprow nicoprow merged commit 4f6bc2a into eclipse-tractusx:main Dec 12, 2023
9 checks passed
@nicoprow nicoprow deleted the refactor/UnifyNormalVerboseDTOs branch December 12, 2023 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants