Skip to content

Commit

Permalink
asyncapi#197 update readme's
Browse files Browse the repository at this point in the history
  • Loading branch information
Senn Geerts authored and Senn Geerts committed Jul 7, 2024
1 parent a42ab3f commit d3f0472
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
27 changes: 19 additions & 8 deletions src/AsyncAPI.Saunter.Generator.Build/readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# 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 project properties in the csproj-file (or .props files):
This nuget packages can help to better control API changes by commiting the AsyncAPI spec to source control. By always generating spec files at build, it will be clear when the api changes.
Example to include the Generator.Build nuget package only in (local) debug builds:
```
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="AsyncAPI.Saunter.Generator.Build" Version="1.*">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
```

# Customization Properties
The AsyncAPI spec generation can be configured through project properties in the csproj-file (or included via .props files):
```
<PropertyGroup>
<AsyncAPIGenerateDocumentsOnBuild></AsyncAPIGenerateDocumentsOnBuild>
Expand All @@ -18,10 +29,10 @@ Defaults are the same as the underlying [Generator.Cli tool](https://www.nuget.o

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")
- _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. Only referencing the [AsyncAPI.Saunter.Generator.Build](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Build) Nuget package will generate a json AsyncAPI spec file for all AsyncAPI documents.
7 changes: 5 additions & 2 deletions src/AsyncAPI.Saunter.Generator.Cli/readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# AsyncApi Generator.Cli Tool
A dotnet tool to generate AsyncAPI specification files based of a dotnet DLL (The application itself).
A dotnet tool to generate AsyncAPI specification files based of a dotnet assembly (The application itself).

This tool can used to manually generate spec files from a startup assembly or to setup a custom build pipeline.
If you are intressed in always generating spec files at build time, see [AsyncAPI.Saunter.Generator.Build](https://www.nuget.org/packages/AsyncAPI.Saunter.Generator.Build).

## Tool usage
```
dotnet asyncapi tofile --output [output-path] --format [json,yml,yaml] --doc [asyncapi-document-name] [startup-assembly]
```
startup-assembly: the file path to the entrypoint dotnet DLL that hosts AsyncAPI document(s).
startup-assembly: the file path to the dotnet startup assembly (DLL) that hosts AsyncAPI document(s).

## Tool options
- _--doc_: The name of the AsyncAPI document as defined in the startup class by the ```.ConfigureNamedAsyncApi()```-method. If only ```.AddAsyncApiSchemaGeneration()``` is used, the document is unnamed and will always be exported. If not specified, all documents will be exported.
Expand Down

0 comments on commit d3f0472

Please sign in to comment.