forked from asyncapi/saunter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asyncapi#197 Produce AsyncAPI documents at build time
- Loading branch information
Senn Geerts
authored and
Senn Geerts
committed
Jul 6, 2024
1 parent
f0af6d1
commit a379a3e
Showing
11 changed files
with
149 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
specs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/AsyncAPI.Saunter.Generator.Build/AsyncAPI.Saunter.Generator.Build.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<LangVersion>12</LangVersion> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
|
||
<Description>AsyncAPI Build Tools</Description> | ||
<Authors>AsyncAPI Initiative</Authors> | ||
<PackageId>AsyncAPI.Saunter.Generator.Build</PackageId> | ||
<PackageTags>asyncapi;aspnetcore;openapi;documentation;amqp;generator;build;tool</PackageTags> | ||
<PackageReadmeFile>readme.md</PackageReadmeFile> | ||
<PackageIcon>logo.png</PackageIcon> | ||
<RepositoryUrl>https://github.com/asyncapi/saunter</RepositoryUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<IncludeSymbols>false</IncludeSymbols> | ||
<PackageProjectUrl>https://github.com/asyncapi/saunter</PackageProjectUrl> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<Version>0.0.24</Version> | ||
<OutputPath>tools/$(Configuration)</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AsyncAPI.Saunter.Generator.Cli\AsyncAPI.Saunter.Generator.Cli.csproj" /> | ||
<ProjectReference Include="..\Saunter\Saunter.csproj" /> | ||
<ProjectReference Update="@(ProjectReference)" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' "> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="AsyncAPI.NET.Readers" Version="5.2.1" /> | ||
|
||
<!-- Development Dependencies --> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> | ||
<PackageReference Update="@(PackageReference)" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="readme.md" Pack="true" PackagePath="/" /> | ||
<None Include="../../assets/logo.png" Pack="true" PackagePath="/" /> | ||
<None Include="build/*" Pack="true" PackagePath="/build" /> | ||
<None Include="$(OutputPath)/net6.0/*" Pack="true" PackagePath="/tools/net6.0" /> | ||
</ItemGroup> | ||
|
||
<!--ItemGroup> | ||
<Compile Include="../AsyncAPI.Saunter.Generator.Cli/Commands/**/*.cs" /> | ||
<Compile Include="../AsyncAPI.Saunter.Generator.Cli/Internal/**/*.cs" /> | ||
<Compile Include="../AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/**/*.cs" /> | ||
<Compile Include="../AsyncAPI.Saunter.Generator.Cli/*.cs" /> | ||
</ItemGroup>--> | ||
|
||
<ItemGroup> | ||
<Folder Include="tools\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
11 changes: 11 additions & 0 deletions
11
src/AsyncAPI.Saunter.Generator.Build/build/AsyncAPI.Saunter.Generator.Build.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<Project> | ||
<PropertyGroup> | ||
<AsyncAPIGenerateDocumentsOnBuild Condition=" '$(AsyncAPIGenerateDocumentsOnBuild)' == '' ">true</AsyncAPIGenerateDocumentsOnBuild> | ||
<AsyncAPIDocumentFormats Condition=" '$(AsyncAPIDocumentFormats)' == '' ">json</AsyncAPIDocumentFormats> | ||
<AsyncAPIDocumentOutputPath Condition=" '$(AsyncAPIDocumentOutputPath)' == '' ">./</AsyncAPIDocumentOutputPath> | ||
<AsyncAPIDocumentFilename Condition=" '$(AsyncAPIDocumentFilename)' == '' "></AsyncAPIDocumentFilename> | ||
<AsyncAPIDocumentNames Condition=" '$(AsyncAPIDocumentNames)' == '' "></AsyncAPIDocumentNames> | ||
<AsyncAPIDocumentEnvVars Condition=" '$(AsyncAPIDocumentEnvVars)' == '' "></AsyncAPIDocumentEnvVars> | ||
</PropertyGroup> | ||
</Project> |
17 changes: 17 additions & 0 deletions
17
src/AsyncAPI.Saunter.Generator.Build/build/AsyncAPI.Saunter.Generator.Build.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8" standalone="no"?> | ||
<Project> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition=" '$(AsyncAPIGenerateDocumentsOnBuild)' == 'true' "> | ||
<Message Text="AsyncAPI.Build; AsyncAPIDocumentFormats: $(AsyncAPIDocumentFormats)" /> | ||
<Message Text="AsyncAPI.Build; AsyncAPIDocumentOutputPath: $(AsyncAPIDocumentOutputPath)" /> | ||
<Message Text="AsyncAPI.Build; AsyncAPIDocumentNames: $(AsyncAPIDocumentNames)" /> | ||
<Message Text="AsyncAPI.Build; AsyncAPIDocumentFilename: $(AsyncAPIDocumentFilename)" /> | ||
<Message Text="AsyncAPI.Build; AsyncAPIDocumentEnvVars: $(AsyncAPIDocumentEnvVars)" /> | ||
<Message Text="AsyncAPI.Build; MSBuildThisFileDirectory: $(MSBuildThisFileDirectory)" /> | ||
<Message Text="AsyncAPI.Build; MSBuildProjectFullPath: $(MSBuildProjectFullPath)" /> | ||
<Message Text="AsyncAPI.Build; MSBuildProjectDirectory: $(MSBuildProjectDirectory)" /> | ||
|
||
<Exec Command="dotnet "$(MSBuildThisFileDirectory)/../tools/net6.0/AsyncAPI.Saunter.Generator.Cli.dll" tofile --output "$(MSBuildProjectDirectory)/$(AsyncAPIDocumentOutputPath)" --format "$(AsyncAPIDocumentFormats)" --doc "$(AsyncAPIDocumentNames)" --filename "$(AsyncAPIDocumentFilename)" --env "$(AsyncAPIDocumentEnvVars)" "$(MSBuildProjectDirectory)/$(OutputPath)/$(AssemblyTitle).dll""/> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# AsyncApi Generator.Build Nuget Package | ||
A nuget package to generate AsyncAPI specification files at build time, based on code-first attributes. | ||
|
||
# Customizations | ||
The AsyncAPI spec generation can be configured through properties in the csproj-file (or .props files): | ||
``` | ||
<PropertyGroup> | ||
<AsyncAPIGenerateDocumentsOnBuild></AsyncAPIGenerateDocumentsOnBuild> | ||
<AsyncAPIDocumentFormats></AsyncAPIDocumentFormats> | ||
<AsyncAPIDocumentOutputPath></AsyncAPIDocumentOutputPath> | ||
<AsyncAPIDocumentNames></AsyncAPIDocumentNames> | ||
<AsyncAPIDocumentFilename></AsyncAPIDocumentFilename> | ||
<AsyncAPIDocumentEnvVars></AsyncAPIDocumentEnvVars> | ||
</PropertyGroup> | ||
``` | ||
|
||
Defaults are the same as the underlying [Generator.Cli tool](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Cli). | ||
|
||
If the ```AsyncAPI.Saunter.Generator.Build``` Nuget package is referenced, the default is to generate AsyncAPI spec files at build time. | ||
|
||
- AsyncAPIGenerateDocumentsOnBuild: Whether to actually generate AsyncAPI spec files on build (true or false, default: true) | ||
- AsyncAPIDocumentFormats: Format of the expected AsyncAPI spec files (json, yml or yaml, default: json) | ||
- AsyncAPIDocumentOutputPath: Output path for the AsyncAPI spec files, relative to the csproj location. (default is the csproj root path: ./) | ||
- AsyncAPIDocumentNames: The AsyncAPI documents to generate. (default: generate all known documents) | ||
- AsyncAPIDocumentFilename: Template of the AsyncAPI spec files (default: "{document}_asyncapi.{extension}") | ||
- AsyncAPIDocumentEnvVars: Environment variable(s) to set during generation of the AsyncAPI spec files (default: none, Example: "ASPNETCORE_ENVIRONMENT=Development") | ||
None of these properties are mandatory. By only referencing the [AsyncAPI.Saunter.Generator.Build](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Build) Nuget package a json AsyncAPI spec file will be generated for all AsyncAPI documents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters