fix validation problem for current version

This commit is contained in:
Grahame Grieve 2019-04-25 10:13:28 +10:00
parent 3a1bd1c429
commit 2ab02e2e0b
3 changed files with 8 additions and 8 deletions

View File

@ -350,22 +350,22 @@ import com.google.gson.JsonObject;
return content; return content;
} }
public static NpmPackage fromFolder(String folder) throws IOException { public static NpmPackage fromFolder(String folder, String... exemptions) throws IOException {
return fromFolder(folder, null); return fromFolder(folder, null, exemptions);
} }
public static NpmPackage fromFolder(String folder, PackageType defType) throws IOException { public static NpmPackage fromFolder(String folder, PackageType defType, String... exemptions) throws IOException {
NpmPackage res = new NpmPackage(null); NpmPackage res = new NpmPackage(null);
loadFiles(res, folder, new File(folder)); loadFiles(res, folder, new File(folder), exemptions);
if (!res.content.containsKey("package/package.json") && defType != null) if (!res.content.containsKey("package/package.json") && defType != null)
res.content.put("package/package.json", TextFile.stringToBytes("{ \"type\" : \""+defType.getCode()+"\"}", false)); res.content.put("package/package.json", TextFile.stringToBytes("{ \"type\" : \""+defType.getCode()+"\"}", false));
res.npm = (JsonObject) new com.google.gson.JsonParser().parse(new String(res.content.get("package/package.json"))); res.npm = (JsonObject) new com.google.gson.JsonParser().parse(new String(res.content.get("package/package.json")));
return res; return res;
} }
private static void loadFiles(NpmPackage res, String base, File folder) throws FileNotFoundException, IOException { private static void loadFiles(NpmPackage res, String base, File folder, String... exemptions) throws FileNotFoundException, IOException {
for (File f : folder.listFiles()) { for (File f : folder.listFiles()) {
if (!f.getName().equals(".git")) { if (!f.getName().equals(".git") || !Utilities.existsInList(f.getName(), exemptions)) {
if (f.isDirectory()) if (f.isDirectory())
loadFiles(res, base, f); loadFiles(res, base, f);
else { else {

View File

@ -251,7 +251,7 @@ public class Validator {
System.out.print(s.contains(" ") ? " \""+s+"\"" : " "+s); System.out.print(s.contains(" ") ? " \""+s+"\"" : " "+s);
System.out.println(); System.out.println();
String definitions = "hl7.fhir.core#"+Constants.VERSION; String definitions = "hl7.fhir.core#current";
String map = null; String map = null;
List<String> igs = new ArrayList<String>(); List<String> igs = new ArrayList<String>();
List<String> questionnaires = new ArrayList<String>(); List<String> questionnaires = new ArrayList<String>();

View File

@ -150,7 +150,7 @@
"errorCount": 0 "errorCount": 0
}, },
"primitive-bad.xml" : { "primitive-bad.xml" : {
"errorCount": 49 "errorCount": 47
}, },
"primitive-bad-empty.xml" : { "primitive-bad-empty.xml" : {
"errorCount": 3 "errorCount": 3