Skip to content

Commit 27bf3ab

Browse files
Fix for Primitive nullable return types
1 parent 34455dc commit 27bf3ab

File tree

9 files changed

+29
-5
lines changed

9 files changed

+29
-5
lines changed

Modules/Intent.Modules.AspNetCore.IntegrationTesting/Intent.AspNetCore.IntegrationTesting.imodspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.AspNetCore.IntegrationTesting</id>
4-
<version>2.0.11-pre.0</version>
4+
<version>2.0.11-pre.1</version>
55
<supportedClientVersions>[4.5.0-a, 5.0.0-a)</supportedClientVersions>
66
<summary>The module adds support for Integration Testing Asp.Net Core applications.</summary>
77
<description>The module adds support for Integration Testing Asp.Net Core applications.</description>

Modules/Intent.Modules.AspNetCore.IntegrationTesting/release-notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
### Version 2.0.11
22

33
- Improvement: Updated NuGet package versions.
4+
- Fixed: Nullable primitive return types (non wrapped as json responses) caused un-compilable code.
5+
46

57
### Version 2.0.10
68

Modules/Intent.Modules.Blazor.HttpClients/Intent.Blazor.HttpClients.imodspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.Blazor.HttpClients</id>
4-
<version>4.0.17</version>
4+
<version>4.0.18</version>
55
<supportedClientVersions>[4.3.0-a, 5.0.0-a)</supportedClientVersions>
66
<summary>Introduces an HTTP Client implementation for Blazor applications that can make service calls against a referenced service Restful API.</summary>
77
<description>Introduces an HTTP Client implementation for Blazor applications that can make service calls against a referenced service Restful API.</description>

Modules/Intent.Modules.Blazor.HttpClients/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 4.0.18
2+
3+
- Fixed: Nullable primitive return types (non wrapped as json responses) caused un-compilable code.
4+
15
### Version 4.0.17
26

37
- Improvement: Added support for a proxy URL to automatically be set in `appsettings.json`

Modules/Intent.Modules.Dapr.AspNetCore.ServiceInvocation/Intent.Dapr.AspNetCore.ServiceInvocation.imodspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.Dapr.AspNetCore.ServiceInvocation</id>
4-
<version>2.2.25</version>
4+
<version>2.2.26-pre.0</version>
55
<supportedClientVersions>[4.0.0-beta.4, 5.0.0-a)</supportedClientVersions>
66
<summary>Generation of client service proxies for Dapr "Service-to-service invocation".</summary>
77
<description>Generation of client service proxies for Dapr "Service-to-service invocation".</description>

Modules/Intent.Modules.Dapr.AspNetCore.ServiceInvocation/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 2.2.26
2+
3+
- Fixed: Nullable primitive return types (non wrapped as json responses) caused un-compilable code.
4+
15
### Version 2.2.25
26

37
- Improvement: Updated NuGet package versions.

Modules/Intent.Modules.Integration.HttpClients.Shared/Templates/HttpClient/HttpClientTemplateBase.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,17 @@ protected HttpClientTemplateBase(
381381
stmt.AddStatement("str = str.Substring(1, str.Length - 2);");
382382
}
383383
});
384-
usingContentStreamBlock.AddStatement($"return {GetTypeName(endpoint.ReturnType)}.Parse(str);");
384+
385+
var nonNullableType = GetTypeInfo(endpoint.ReturnType).WithIsNullable(false);
386+
if (endpoint.ReturnType.IsNullable)
387+
{
388+
usingContentStreamBlock.AddIfStatement("string.IsNullOrEmpty(str)", ifs => ifs.AddStatement("return null;"));
389+
usingContentStreamBlock.AddStatement($"return {UseType(nonNullableType)}.Parse(str);");
390+
}
391+
else
392+
{
393+
usingContentStreamBlock.AddStatement($"return {UseType(nonNullableType)}.Parse(str);");
394+
}
385395
}
386396
else
387397
{

Modules/Intent.Modules.Integration.HttpClients/Intent.Integration.HttpClients.imodspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<package>
33
<id>Intent.Integration.HttpClients</id>
4-
<version>6.0.7</version>
4+
<version>6.0.8-pre.0</version>
55
<supportedClientVersions>[4.3.9-pre.0, 5.0.0-a)</supportedClientVersions>
66
<summary>Introduces an Http Client implementation that can make service calls against a referenced service Restful API.</summary>
77
<description>Introduces an Http Client implementation that can make service calls against a referenced service Restful API.</description>

Modules/Intent.Modules.Integration.HttpClients/release-notes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 6.0.8
2+
3+
- Fixed: Nullable primitive return types (non wrapped as json responses) caused un-compilable code.
4+
15
### Version 6.0.7
26

37
- Improvement: Added support for a proxy URL to automatically be set in `appsettings.json`

0 commit comments

Comments
 (0)