aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2024-05-29 18:02:54 +0200
committerHarald Musum <musum@yahooinc.com>2024-05-29 18:02:54 +0200
commitd6b25c5ce597a5fe7a24c93f5de43c8ccfc52390 (patch)
treedaa06141037b30eb7cb823e4a61f2f22f1b01b2a /config-model/src
parent060e2353bf92e7b6933ad6e6b91ba9ffd8a59230 (diff)
Only log application package warning if inheriting from default summary
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/schema/Schema.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java9
2 files changed, 8 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/Schema.java b/config-model/src/main/java/com/yahoo/schema/Schema.java
index 6dd8e739d92..127d12594b4 100644
--- a/config-model/src/main/java/com/yahoo/schema/Schema.java
+++ b/config-model/src/main/java/com/yahoo/schema/Schema.java
@@ -728,7 +728,7 @@ public class Schema implements ImmutableSchema {
"', but its document type does not inherit the parent's document type");
}
for (var summary : summaries.values())
- summary.validate();
+ summary.validate(logger);
}
/** Returns true if the given field name is a reserved name */
diff --git a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
index c989eeb49cd..9e596ae27d2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
+++ b/config-model/src/main/java/com/yahoo/vespa/documentmodel/DocumentSummary.java
@@ -1,6 +1,7 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.documentmodel;
+import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.schema.Schema;
import java.util.ArrayList;
@@ -9,6 +10,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import static java.util.logging.Level.WARNING;
+
/**
* A document summary definition - a list of summary fields.
*
@@ -116,10 +119,12 @@ public class DocumentSummary extends FieldView {
return "document-summary '" + getName() + "'";
}
- public void validate() {
+ public void validate(DeployLogger logger) {
for (var inheritedName : inherited) {
var inheritedSummary = owner.getSummary(inheritedName);
- if (inheritedSummary == null && ! inheritedName.equals("default"))
+ if (inheritedName.equals("default"))
+ logger.logApplicationPackage(WARNING, this + " inherits '" + inheritedName + "', which makes no sense. Remove this inheritance");
+ else if (inheritedSummary == null )
throw new IllegalArgumentException(this + " inherits '" + inheritedName + "', but this is not present in " + owner);
}
}