-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix SQL config defaults and validation #3456
Conversation
Hey @jnsrnhld ich habe das gerade zum ersten Mal gesehen: https://projectlombok.org/features/experimental/Jacksonized Ein Test mit: @Data
@Jacksonized
@Builder
public class DatabaseConfig {
private static final String DEFAULT_PRIMARY_COLUMN = "pid";
private Dialect dialect;
private String databaseUsername;
private String databasePassword;
private String jdbcConnectionUrl;
@Builder.Default
private String primaryColumn = DEFAULT_PRIMARY_COLUMN;
} und class Scratch {
public static void main(String[] args) throws IOException {
final DatabaseConfig databaseConfig = Jackson.MAPPER.reader().readValue("{}", DatabaseConfig.class);
System.out.println(databaseConfig);
}
} printet:
|
backend/src/main/java/com/bakdata/conquery/models/config/SqlConnectorConfig.java
Outdated
Show resolved
Hide resolved
@@ -41,7 +41,7 @@ public class Table extends Labeled<TableId> implements NamespacedIdentifiable<Ta | |||
*/ | |||
@Nullable | |||
@JsonManagedReference | |||
private Column primaryColum; | |||
private Column primaryColumn; |
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.
👌
import lombok.extern.slf4j.Slf4j; | ||
import org.jooq.Field; | ||
import org.jooq.impl.DSL; | ||
|
||
@Slf4j |
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.
Sind hier logs dazugekommen? Ich sehe keinen logger im Diff
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.
Nein, hatte ich nur zum Debugging drin und vergessen wieder raus zu nehmen.
Sehr cooler Fund mit dem |
…nnectorConfig.java Co-authored-by: MT <12283268+thoniTUB@users.noreply.github.com>
Denkst du, es ergibt Sinn, in den Configs Konstruktoren einzuführen, die auf die default-Werte Rücksicht nehmen, z.B. so:
Oder gibt es dafür eine elegantere Lösung? Mir war das vorher nicht so klar, dass Jackson die defaults (lombok Builder.Default, aber auch statische Werte) nicht einfach übernimmt.