Merge pull request #1826 from hapifhir/2024-11-gg-clean0up

2024 11 gg clean0up
This commit is contained in:
Grahame Grieve 2024-11-22 23:12:48 +11:00 committed by GitHub
commit 59680b914d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 60 additions and 31 deletions

View File

@ -1,7 +1,11 @@
## Validator Changes
* fix pattern discriminator validation rule
* fix issue with FHIRPath engine throwing exception for an invalid path
## Other code changes
* no changes
* fix NPE rendering reference
* fix NPE processing issue from template
* Add FeatureDefinition renderer
* Support for Custom resources in publisher

View File

@ -874,6 +874,9 @@ public class ToolingExtensions {
}
private static IssueSeverity mapSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity severity) {
if (severity == null) {
return null;
}
switch (severity) {
case ERROR:
return IssueSeverity.ERROR;

View File

@ -903,6 +903,9 @@ public class ToolingExtensions {
}
private static IssueSeverity mapSeverity(org.hl7.fhir.r4b.model.OperationOutcome.IssueSeverity severity) {
if (severity == null) {
return null;
}
switch (severity) {
case ERROR:
return IssueSeverity.ERROR;

View File

@ -846,22 +846,26 @@ public abstract class ResourceRenderer extends DataRenderer {
if (!Utilities.noString(r.getId())) {
if (!context.isSecondaryLang()) {
String sid = r.getScopedId();
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
sid = "hc"+sid;
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
if (sid != null) {
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
sid = "hc"+sid;
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
}
}
if (context.getLocale() != null) {
String langSuffix = "-"+context.getLocale().toLanguageTag();
String sid = r.getScopedId()+langSuffix;
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
if (r.getScopedId() != null) {
String sid = r.getScopedId()+langSuffix;
if (!context.hasAnchor(sid)) {
context.addAnchor(sid);
x.an(context.prefixAnchor(sid));
}
}
}
}

View File

@ -1071,6 +1071,9 @@ public class ToolingExtensions {
}
private static IssueSeverity mapSeverity(org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity severity) {
if (severity == null) {
return null;
}
switch (severity) {
case ERROR: return IssueSeverity.ERROR;
case FATAL: return IssueSeverity.FATAL;

View File

@ -331,6 +331,7 @@ public class NpmPackage {
}
private String path;
private JsonObject npm;
private Map<String, NpmPackageFolder> folders = new HashMap<>();
@ -339,6 +340,7 @@ public class NpmPackage {
private boolean minimalMemory;
private int size;
private boolean warned = false;
private static boolean loadCustomResources;
/**
* Constructor
@ -406,7 +408,7 @@ public class NpmPackage {
public void loadFiles(String path, File source, String... exemptions) throws FileNotFoundException, IOException {
this.npm = JsonParser.parseObject(TextFile.fileToString(Utilities.path(path, "package", "package.json")));
this.path = path;
File dir = ManagedFileAccess.file(path);
for (File f : dir.listFiles()) {
if (!isInternalExemptFile(f) && !Utilities.existsInList(f.getName(), exemptions)) {
@ -431,6 +433,7 @@ public class NpmPackage {
}
}
loadSubFolders(dir.getAbsolutePath(), f);
} else {
NpmPackageFolder folder = this.new NpmPackageFolder(Utilities.path("package", "$root"));
folder.folder = dir;
@ -448,24 +451,26 @@ public class NpmPackage {
private void loadSubFolders(String rootPath, File dir) throws IOException {
for (File f : dir.listFiles()) {
if (f.isDirectory()) {
String d = f.getAbsolutePath().substring(rootPath.length()+1);
if (!d.startsWith("package")) {
d = Utilities.path("package", d);
}
NpmPackageFolder folder = this.new NpmPackageFolder(d);
folder.folder = f;
this.folders.put(d, folder);
File ij = ManagedFileAccess.file(Utilities.path(f.getAbsolutePath(), ".index.json"));
if (ij.exists() || !minimalMemory) {
try {
if (!ij.exists() || !folder.readIndex(JsonParser.parseObject(ij), folder.getTypes())) {
indexFolder(folder.getFolderName(), folder);
}
} catch (Exception e) {
throw new IOException("Error parsing "+ij.getAbsolutePath()+": "+e.getMessage(), e);
if (!"custom".equals(f.getName()) || loadCustomResources) {
String d = f.getAbsolutePath().substring(rootPath.length()+1);
if (!d.startsWith("package")) {
d = Utilities.path("package", d);
}
NpmPackageFolder folder = this.new NpmPackageFolder(d);
folder.folder = f;
this.folders.put(d, folder);
File ij = ManagedFileAccess.file(Utilities.path(f.getAbsolutePath(), ".index.json"));
if (ij.exists() || !minimalMemory) {
try {
if (!ij.exists() || !folder.readIndex(JsonParser.parseObject(ij), folder.getTypes())) {
indexFolder(folder.getFolderName(), folder);
}
} catch (Exception e) {
throw new IOException("Error parsing "+ij.getAbsolutePath()+": "+e.getMessage(), e);
}
}
loadSubFolders(rootPath, f);
}
loadSubFolders(rootPath, f);
}
}
}
@ -1510,5 +1515,12 @@ public class NpmPackage {
return id()+"#"+version();
}
public static boolean isLoadCustomResources() {
return loadCustomResources;
}
public static void setLoadCustomResources(boolean loadCustomResources) {
NpmPackage.loadCustomResources = loadCustomResources;
}
}