mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-07 21:38:15 +00:00
revise validation of resource and element id
This commit is contained in:
parent
b3b43c17d1
commit
3cb384a297
@ -118,7 +118,7 @@ Reference_REF_NoType = Unable to determine type of target resource
|
||||
Reference_REF_NotFound_Bundle = Bundled or contained reference not found within the bundle/resource {0}
|
||||
Reference_REF_ResourceType = Matching reference for reference {0} has resourceType {1}
|
||||
Reference_REF_WrongTarget = The type ''{0}'' is not a valid Target for this element (must be one of {1})
|
||||
Resource_RES_ID_Malformed = Resource id not formatted correctly
|
||||
Resource_RES_ID_Malformed = Invalid Resource id
|
||||
Resource_RES_ID_Missing = Resource requires an id, but none is present
|
||||
Resource_RES_ID_Prohibited = Resource has an id, but none is allowed
|
||||
Terminology_PassThrough_TX_Message = {0} for ''{1}#{2}''
|
||||
|
@ -2056,7 +2056,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type.equals(ID)) {
|
||||
if (type.equals(ID) && !"Resource.id".equals(context.getBase().getPath())) {
|
||||
// work around an old issue with ElementDefinition.id
|
||||
if (!context.getPath().equals("ElementDefinition.id")) {
|
||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, FormatUtilities.isValidId(e.primitiveValue()), I18nConstants.TYPE_SPECIFIC_CHECKS_DT_ID_VALID, e.primitiveValue());
|
||||
@ -5173,10 +5173,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.RESOURCE_RES_ID_MISSING);
|
||||
} else if (idstatus == IdStatus.PROHIBITED && (element.getNamedChild(ID) != null)) {
|
||||
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.RESOURCE_RES_ID_PROHIBITED);
|
||||
} else if ((idstatus == IdStatus.OPTIONAL || idstatus == IdStatus.REQUIRED)
|
||||
&& (element.getNamedChild(ID) != null)
|
||||
&& (!idFormattedCorrectly(element.getNamedChild(ID).getValue()))) {
|
||||
rule(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, I18nConstants.RESOURCE_RES_ID_MALFORMED);
|
||||
}
|
||||
if (element.getNamedChild(ID) != null) {
|
||||
Element eid = element.getNamedChild(ID);
|
||||
if (eid.getProperty() != null && eid.getProperty().getDefinition() != null && eid.getProperty().getDefinition().getBase().getPath().equals("Resource.id")) {
|
||||
NodeStack ns = stack.push(eid, -1, eid.getProperty().getDefinition(), null);
|
||||
rule(errors, IssueType.INVALID, eid.line(), eid.col(), ns.getLiteralPath(), idFormattedCorrectly(eid.getValue()), I18nConstants.RESOURCE_RES_ID_MALFORMED);
|
||||
}
|
||||
}
|
||||
start(hostContext, errors, element, element, defn, stack); // root is both definition and type
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user