Skip to content

Commit 37a95b3

Browse files
committed
Configure NSwag to generate a client with access modifier set to internal. Simplified ExampleApiClient to not use a generated interface
1 parent ecd971e commit 37a95b3

File tree

6 files changed

+5
-17
lines changed

6 files changed

+5
-17
lines changed

src/Examples/JsonApiDotNetCoreExampleClient/GeneratedCode/ExampleApiClient.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
namespace JsonApiDotNetCoreExampleClient.GeneratedCode
55
{
6-
// ReSharper disable once MemberCanBeInternal
7-
public partial class ExampleApiClient : JsonApiClient
6+
internal partial class ExampleApiClient : JsonApiClient
87
{
98
partial void UpdateJsonSerializerSettings(JsonSerializerSettings settings)
109
{

src/Examples/JsonApiDotNetCoreExampleClient/GeneratedCode/IExampleApiClient.cs

-9
This file was deleted.

src/Examples/JsonApiDotNetCoreExampleClient/JsonApiDotNetCoreExampleClient.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<ClassName>ExampleApiClient</ClassName>
2222
<CodeGenerator>NSwagCSharp</CodeGenerator>
2323
<Namespace>JsonApiDotNetCoreExampleClient.GeneratedCode</Namespace>
24-
<Options>/UseBaseUrl:false /GenerateClientInterfaces:true</Options>
24+
<Options>/UseBaseUrl:false /ClientClassAccessModifier:internal</Options>
2525
</OpenApiReference>
2626
</ItemGroup>
2727

src/Examples/JsonApiDotNetCoreExampleClient/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private static async Task Main()
1717
BaseAddress = new Uri("http://localhost:14140")
1818
};
1919

20-
IExampleApiClient exampleApiClient = new ExampleApiClient(httpClient);
20+
ExampleApiClient exampleApiClient = new(httpClient);
2121

2222
try
2323
{

test/OpenApiTests/ClientLibrary/GeneratedCode/OpenApiClient.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
namespace OpenApiTests.ClientLibrary.GeneratedCode
55
{
6-
// ReSharper disable once MemberCanBeInternal
7-
public partial class OpenApiClient : JsonApiClient
6+
internal partial class OpenApiClient : JsonApiClient
87
{
98
partial void UpdateJsonSerializerSettings(JsonSerializerSettings settings)
109
{

test/OpenApiTests/OpenApiTests.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
<ItemGroup>
77
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi.Client\JsonApiDotNetCore.OpenApi.Client.csproj" />
8-
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApiClient\JsonApiDotNetCore.OpenApiClient.csproj" />
98
<ProjectReference Include="..\..\src\JsonApiDotNetCore.OpenApi\JsonApiDotNetCore.OpenApi.csproj" />
109
<ProjectReference Include="..\TestBuildingBlocks\TestBuildingBlocks.csproj" />
1110
</ItemGroup>
@@ -34,7 +33,7 @@
3433
<Namespace>OpenApiTests.ClientLibrary.GeneratedCode</Namespace>
3534
<ClassName>OpenApiClient</ClassName>
3635
<CodeGenerator>NSwagCSharp</CodeGenerator>
37-
<Options>/UseBaseUrl:false /GenerateClientInterfaces:true</Options>
36+
<Options>/UseBaseUrl:false /GenerateClientInterfaces:true /ClientClassAccessModifier:internal</Options>
3837
</OpenApiReference>
3938
</ItemGroup>
4039

0 commit comments

Comments
 (0)