Change validator so root resource id is not in the same space as all other ids
This commit is contained in:
parent
3e49000188
commit
7400263b86
|
@ -695,10 +695,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
|
||||
long t = System.nanoTime();
|
||||
if (profiles == null || profiles.isEmpty()) {
|
||||
validateResource(new ValidatorHostContext(appContext, element), errors, element, element, null, resourceIdRule, new NodeStack(context, element, validationLanguage));
|
||||
validateResource(new ValidatorHostContext(appContext, element), errors, element, element, null, resourceIdRule, new NodeStack(context, element, validationLanguage).resetIds());
|
||||
} else {
|
||||
for (StructureDefinition defn : profiles) {
|
||||
validateResource(new ValidatorHostContext(appContext, element), errors, element, element, defn, resourceIdRule, new NodeStack(context, element, validationLanguage));
|
||||
validateResource(new ValidatorHostContext(appContext, element), errors, element, element, defn, resourceIdRule, new NodeStack(context, element, validationLanguage).resetIds());
|
||||
}
|
||||
}
|
||||
if (hintAboutNonMustSupport) {
|
||||
|
@ -3953,8 +3953,10 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (stack.getIds().containsKey(id) && stack.getIds().get(id) != element) {
|
||||
rule(errors, IssueType.BUSINESSRULE, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.DUPLICATE_ID, id);
|
||||
}
|
||||
if (!stack.isResetPoint()) {
|
||||
stack.getIds().put(id, element);
|
||||
}
|
||||
}
|
||||
if (definition.getPath().equals("StructureDefinition.snapshot")) {
|
||||
// work around a known issue in the spec, that idsa are duplicated in snapshot and differential
|
||||
stack.resetIds();
|
||||
|
|
|
@ -26,6 +26,7 @@ public class NodeStack {
|
|||
private ElementDefinition type;
|
||||
private String workingLang;
|
||||
private Map<String, Element> ids;
|
||||
private boolean resetPoint = false;
|
||||
|
||||
public NodeStack(IWorkerContext context) {
|
||||
this.context = context;
|
||||
|
@ -147,6 +148,7 @@ public class NodeStack {
|
|||
|
||||
public NodeStack resetIds() {
|
||||
ids = new HashMap<>();
|
||||
resetPoint = true;
|
||||
return this;
|
||||
}
|
||||
public Map<String, Element> getIds() {
|
||||
|
@ -178,5 +180,9 @@ public class NodeStack {
|
|||
|
||||
}
|
||||
|
||||
public boolean isResetPoint() {
|
||||
return resetPoint;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue