-
Notifications
You must be signed in to change notification settings - Fork 181
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
Default account configuration and account status support #959
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, probably we can add in documentation that we don't merge inner object (gdpr and analytics-config) we use default OR received.
import org.prebid.server.settings.model.AccountStatus; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
@Validated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this annotation required ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. It's been copied along with other annotations that we put on Spring configuration properties POJOs but apparently there are no constraints imposed on any fields in this class so it's redundant. We may put sensible constraints in future and easily overlook adding @Validated
annotation though so I'm hesitant about this one.
|
||
private Boolean enforceCcpa; | ||
|
||
private String gdpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why cant we use AccountGdprConfig class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't want to add @Data @NoArgsConstructor
annotations to AccountGdprConfig
, i.e. make it a Spring configuration properties POJO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably you mean AccountAnalyticsConfig
because AccountGdprConfig
is already have this annotation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. AccountGdprConfig
shouldn't have had these annotations in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably my mistake. I copy from GdprConfig which we get from yaml.
But why we don't want to make this @DaTa ? Because of mutability ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a convention for value objects throughout PBS codebase to aspire for immutability unless it is impractical.
Another reason to take into consideration - using AccountGdprConfig
to represent data in two different places (PBS configuration and account configuration in DB/file/etc) strongly couples these sources and forces changes in one place (account config for example) to affect another place (PBS config) and vice versa. Actually This is what Single Responsibility Principle is called to protect from.
|
||
public Account merge(Account another) { | ||
return Account.builder() | ||
.id(ObjectUtils.firstNonNull(id, another.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor. i'd rather suggest to use ObjectUtils.defaultIfNull(..)
instead since we have only 2 possible values.
* Add support for default account configuration values in application config * Take into consideration account status * Update documentation * Address review comments
* Add support for default account configuration values in application config * Take into consideration account status * Update documentation * Address review comments
* Add support for default account configuration values in application config * Take into consideration account status * Update documentation * Address review comments
No description provided.