Skip to content

Commit

Permalink
Add build-time OpenAPI document generation (#632)
Browse files Browse the repository at this point in the history
* Add build-time OpenAPI document generation
* Add schema transformer to remove nullable from optional properties
* Apply suggestions from PR review
* Add extension to encapsulate check for build-time environment
* Move build-time checks to extensions methods

Co-authored-by: Safia Abdalla <safia@safia.rocks>
  • Loading branch information
mikekistler and captainsafia authored Dec 13, 2024
1 parent aaf1857 commit 1c77175
Show file tree
Hide file tree
Showing 9 changed files with 1,037 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<PackageVersion Include="Aspire.RabbitMQ.Client" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.StackExchange.Redis" Version="$(AspireVersion)" />
<PackageVersion Include="Aspire.Azure.AI.OpenAI" Version="$(AspireUnstablePackagesVersion)" />
<PackageVersion Include="Microsoft.Extensions.ApiDescription.Server" Version="$(AspnetVersion)">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="$(AspireVersion)" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery.Yarp" Version="$(AspireVersion)" />
<!-- Version together with Asp.Versioning -->
Expand Down
8 changes: 8 additions & 0 deletions src/Catalog.API/Catalog.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@
<Compile Include="..\Shared\MigrateDbContextExtensions.cs" Link="Extensions\MigrateDbContextExtensions.cs" />
</ItemGroup>

<PropertyGroup>
<OpenApiDocumentsDirectory>$(MSBuildProjectDirectory)</OpenApiDocumentsDirectory>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Asp.Versioning.Http" />
<PackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.ApiDescription.Server">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- AI -->
Expand Down
Loading

0 comments on commit 1c77175

Please sign in to comment.