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,9 +325,13 @@ public class NpmPackage {
}
public String oidIndexFile() throws IOException {
if (folder == null) {
return null;
} else {
return fn(".oids.json");
}
}
}
private String path;
private JsonObject npm;

View File

@ -166,11 +166,16 @@ public class NpmPackageIndexBuilder {
oids.add(v);
}
}
if (url != null) {
JsonArray a = new JsonArray();
("codesystem".equals(json.asString("kind")) ? oidIndexCS : oidIndexOther).add(url, a);
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")) {
if (json.has("oid")) {
@ -191,7 +196,9 @@ public class NpmPackageIndexBuilder {
}
if (!oids.isEmpty()) {
JsonArray a = new JsonArray();
("CodeSystem".equals(rt) ? oidIndexCS : oidIndexOther).add(json.asString("url"), a);
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);
}
@ -199,8 +206,10 @@ public class NpmPackageIndexBuilder {
}
}
}
}
} catch (Exception e) {
System.out.println("Error parsing "+name+": "+e.getMessage());
e.printStackTrace();
if (name.contains("openapi")) {
return false;
}