Skip to content

Commit

Permalink
[Doc] More about Refitter integration
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyBP committed Aug 3, 2024
1 parent 892bda5 commit 40afdcf
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Apizr/Docs/Apizr.Docs/articles/tools_nswag.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
>[!WARNING]
> **Deprecated**
>
> As Apizr.Tools.NSwag is now deprecated and will be removed in a future version, please consider using [Refitter](tools_refitter.md) (v1.2+) instead which now can generate all the Apizr boilerplate and more.
> As Apizr.Tools.NSwag is now deprecated and will be removed in a future version, please consider using [Refitter](tools_refitter.md) (v1.2+) instead which now can generate all the Apizr (v6+) boilerplate and more.
Apizr comes with a tool called Apizr.Tools.NSwag that offers to get all files generated by a couple of command lines.
Apizr (v5.4-) comes with a now deprecated tool called Apizr.Tools.NSwag that offers to get all files generated by a couple of command lines.
It relies on the well known NSwag CLI, letting define all we need in a json configuration file, and generating models, services and a registration helper class.

### Installing
Expand Down Expand Up @@ -142,7 +142,7 @@ That said, let's focus on Apizr dedicated settings into the ```openApiToApizrCli
- ```Extended```: generate with the service collection extending method
- ```Both```: generate both methods (could be interesting to read but not relevant for production)
- ```withPriority``` (default: ```false```): include priority management into registration process
- ```withRetry``` (default: ```false```): add a ResiliencePipeline assembly attribute handling transient http error and a pipeline registry into registration process
- ```withRetry``` (default: ```false```): add a Policy assembly attribute handling transient http error and a policy registry into registration process
- ```withLogs``` (default: ```false```): add a Log assembly attribute and a logger factory into static only registration process
- ```withRequestOptions``` (default: ```false```): add a RequestOptions parameter to your api methods so that you can adjust configuration at request time
- ```withCacheProvider``` (default: ```None```):
Expand Down
9 changes: 9 additions & 0 deletions Apizr/Docs/Apizr.Docs/articles/tools_refitter.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ It comes in 2 forms:
- A [.NET CLI Tool](https://refitter.github.io/articles/cli-tool.md) distributed via [nuget.org](http://www.nuget.org/packages/refitter) that outputs a single C# file on disk
- A [C# Source Generator](https://refitter.github.io/articles/source-generator.md) via the [Refitter.SourceGenerator](http://www.nuget.org/packages/refitter.sourcegenerator) package that generates code on compile time based on a [.refitter](https://refitter.github.io/articles/refitter-file-format.md) within the project directory.

### Installing the package

Choose which generating approach suites to your needs by installing either:

|Project|Current|Upcoming|
|-------|-----|-----|
|Refitter|[![NuGet](https://img.shields.io/nuget/v/refitter.svg)](https://www.nuget.org/packages/refitter/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.svg)](https://www.nuget.org/packages/refitter/)|
|Refitter.SourceGenerator|[![NuGet](https://img.shields.io/nuget/v/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|

### Generating the interfaces

Refitter (v1.2+) supports generating Apizr formatted Refit interfaces that can be managed then by Apizr (v6+).
Expand Down
11 changes: 7 additions & 4 deletions Apizr/Docs/Apizr.Docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ Apizr has a lot more to offer, just [read the doc](articles/index.md)!

|Project|Current|Upcoming|
|-------|-----|-----|
|Apizr.Tools.NSwag|[![NuGet](https://img.shields.io/nuget/v/Apizr.Tools.NSwag.svg)](https://www.nuget.org/packages/Apizr.Tools.NSwag/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Apizr.Tools.NSwag.svg)](https://www.nuget.org/packages/Apizr.Tools.NSwag/)|
|Refitter|[![NuGet](https://img.shields.io/nuget/v/refitter.svg)](https://www.nuget.org/packages/refitter/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.svg)](https://www.nuget.org/packages/refitter/)|
|Refitter.SourceGenerator|[![NuGet](https://img.shields.io/nuget/v/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|


Install the NuGet reference package of your choice:
Expand All @@ -211,16 +212,18 @@ Install the NuGet reference package of your choice:
- **Apizr.Integrations.FileTransfer.MediatR** package enables file transfer management for mediation requests (requires MediatR integration and could work with Optional integration) using [MediatR](https://github.com/jbogard/MediatR)
- **Apizr.Integrations.FileTransfer.Optional** package enables file transfer management for mediation requests with optional result (requires MediatR integration and could work with Optional integration) using [Optional.Async](https://github.com/dnikolovv/optional-async)

Install the NuGet .NET CLI Tool package if needed:
- **Apizr.Tools.NSwag** package enables Apizr files generation by command lines (Models, Apis and Registrations) from an OpenApi/Swagger definition using [NSwag](https://github.com/RicoSuter/NSwag)
Choose which generating approach suites to your needs by installing either:
- Refitter [.NET CLI Tool](https://refitter.github.io/articles/cli-tool.md) distributed via [nuget.org](http://www.nuget.org/packages/refitter) that outputs a single C# file on disk
- Refiiter [C# Source Generator](https://refitter.github.io/articles/source-generator.md) via the [Refitter.SourceGenerator](http://www.nuget.org/packages/refitter.sourcegenerator) package that generates code on compile time based on a [.refitter](https://refitter.github.io/articles/refitter-file-format.md) within the project directory.



Apizr core package make use of well known nuget packages to make the magic appear:

|Package|Features|
|-------|--------|
|[Refit](https://github.com/reactiveui/refit)|Auto-implement web api interface and deal with HttpClient|
|[Polly](https://github.com/App-vNext/Polly)|Apply some policies like Retry, CircuitBreaker, etc...|
|[Polly.Extensions](https://github.com/App-vNext/Polly)|Apply some policies like Retry, CircuitBreaker, etc...|
|[Microsoft.Extensions.Logging.Abstractions](https://github.com/BSiLabs/HttpTracer)|Delegate logging layer to MS Extensions Logging|

It also comes with some handling interfaces to let you provide your own services for:
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ Apizr has a lot more to offer, just [read the doc](https://apizr.net/articles/in

|Project|Current|Upcoming|
|-------|-----|-----|
|Apizr.Tools.NSwag|[![NuGet](https://img.shields.io/nuget/v/Apizr.Tools.NSwag.svg)](https://www.nuget.org/packages/Apizr.Tools.NSwag/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/Apizr.Tools.NSwag.svg)](https://www.nuget.org/packages/Apizr.Tools.NSwag/)|
|Refitter|[![NuGet](https://img.shields.io/nuget/v/refitter.svg)](https://www.nuget.org/packages/refitter/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.svg)](https://www.nuget.org/packages/refitter/)|
|Refitter.SourceGenerator|[![NuGet](https://img.shields.io/nuget/v/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|[![NuGet Pre Release](https://img.shields.io/nuget/vpre/refitter.sourcegenerator.svg)](https://www.nuget.org/packages/refitter.sourcegenerator/)|


Install the NuGet reference package of your choice:
Expand All @@ -211,16 +212,18 @@ Install the NuGet reference package of your choice:
- **Apizr.Integrations.FileTransfer.MediatR** package enables file transfer management for mediation requests (requires MediatR integration and could work with Optional integration) using [MediatR](https://github.com/jbogard/MediatR)
- **Apizr.Integrations.FileTransfer.Optional** package enables file transfer management for mediation requests with optional result (requires MediatR integration and could work with Optional integration) using [Optional.Async](https://github.com/dnikolovv/optional-async)

Install the NuGet .NET CLI Tool package if needed:
- **Apizr.Tools.NSwag** package enables Apizr files generation by command lines (Models, Apis and Registrations) from an OpenApi/Swagger definition using [NSwag](https://github.com/RicoSuter/NSwag)
Choose which generating approach suites to your needs by installing either:
- Refitter [.NET CLI Tool](https://refitter.github.io/articles/cli-tool.md) distributed via [nuget.org](http://www.nuget.org/packages/refitter) that outputs a single C# file on disk
- Refiiter [C# Source Generator](https://refitter.github.io/articles/source-generator.md) via the [Refitter.SourceGenerator](http://www.nuget.org/packages/refitter.sourcegenerator) package that generates code on compile time based on a [.refitter](https://refitter.github.io/articles/refitter-file-format.md) within the project directory.



Apizr core package make use of well known nuget packages to make the magic appear:

|Package|Features|
|-------|--------|
|[Refit](https://github.com/reactiveui/refit)|Auto-implement web api interface and deal with HttpClient|
|[Polly](https://github.com/App-vNext/Polly)|Apply some policies like Retry, CircuitBreaker, etc...|
|[Polly.Extensions](https://github.com/App-vNext/Polly)|Apply some policies like Retry, CircuitBreaker, etc...|
|[Microsoft.Extensions.Logging.Abstractions](https://github.com/BSiLabs/HttpTracer)|Delegate logging layer to MS Extensions Logging|

It also comes with some handling interfaces to let you provide your own services for:
Expand Down
6 changes: 3 additions & 3 deletions docs/articles/tools_nswag.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ <h2 id="nswag">NSwag</h2>
<div class="WARNING">
<h5>Warning</h5>
<p><strong>Deprecated</strong></p>
<p>As Apizr.Tools.NSwag is now deprecated and will be removed in a future version, please consider using <a href="tools_refitter.html">Refitter</a> (v1.2+) instead which now can generate all the Apizr boilerplate and more.</p>
<p>As Apizr.Tools.NSwag is now deprecated and will be removed in a future version, please consider using <a href="tools_refitter.html">Refitter</a> (v1.2+) instead which now can generate all the Apizr (v6+) boilerplate and more.</p>
</div>
<p>Apizr comes with a tool called Apizr.Tools.NSwag that offers to get all files generated by a couple of command lines.
<p>Apizr (v5.4-) comes with a now deprecated tool called Apizr.Tools.NSwag that offers to get all files generated by a couple of command lines.
It relies on the well known NSwag CLI, letting define all we need in a json configuration file, and generating models, services and a registration helper class.</p>
<h3 id="installing">Installing</h3>
<p>The first time you plan to use the tool, start by installing it:</p>
Expand Down Expand Up @@ -226,7 +226,7 @@ <h5>Warning</h5>
</ul>
</li>
<li><code>withPriority</code> (default: <code>false</code>): include priority management into registration process</li>
<li><code>withRetry</code> (default: <code>false</code>): add a ResiliencePipeline assembly attribute handling transient http error and a pipeline registry into registration process</li>
<li><code>withRetry</code> (default: <code>false</code>): add a Policy assembly attribute handling transient http error and a policy registry into registration process</li>
<li><code>withLogs</code> (default: <code>false</code>): add a Log assembly attribute and a logger factory into static only registration process</li>
<li><code>withRequestOptions</code> (default: <code>false</code>): add a RequestOptions parameter to your api methods so that you can adjust configuration at request time</li>
<li><code>withCacheProvider</code> (default: <code>None</code>):
Expand Down
23 changes: 23 additions & 0 deletions docs/articles/tools_refitter.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,29 @@ <h2 id="refitter">Refitter</h2>
<li>A <a href="https://refitter.github.io/articles/cli-tool.md">.NET CLI Tool</a> distributed via <a href="http://www.nuget.org/packages/refitter">nuget.org</a> that outputs a single C# file on disk</li>
<li>A <a href="https://refitter.github.io/articles/source-generator.md">C# Source Generator</a> via the <a href="http://www.nuget.org/packages/refitter.sourcegenerator">Refitter.SourceGenerator</a> package that generates code on compile time based on a <a href="https://refitter.github.io/articles/refitter-file-format.md">.refitter</a> within the project directory.</li>
</ul>
<h3 id="installing-the-package">Installing the package</h3>
<p>Choose which generating approach suites to your needs by installing either:</p>
<table>
<thead>
<tr>
<th>Project</th>
<th>Current</th>
<th>Upcoming</th>
</tr>
</thead>
<tbody>
<tr>
<td>Refitter</td>
<td><a href="https://www.nuget.org/packages/refitter/"><img src="https://img.shields.io/nuget/v/refitter.svg" alt="NuGet"></a></td>
<td><a href="https://www.nuget.org/packages/refitter/"><img src="https://img.shields.io/nuget/vpre/refitter.svg" alt="NuGet Pre Release"></a></td>
</tr>
<tr>
<td>Refitter.SourceGenerator</td>
<td><a href="https://www.nuget.org/packages/refitter.sourcegenerator/"><img src="https://img.shields.io/nuget/v/refitter.sourcegenerator.svg" alt="NuGet"></a></td>
<td><a href="https://www.nuget.org/packages/refitter.sourcegenerator/"><img src="https://img.shields.io/nuget/vpre/refitter.sourcegenerator.svg" alt="NuGet Pre Release"></a></td>
</tr>
</tbody>
</table>
<h3 id="generating-the-interfaces">Generating the interfaces</h3>
<p>Refitter (v1.2+) supports generating Apizr formatted Refit interfaces that can be managed then by Apizr (v6+).</p>
<p>You can enable Apizr formatted Refit interface generation either:</p>
Expand Down
18 changes: 12 additions & 6 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,14 @@ <h3 id="generating">Generating</h3>
</thead>
<tbody>
<tr>
<td>Apizr.Tools.NSwag</td>
<td><a href="https://www.nuget.org/packages/Apizr.Tools.NSwag/"><img src="https://img.shields.io/nuget/v/Apizr.Tools.NSwag.svg" alt="NuGet"></a></td>
<td><a href="https://www.nuget.org/packages/Apizr.Tools.NSwag/"><img src="https://img.shields.io/nuget/vpre/Apizr.Tools.NSwag.svg" alt="NuGet Pre Release"></a></td>
<td>Refitter</td>
<td><a href="https://www.nuget.org/packages/refitter/"><img src="https://img.shields.io/nuget/v/refitter.svg" alt="NuGet"></a></td>
<td><a href="https://www.nuget.org/packages/refitter/"><img src="https://img.shields.io/nuget/vpre/refitter.svg" alt="NuGet Pre Release"></a></td>
</tr>
<tr>
<td>Refitter.SourceGenerator</td>
<td><a href="https://www.nuget.org/packages/refitter.sourcegenerator/"><img src="https://img.shields.io/nuget/v/refitter.sourcegenerator.svg" alt="NuGet"></a></td>
<td><a href="https://www.nuget.org/packages/refitter.sourcegenerator/"><img src="https://img.shields.io/nuget/vpre/refitter.sourcegenerator.svg" alt="NuGet Pre Release"></a></td>
</tr>
</tbody>
</table>
Expand All @@ -374,9 +379,10 @@ <h3 id="generating">Generating</h3>
<li><strong>Apizr.Integrations.FileTransfer.MediatR</strong> package enables file transfer management for mediation requests (requires MediatR integration and could work with Optional integration) using <a href="https://github.com/jbogard/MediatR">MediatR</a></li>
<li><strong>Apizr.Integrations.FileTransfer.Optional</strong> package enables file transfer management for mediation requests with optional result (requires MediatR integration and could work with Optional integration) using <a href="https://github.com/dnikolovv/optional-async">Optional.Async</a></li>
</ul>
<p>Install the NuGet .NET CLI Tool package if needed:</p>
<p>Choose which generating approach suites to your needs by installing either:</p>
<ul>
<li><strong>Apizr.Tools.NSwag</strong> package enables Apizr files generation by command lines (Models, Apis and Registrations) from an OpenApi/Swagger definition using <a href="https://github.com/RicoSuter/NSwag">NSwag</a></li>
<li>Refitter <a href="https://refitter.github.io/articles/cli-tool.md">.NET CLI Tool</a> distributed via <a href="http://www.nuget.org/packages/refitter">nuget.org</a> that outputs a single C# file on disk</li>
<li>Refiiter <a href="https://refitter.github.io/articles/source-generator.md">C# Source Generator</a> via the <a href="http://www.nuget.org/packages/refitter.sourcegenerator">Refitter.SourceGenerator</a> package that generates code on compile time based on a <a href="https://refitter.github.io/articles/refitter-file-format.md">.refitter</a> within the project directory.</li>
</ul>
<p>Apizr core package make use of well known nuget packages to make the magic appear:</p>
<table>
Expand All @@ -392,7 +398,7 @@ <h3 id="generating">Generating</h3>
<td>Auto-implement web api interface and deal with HttpClient</td>
</tr>
<tr>
<td><a href="https://github.com/App-vNext/Polly">Polly</a></td>
<td><a href="https://github.com/App-vNext/Polly">Polly.Extensions</a></td>
<td>Apply some policies like Retry, CircuitBreaker, etc...</td>
</tr>
<tr>
Expand Down
Loading

0 comments on commit 40afdcf

Please sign in to comment.