diff --git a/Directory.Build.props b/Directory.Build.props index cae926f..e1fe308 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,8 +1,8 @@ - 2.29.2 - 2.29.1 + 2.29.3 + 2.29.2 12.0 enable enable diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 0763803..9eeb626 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,6 +1,6 @@ # Release Notes -## 2.29.2 +## 2.29.3 * Allow missing or empty HTTP content to be treated as an empty DTO for backward compatibility with method bodies that previously had no fields. diff --git a/src/Facility.CodeGen.CSharp/CSharpGenerator.cs b/src/Facility.CodeGen.CSharp/CSharpGenerator.cs index fd2f230..0610e73 100644 --- a/src/Facility.CodeGen.CSharp/CSharpGenerator.cs +++ b/src/Facility.CodeGen.CSharp/CSharpGenerator.cs @@ -910,7 +910,7 @@ private CodeGenFile GenerateHttpMapping(HttpServiceInfo httpServiceInfo, Context foreach (var field in httpMethodInfo.RequestNormalFields) { var fieldName = context.GetFieldPropertyName(field.ServiceField); - code.WriteLine($"{fieldName} = (({requestTypeName}) body{NullableReferenceBang}).{fieldName},"); + code.WriteLine($"{fieldName} = (({requestTypeName}?) body)?.{fieldName},"); } } } diff --git a/src/Facility.ConformanceApi/Http/ConformanceApiHttpMapping.g.cs b/src/Facility.ConformanceApi/Http/ConformanceApiHttpMapping.g.cs index f10e6bd..76c18eb 100644 --- a/src/Facility.ConformanceApi/Http/ConformanceApiHttpMapping.g.cs +++ b/src/Facility.ConformanceApi/Http/ConformanceApiHttpMapping.g.cs @@ -516,7 +516,7 @@ public static partial class ConformanceApiHttpMapping CreateRequest = body => new MixedRequestDto { - Normal = ((MixedRequestDto) body!).Normal, + Normal = ((MixedRequestDto?) body)?.Normal, }, ResponseMappings = { @@ -596,15 +596,15 @@ public static partial class ConformanceApiHttpMapping CreateRequest = body => new RequiredRequestDto { - Normal = ((RequiredRequestDto) body!).Normal, - Widget = ((RequiredRequestDto) body!).Widget, - Widgets = ((RequiredRequestDto) body!).Widgets, - WidgetMatrix = ((RequiredRequestDto) body!).WidgetMatrix, - WidgetResult = ((RequiredRequestDto) body!).WidgetResult, - WidgetResults = ((RequiredRequestDto) body!).WidgetResults, - WidgetMap = ((RequiredRequestDto) body!).WidgetMap, - HasWidget = ((RequiredRequestDto) body!).HasWidget, - Point = ((RequiredRequestDto) body!).Point, + Normal = ((RequiredRequestDto?) body)?.Normal, + Widget = ((RequiredRequestDto?) body)?.Widget, + Widgets = ((RequiredRequestDto?) body)?.Widgets, + WidgetMatrix = ((RequiredRequestDto?) body)?.WidgetMatrix, + WidgetResult = ((RequiredRequestDto?) body)?.WidgetResult, + WidgetResults = ((RequiredRequestDto?) body)?.WidgetResults, + WidgetMap = ((RequiredRequestDto?) body)?.WidgetMap, + HasWidget = ((RequiredRequestDto?) body)?.HasWidget, + Point = ((RequiredRequestDto?) body)?.Point, }, ResponseMappings = { diff --git a/tools/EdgeCases/Http/EdgeCasesHttpMapping.g.cs b/tools/EdgeCases/Http/EdgeCasesHttpMapping.g.cs index f848dda..e4546f1 100644 --- a/tools/EdgeCases/Http/EdgeCasesHttpMapping.g.cs +++ b/tools/EdgeCases/Http/EdgeCasesHttpMapping.g.cs @@ -53,7 +53,7 @@ public static partial class EdgeCasesHttpMapping CreateRequest = body => new CustomHttpRequestDto { - Value = ((CustomHttpRequestDto) body!).Value, + Value = ((CustomHttpRequestDto?) body)?.Value, }, ResponseMappings = {