From 06e690e54f6166544a0139b9d1f2619fd420de26 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 18 Jan 2022 07:30:12 +1100 Subject: [PATCH] fix bug in package generator where files go in the wrong place --- RELEASE_NOTES.md | 7 ++++--- .../hl7/fhir/r5/utils/NPMPackageGenerator.java | 18 +++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b45b0ddd2..6672be4e4 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,8 +1,9 @@ ## Validator Changes -* fix inclusion of Java constants in CLI help text. -* fix bug on `-compile` output when using 'current' version. +* no changes ## Other code changes -n/a +* fix bug where generated packages have files in the wrong places +* fix inclusion of Java constants in CLI help text. +* fix bug on `-compile` output when using 'current' version. diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java index aa8438628..21d771f36 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java @@ -80,14 +80,14 @@ public class NPMPackageGenerator { private String getDirectory() { switch (this) { case RESOURCE: return "package/"; - case EXAMPLE: return "example/"; - case OPENAPI: return "openapi/"; - case SCHEMATRON: return "xml/"; - case RDF: return "rdf/"; - case OTHER: return "other/"; - case TEMPLATE: return "other/"; - case JEKYLL: return "jekyll/"; - case TOOL: return "bin/"; + case EXAMPLE: return "package/example/"; + case OPENAPI: return "package/openapi/"; + case SCHEMATRON: return "package/xml/"; + case RDF: return "package/rdf/"; + case OTHER: return "package/other/"; + case TEMPLATE: return "package/other/"; + case JEKYLL: return "package/jekyll/"; + case TOOL: return "package/bin/"; } return "/"; } @@ -323,7 +323,7 @@ public class NPMPackageGenerator { public void addFile(Category cat, String name, byte[] content) throws IOException { String path = cat.getDirectory()+name; if (path.length() > 100) { - name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString(); + name = name.substring(0, name.indexOf("-"))+"-"+UUID.randomUUID().toString()+".json"; path = cat.getDirectory()+name; }