mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-03 09:59:10 +00:00
change error to warning for extension frrom different version because context might change between versions
This commit is contained in:
parent
598fb19d8e
commit
861a0ee706
@ -30,6 +30,8 @@ public class XVerExtensionManager {
|
||||
BadVersion, Unknown, Invalid, Valid
|
||||
}
|
||||
|
||||
public static final String XVER_EXT_MARKER = "XVER_EXT_MARKER";
|
||||
|
||||
private Map<String, JsonObject> lists = new HashMap<>();
|
||||
private IWorkerContext context;
|
||||
|
||||
@ -81,6 +83,7 @@ public class XVerExtensionManager {
|
||||
JsonObject path = root.getAsJsonObject(e);
|
||||
|
||||
StructureDefinition sd = new StructureDefinition();
|
||||
sd.setUserData(XVER_EXT_MARKER, "true");
|
||||
sd.setUrl(url);
|
||||
sd.setVersion(context.getVersion());
|
||||
sd.setFhirVersion(FHIRVersion.fromCode(context.getVersion()));
|
||||
|
@ -26,6 +26,7 @@ public class I18nConstants {
|
||||
public final static String CODESYSTEM_CS_VS_MISMATCH = "CodeSystem_CS_VS_MisMatch";
|
||||
public final static String CODESYSTEM_CS_VS_WRONGSYSTEM = "CodeSystem_CS_VS_WrongSystem";
|
||||
public final static String EXTENSION_EXT_CONTEXT_WRONG = "Extension_EXT_Context_Wrong";
|
||||
public final static String EXTENSION_EXT_CONTEXT_WRONG_XVER = "EXTENSION_EXT_CONTEXT_WRONG_XVER";
|
||||
public final static String EXTENSION_EXT_COUNT_MISMATCH = "Extension_EXT_Count_Mismatch";
|
||||
public final static String EXTENSION_EXT_COUNT_NOTFOUND = "Extension_EXT_Count_NotFound";
|
||||
public final static String EXTENSION_EXT_FIXED_BANNED = "Extension_EXT_Fixed_Banned";
|
||||
|
@ -497,4 +497,5 @@ TYPE_SPECIFIC_CHECKS_DT_BASE64_TOO_LONG = Base64 size is {0} bytes which exceeds
|
||||
TYPE_SPECIFIC_CHECKS_DT_DECIMAL_CHARS = Found {0} decimal places which exceeds the stated limit of {1} digits
|
||||
Validation_VAL_Profile_WrongType = Specified profile type was "{0}", but found type "{1}"
|
||||
Validation_VAL_Profile_WrongType2 = Type mismatch processing profile {0} at path {1}: The element type is {4}, but the profile {3} is for a different type {2}
|
||||
VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = Illegal constraint in profile {0} at path {1} - cannot constrain to type {2} from base types {3}
|
||||
VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = Illegal constraint in profile {0} at path {1} - cannot constrain to type {2} from base types {3}
|
||||
EXTENSION_EXT_CONTEXT_WRONG_XVER = The extension {0} from FHIR version {3} is not allowed to be used at this point (allowed = {1}; this element is [{2}; this is a warning since contexts may be renamed between FHIR versions)
|
||||
|
@ -10,6 +10,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class PackageCacheTests {
|
||||
|
||||
@ -17,7 +18,11 @@ public class PackageCacheTests {
|
||||
public void testPath() throws IOException {
|
||||
PackageCacheManager cache = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
|
||||
cache.clear();
|
||||
Assertions.assertTrue(cache.listPackages().isEmpty());
|
||||
List<String> list = cache.listPackages();
|
||||
if (!list.isEmpty()) {
|
||||
System.out.println("remaining packages: "+list.toString());
|
||||
}
|
||||
Assertions.assertTrue(list.isEmpty());
|
||||
NpmPackage npm = cache.loadPackage("hl7.fhir.pubpack", "0.0.3");
|
||||
npm.loadAllFiles();
|
||||
Assertions.assertNotNull(npm);
|
||||
@ -30,6 +35,7 @@ public class PackageCacheTests {
|
||||
npm.save(dir);
|
||||
NpmPackage npm2 = cache.loadPackage("hl7.fhir.pubpack", "file:" + dir.getAbsolutePath());
|
||||
Assertions.assertNotNull(npm2);
|
||||
Assertions.assertFalse(cache.listPackages().isEmpty());
|
||||
list = cache.listPackages();
|
||||
Assertions.assertFalse(list.isEmpty());
|
||||
}
|
||||
}
|
@ -1567,14 +1567,23 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
rule(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.EXTENSION_EXT_CONTEXT_WRONG, extUrl, contexts.toString(), plist.toString());
|
||||
if (definition.hasUserData(XVerExtensionManager.XVER_EXT_MARKER)) {
|
||||
warning(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.EXTENSION_EXT_CONTEXT_WRONG_XVER, extUrl, contexts.toString(), plist.toString());
|
||||
} else {
|
||||
rule(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.EXTENSION_EXT_CONTEXT_WRONG, extUrl, contexts.toString(), plist.toString());
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
if (definition.hasContextInvariant()) {
|
||||
for (StringType s : definition.getContextInvariant()) {
|
||||
if (!fpe.evaluateToBoolean(hostContext, resource, hostContext.getRootResource(), container, fpe.parse(s.getValue()))) {
|
||||
rule(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.PROFILE_EXT_NOT_HERE, extUrl, s.getValue());
|
||||
return false;
|
||||
if (definition.hasUserData(XVerExtensionManager.XVER_EXT_MARKER)) {
|
||||
warning(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.PROFILE_EXT_NOT_HERE, extUrl, s.getValue());
|
||||
return true;
|
||||
} else {
|
||||
rule(errors, IssueType.STRUCTURE, container.line(), container.col(), stack.getLiteralPath(), false, I18nConstants.PROFILE_EXT_NOT_HERE, extUrl, s.getValue());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user