summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-03-09 14:22:28 +0000
committerArne H Juul <arnej@yahooinc.com>2022-03-09 19:10:27 +0000
commit23cc27e4c62849519cbca35cfc56194bce6bd041 (patch)
treea7d8dc1906be634f20a6168fbb13337f0fbf0527 /config-model/src/main/java/com/yahoo
parent0fb4a25549effe0340b8422c938a54a832379c6a (diff)
move check for nested document types
* only fail if we can't handle it when resolving temporaries
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
index 2cbaebbb79b..117dc0c78fc 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentModelBuilder.java
@@ -245,7 +245,15 @@ public class DocumentModelBuilder {
if (other != null) {
type = other;
}
- } else if (type instanceof DocumentType || type instanceof NewDocumentType) {
+ } else if (type instanceof DocumentType) {
+ DataType other = getDocumentType(docs, type.getId());
+ if (other != null) {
+ type = other;
+ } else if (! type.getName().equals("document")) {
+ throw new IllegalArgumentException
+ ("Can not handle nested document definitions. Undefined document type: " + type.toString());
+ }
+ } else if (type instanceof NewDocumentType) {
DataType other = getDocumentType(docs, type.getId());
if (other != null) {
type = other;
@@ -413,9 +421,6 @@ public class DocumentModelBuilder {
if (type instanceof StructDataType) {
StructDataType tmp = (StructDataType) type;
extractDataTypesFromFields(tmp.getFieldsThisTypeOnly());
- } else if (type instanceof DocumentType) {
- throw new IllegalArgumentException("Can not handle nested document definitions. In document type '" + targetDt.getName().toString() +
- "', we can not define document type '" + type.toString());
} else if (type instanceof CollectionDataType) {
CollectionDataType tmp = (CollectionDataType) type;
extractNestedTypes(tmp.getNestedType());