mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 06:14:45 +00:00
fix validation of conditional references
This commit is contained in:
parent
b38c8c3ae7
commit
76a3129b30
@ -774,6 +774,7 @@ public class I18nConstants {
|
||||
public static final String EXT_VER_URL_REVERSION = "EXT_VER_URL_REVERSION";
|
||||
public static final String ILLEGAL_COMMENT_TYPE = "ILLEGAL_COMMENT_TYPE";
|
||||
public static final String SD_NO_SLICING_ON_ROOT = "SD_NO_SLICING_ON_ROOT";
|
||||
public static final String REFERENCE_REF_QUERY_INVALID = "REFERENCE_REF_QUERY_INVALID";
|
||||
}
|
||||
|
||||
|
||||
|
@ -824,5 +824,6 @@ EXT_VER_URL_NOT_ALLOWED = The extension URL must not contain a version
|
||||
EXT_VER_URL_REVERSION = The extension URL must not contain a version. The extension was validated against version {0} of the extension
|
||||
ILLEGAL_COMMENT_TYPE = The fhir_comments property must be an array of strings
|
||||
SD_NO_SLICING_ON_ROOT = Slicing is not allowed at the root of a profile
|
||||
REFERENCE_REF_QUERY_INVALID = The query part of the conditional reference is not a valid query string ({0})
|
||||
|
||||
|
@ -3262,6 +3262,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||
refType = "bundled";
|
||||
}
|
||||
}
|
||||
boolean conditional = ref.contains("?") && Utilities.existsInList(ref.substring(0, ref.indexOf("?")), context.getResourceNames());
|
||||
ReferenceValidationPolicy pol;
|
||||
if (refType.equals("contained") || refType.equals("bundled")) {
|
||||
pol = ReferenceValidationPolicy.CHECK_VALID;
|
||||
@ -3273,7 +3274,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||
}
|
||||
}
|
||||
|
||||
if (pol.checkExists()) {
|
||||
if (conditional) {
|
||||
String query = ref.substring(ref.indexOf("?"));
|
||||
boolean test = !Utilities.noString(query) && query.matches("\\?([_a-zA-Z][_a-zA-Z0-9]*=[^=&]+)(&([_a-zA-Z][_a-zA-Z0-9]*=[^=&]+))*");
|
||||
//("^\\?([\\w-]+(=[\\w-]*)?(&[\\w-]+(=[\\w-]*)?)*)?$"),
|
||||
ok = rule(errors, "2023-02-20", IssueType.INVALID, element.line(), element.col(), path, test, I18nConstants.REFERENCE_REF_QUERY_INVALID, ref) && ok;
|
||||
|
||||
} else if (pol.checkExists()) {
|
||||
if (we == null) {
|
||||
if (!refType.equals("contained")) {
|
||||
if (fetcher == null) {
|
||||
|
@ -79,3 +79,13 @@ v: {
|
||||
"system" : "http://unitsofmeasure.org"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
{"code" : {
|
||||
"system" : "http://unitsofmeasure.org",
|
||||
"code" : "cm"
|
||||
}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"false"}####
|
||||
v: {
|
||||
"display" : "cm",
|
||||
"code" : "cm",
|
||||
"system" : "http://unitsofmeasure.org"
|
||||
}
|
||||
-------------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user