Re:Software Architecture Patterns: 5 minute read
by 5e92cb50239222b on Thursday October 28, 2021 @11:14AM
(#29027072)
> in the domain model you have a user with email but do not want to expose the email.
You can usually configure that out with @JsonIgnore or something like that. Although this works only for this particular (very simple) example and won't help with e.g. flattening multiple nested objects.
Re:Software Architecture Patterns: 5 minute read
by williamdclt on Thursday October 28, 2021 @12:22PM
(#29027823)
At this point you already have 2 "models", in the sense of 2 "concepts" or 2 "types": the one with the field and the one without. The second one is implicitly defined with these annotations, which has a good chance to be annoying sooner or later when you need it to be explicit.
Re:Software Architecture Patterns: 5 minute read
by kgeist on Thursday October 28, 2021 @02:52PM
(#29029959)
>If you add a property which shouldn't be public you have to separate them. For example in the domain model you have a user with email but do not want to expose the email.
Another possible problem: having to support two versions of the API at the same time.
If you add a property which shouldn't be public you have to separate them. For example in the domain model you have a user with email but do not want to expose the email.
Second argument: I usually create a simple struct for each method. For example I do not want, that they provide the id for post requests. I want to send the id on get requests so that they can send an update request with the id. I prefer only "non-null" arguments and as a bonus you get a clean (auto-generated) api documentation.