diff --git a/Directory.Build.props b/Directory.Build.props index f6660e797..3cb8a5605 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,6 +11,7 @@ Microsoft Health true $(MSBuildThisFileDirectory) + net8.0 diff --git a/build/build.yml b/build/build.yml index 18772c6b6..dfcdd4a6e 100644 --- a/build/build.yml +++ b/build/build.yml @@ -4,9 +4,9 @@ parameters: steps: - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 6.0.x' + displayName: 'Use .NET Core sdk 8.0.x' inputs: - version: 6.0.x + version: 8.0.x selectOrConfig: configs nugetConfigPath: nuget.config diff --git a/build/publish-nugets.yml b/build/publish-nugets.yml index 3eb1a0fe8..f7e8b1f65 100644 --- a/build/publish-nugets.yml +++ b/build/publish-nugets.yml @@ -1,8 +1,8 @@ steps: - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 6.0.x' + displayName: 'Use .NET Core sdk 8.0.x' inputs: - version: 6.0.x + version: 8.0.x selectOrConfig: configs nugetConfigPath: nuget.config diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests.csproj b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests.csproj index 05b2791c1..eace80207 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests.csproj +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests.csproj @@ -1,7 +1,7 @@  - net6.0 + $(LatestFramework) false diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.csproj b/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.csproj index 5128282eb..803a69cb5 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.csproj +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + $(LatestFramework) true Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec b/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec index 73a517f8c..c2b073abd 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec @@ -9,10 +9,10 @@ false Package Description - + - + \ No newline at end of file diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/SegmentFiltersTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/SegmentFiltersTests.cs index 2652fdbf0..54b0ac944 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/SegmentFiltersTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/SegmentFiltersTests.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Health.Fhir.Liquid.Converter.Exceptions; using Microsoft.Health.Fhir.Liquid.Converter.Models.Hl7v2; using Microsoft.Health.Fhir.Liquid.Converter.Parsers; using Xunit; @@ -45,7 +46,7 @@ public void GivenAnHl7v2Data_WhenGetFirstSegments_CorrectResultShouldBeReturned( Assert.True(!segments.ContainsKey("PV1")); // Hl7v2Data and segment id content could not be null - Assert.Throws(() => Filters.GetFirstSegments(null, "PID")); + Assert.Throws(() => Filters.GetFirstSegments(null, "PID")); Assert.Throws(() => Filters.GetFirstSegments(new Hl7v2Data(), null)); } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Microsoft.Health.Fhir.Liquid.Converter.UnitTests.csproj b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Microsoft.Health.Fhir.Liquid.Converter.UnitTests.csproj index eac2c2e2f..1b6c5a98b 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Microsoft.Health.Fhir.Liquid.Converter.UnitTests.csproj +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Microsoft.Health.Fhir.Liquid.Converter.UnitTests.csproj @@ -1,7 +1,7 @@  - net6.0 + $(LatestFramework) false diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/SegmentFilters.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/SegmentFilters.cs index 4966b72b5..a785361be 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/SegmentFilters.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/SegmentFilters.cs @@ -6,6 +6,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Health.Fhir.Liquid.Converter.Exceptions; +using Microsoft.Health.Fhir.Liquid.Converter.Models; using Microsoft.Health.Fhir.Liquid.Converter.Models.Hl7v2; namespace Microsoft.Health.Fhir.Liquid.Converter @@ -17,6 +19,11 @@ public partial class Filters { public static Dictionary GetFirstSegments(Hl7v2Data hl7v2Data, string segmentIdContent) { + if (hl7v2Data == null) + { + throw new TemplateLoadException(FhirConverterErrorCode.TemplateDataMismatch, "Incorrect template was passed in for the input data format."); + } + var result = new Dictionary(); var segmentIds = segmentIdContent.Split(@"|"); for (var i = 0; i < hl7v2Data.Meta.Count; ++i) diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj b/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj index ea0ac6bfc..f75252f42 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj @@ -2,7 +2,7 @@ Library - net6.0 + $(LatestFramework) false annotations diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/FhirConverterErrorCode.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/FhirConverterErrorCode.cs index a9466ec79..7aff9f0f5 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/FhirConverterErrorCode.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/FhirConverterErrorCode.cs @@ -18,6 +18,7 @@ public enum FhirConverterErrorCode InvalidCodeMapping = 1103, TemplateSyntaxError = 1104, InvalidJsonSchema = 1105, + TemplateDataMismatch = 1106, // DataParseException InputParsingError = 1201, diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs index 694127279..399db2bb6 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs @@ -84,7 +84,8 @@ public PartialDateTime ConvertToDate() public PartialDateTime AddSeconds(double seconds) { - DateTimeValue = DateTimeValue.AddSeconds(seconds); + var timespan = TimeSpan.FromSeconds(seconds); + DateTimeValue = DateTimeValue.Add(timespan); MillisecondString = null; if (Precision != DateTimePrecision.Milliseconds) diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/BaseProcessor.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/BaseProcessor.cs index 631bed290..7429279c7 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/BaseProcessor.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/BaseProcessor.cs @@ -129,6 +129,10 @@ protected string RenderTemplates(Template template, Context context) { throw; } + catch (TemplateLoadException) + { + throw; + } catch (Exception ex) { Console.WriteLine("Ex: {1} StackTrace: '{0}'", Environment.StackTrace, ex); diff --git a/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests.csproj b/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests.csproj index 75d999fde..337580417 100644 --- a/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests.csproj +++ b/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests.csproj @@ -1,7 +1,7 @@  - net6.0 + $(LatestFramework) false diff --git a/src/Microsoft.Health.Fhir.TemplateManagement.UnitTests/Microsoft.Health.Fhir.TemplateManagement.UnitTests.csproj b/src/Microsoft.Health.Fhir.TemplateManagement.UnitTests/Microsoft.Health.Fhir.TemplateManagement.UnitTests.csproj index 097b9d80d..8ce35fa99 100644 --- a/src/Microsoft.Health.Fhir.TemplateManagement.UnitTests/Microsoft.Health.Fhir.TemplateManagement.UnitTests.csproj +++ b/src/Microsoft.Health.Fhir.TemplateManagement.UnitTests/Microsoft.Health.Fhir.TemplateManagement.UnitTests.csproj @@ -1,7 +1,7 @@  - net6.0 + $(LatestFramework) false diff --git a/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.Liquid.Converter.nuspec b/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.Liquid.Converter.nuspec index fd6037bb9..26c993a54 100644 --- a/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.Liquid.Converter.nuspec +++ b/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.Liquid.Converter.nuspec @@ -9,7 +9,7 @@ false Package Description - + @@ -32,7 +32,7 @@ - - + + diff --git a/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.TemplateManagement.csproj b/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.TemplateManagement.csproj index a392a1801..60aeaccda 100644 --- a/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.TemplateManagement.csproj +++ b/src/Microsoft.Health.Fhir.TemplateManagement/Microsoft.Health.Fhir.TemplateManagement.csproj @@ -2,7 +2,7 @@ Library - net6.0 + $(LatestFramework) true Microsoft.Health.Fhir.Liquid.Converter.nuspec 0.12.0