OID related fixes

This commit is contained in:
Grahame Grieve 2023-10-12 20:13:48 +11:00
parent 4917dd7815
commit 04597eea27
3 changed files with 25 additions and 9 deletions

View File

@ -482,7 +482,10 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
packageTracker.packageLoaded(pi.id(), pi.version());
}
oidFiles.add(pi.getFolders().get("package").oidIndexFile());
String oi = pi.getFolders().get("package").oidIndexFile();
if (oi != null) {
oidFiles.add(oi);
}
if ((types == null || types.size() == 0) && loader != null) {
types = loader.getTypes();

View File

@ -325,7 +325,11 @@ public class NpmPackage {
}
public String oidIndexFile() throws IOException {
return fn(".oids.json");
if (folder == null) {
return null;
} else {
return fn(".oids.json");
}
}
}

View File

@ -166,10 +166,15 @@ public class NpmPackageIndexBuilder {
oids.add(v);
}
}
JsonArray a = new JsonArray();
("codesystem".equals(json.asString("kind")) ? oidIndexCS : oidIndexOther).add(url, a);
for (String s : oids) {
a.add(s);
if (url != null) {
JsonArray a = new JsonArray();
JsonObject cache = ("codesystem".equals(json.asString("kind")) ? oidIndexCS : oidIndexOther);
if (!cache.has(url)) {
json.add(url, a);
for (String s : oids) {
a.add(s);
}
}
}
} else {
if (json.hasPrimitive("url")) {
@ -191,9 +196,12 @@ public class NpmPackageIndexBuilder {
}
if (!oids.isEmpty()) {
JsonArray a = new JsonArray();
("CodeSystem".equals(rt) ? oidIndexCS : oidIndexOther).add(json.asString("url"), a);
for (String s : oids) {
a.add(s);
JsonObject cache = ("CodeSystem".equals(rt) ? oidIndexCS : oidIndexOther);
if (!cache.has(json.asString("url"))) {
cache.add(json.asString("url"), a);
for (String s : oids) {
a.add(s);
}
}
}
}
@ -201,6 +209,7 @@ public class NpmPackageIndexBuilder {
}
} catch (Exception e) {
System.out.println("Error parsing "+name+": "+e.getMessage());
e.printStackTrace();
if (name.contains("openapi")) {
return false;
}