Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,25 @@ private String discriminator(Node node) {
.append(")")
.append( ")");
}
} else if (DiscriminatorType.Value.EXISTS.equals(key)) {
// TODO support more than one?
String path = paths.get(0);

String id = "$this".equals(path) ?
elementDefinition.getId() :
elementDefinition.getId() + "." + path;

String snippet = path + ".exists()";
// The slices are differentiated by the fact that one must have a max of 0
ElementDefinition existsTarget = elementDefinitionMap.get(id);
if ("0".equals(existsTarget.getMax().getValue())) {
snippet += ".not()";
}

sb.append(identifier)
.append(".where(")
.append(snippet)
.append(")");
}
}
if (identifier.equals(sb.toString())) {
Expand Down