convert DocumentType to NewDocumentType inside reference
@@ -291,9 +291,17 @@ public class DocumentModelBuilder {
}
else if (type instanceof ReferenceDataType) {
ReferenceDataType t = (ReferenceDataType) type;
- if (t.getTargetType() instanceof TemporaryStructuredDataType) {
- DataType targetType = resolveTemporariesRecurse(t.getTargetType(), repo, docs, replacements);
+ var tt = t.getTargetType();
+ if (tt instanceof TemporaryStructuredDataType) {
+ DataType targetType = resolveTemporariesRecurse(tt, repo, docs, replacements);
t.setTargetType((StructuredDataType) targetType);
+ } else if (tt instanceof DocumentType) {
+ DataType targetType = resolveTemporariesRecurse(tt, repo, docs, replacements);
+ // super ugly, the APIs for this are horribly inconsistent
+ var tmptmp = TemporaryStructuredDataType.create(tt.getName());
+ var tmp = new ReferenceDataType(tmptmp, t.getId());
+ tmp.setTargetType((StructuredDataType) targetType);
+ type = tmp;
}
}
if (type != original) {
