Skip to content

Commit f57913f

Browse files
committed
#24 validation message to handle a package that doesn't indicate what fhir version it is
1 parent e0c43e1 commit f57913f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

UploadFIG/Program.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,16 @@ public static async Task<Result> UploadPackageInternal(Settings settings)
221221
ExpressionValidator expressionValidator = null;
222222
FHIRVersion? fhirVersion = null;
223223
var versionInPackage = manifest.GetFhirVersion();
224-
if (versionInPackage.StartsWith(FHIRVersion.N4_0.GetLiteral()))
224+
if (versionInPackage == null)
225+
{
226+
// There was no manifest
227+
ConsoleEx.WriteLine(ConsoleColor.Red, $"Cannot load/test a FHIR Implementation Guide Package where the manifest does not define a fhir version (package.json)");
228+
ConsoleEx.WriteLine(ConsoleColor.Red, $"e.g. \"fhirVersions\" : [\"4.0.1\"]");
229+
return new Result { Value = -1 };
230+
231+
// Note: Could try and "deduce" the fhir version from which fhir core packages are included, however those aren't mandatory either
232+
}
233+
else if (versionInPackage.StartsWith(FHIRVersion.N4_0.GetLiteral()))
225234
{
226235
fhirVersion = EnumUtility.ParseLiteral<FHIRVersion>(r4.Hl7.Fhir.Model.ModelInfo.Version);
227236
versionAgnosticProcessor = new R4_Processor();

0 commit comments

Comments
 (0)