Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added generation of strongly typed http client on build #33

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,513 changes: 0 additions & 2,513 deletions Shifty.Api/Generated/AnalogCoreV1/AnalogCoreV1.cs

This file was deleted.

4,446 changes: 0 additions & 4,446 deletions Shifty.Api/Generated/AnalogCoreV2/AnalogCoreV2.cs

This file was deleted.

24 changes: 0 additions & 24 deletions Shifty.Api/Shifty.Api.csproj

This file was deleted.

2 changes: 1 addition & 1 deletion Shifty.App/Shifty.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<_ContentIncludedByDefault Remove="wwwroot\sample-data\weather.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Shifty.Api\Shifty.Api.csproj" />
<ProjectReference Include="..\Shifty.Generated.ApiClient\Shifty.Generated.ApiClient.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove=".dockerignore" />
Expand Down
67 changes: 0 additions & 67 deletions Shifty.GenerateApi/Program.cs

This file was deleted.

16 changes: 0 additions & 16 deletions Shifty.GenerateApi/Shifty.GenerateApi.csproj

This file was deleted.

25 changes: 0 additions & 25 deletions Shifty.GenerateApi/Shifty.GenerateApi.sln

This file was deleted.

12 changes: 12 additions & 0 deletions Shifty.Generated.ApiClient/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Auto generated strongly typed http client for Core Api
This project only contains the configuration required to generate strongly typed http clients that we use to test the Api. The clients are outputted in /obj folder, whenever this project is build.

This is set up by configuring the OpenApiReference to point to the versioned openApi specs of the Core Api committed in this repository .

The clients that are out putted are:
- AnalogCoreV1
- AnalogCoreV2

See the following for more info in how to set up, and configure clients
- [Microsoft reference](https://learn.microsoft.com/en-us/aspnet/core/web-api/microsoft.dotnet-openapi?view=aspnetcore-8.0)
- [Blog explaining in detail](https://stevetalkscode.co.uk/openapireference-commands) ([Backup archive.org](https://web.archive.org/web/20240415183726/https://stevetalkscode.co.uk/openapireference-commands))
30 changes: 30 additions & 0 deletions Shifty.Generated.ApiClient/Shifty.Generated.ApiClient.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<RootNamespace>Shifty.Api</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NSwag.ApiDescription.Client" Version="14.0.7" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<OpenApiReference Include="OpenApiSpecs/AnalogCoreV1.json" >
<ClassName>AnalogCoreV1</ClassName>
<Namespace>Shifty.Api.Generated.AnalogCoreV1</Namespace>
<Options>/UseBaseUrl:false /OperationGenerationMode:SingleClientFromPathSegments</Options>
</OpenApiReference>
<OpenApiReference Include="OpenApiSpecs/AnalogCoreV2.json" >
<ClassName>AnalogCoreV2</ClassName>
<Namespace>Shifty.Api.Generated.AnalogCoreV2</Namespace>
<Options>/AdditionalNamespaceUsages:Shifty.Api.Generated.AnalogCoreV1 /UseBaseUrl:false /OperationGenerationMode:SingleClientFromPathSegments</Options>
</OpenApiReference>
</ItemGroup>

</Project>
8 changes: 1 addition & 7 deletions Shifty.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shifty.Api", "Shifty.Api\Shifty.Api.csproj", "{BEDEC57C-E274-4F0A-B82C-9EBBCD8C67F6}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shifty.Generated.ApiClient", "Shifty.Generated.ApiClient\Shifty.Generated.ApiClient.csproj", "{BEDEC57C-E274-4F0A-B82C-9EBBCD8C67F6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shifty.App", "Shifty.App\Shifty.App.csproj", "{A27A55FD-8B36-48DA-9EC5-2FC45E2D89C5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shifty.GenerateApi", "Shifty.GenerateApi\Shifty.GenerateApi.csproj", "{45CCCE83-B163-4DDF-9826-61413C85BF4F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -26,9 +24,5 @@ Global
{A27A55FD-8B36-48DA-9EC5-2FC45E2D89C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A27A55FD-8B36-48DA-9EC5-2FC45E2D89C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A27A55FD-8B36-48DA-9EC5-2FC45E2D89C5}.Release|Any CPU.Build.0 = Release|Any CPU
{45CCCE83-B163-4DDF-9826-61413C85BF4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45CCCE83-B163-4DDF-9826-61413C85BF4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45CCCE83-B163-4DDF-9826-61413C85BF4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45CCCE83-B163-4DDF-9826-61413C85BF4F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading