Skip to content
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ refitter [path to OpenAPI spec file] --namespace "[Your.Namespace.Of.Choice.Gene

This will generate a file called `Output.cs` which contains the Refit interface and contract classes generated using [NSwag](https://github.com/RicoSuter/NSwag)

### CLI Tool Output Example

Here's what the console output looks like when running the Refitter CLI tool:

![Console Output](images/console-output.png)

## Source Generator

Refitter is available as a C# Source Generator that uses the [Refitter.Core](https://github.com/christianhelle/refitter/tree/main/src/Refitter.Core) library for generating a REST API Client using the [Refit](https://github.com/reactiveui/refit) library. Refitter can generate the Refit interface from OpenAPI specifications. Refitter could format the generated Refit interface to be managed by [Apizr](https://www.apizr.net) and generate some registration helpers too.
Expand Down
11 changes: 9 additions & 2 deletions docs/docfx_project/articles/cli-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,17 @@ OPTIONS:
Replaces NSwag JsonInheritanceConverter attributes with System.Text.Json JsonPolymorphicAttributes.
To have the native support of inheritance (de)serialization and fallback to base types when
payloads with (yet) unknown types are offered by newer versions of an API
See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information
--disposable Generate refit clients that implement IDisposable
See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information --disposable Generate refit clients that implement IDisposable
```

## CLI Tool Output Example

Here's what the console output looks like when running the Refitter CLI tool:

![Console Output](https://raw.githubusercontent.com/christianhelle/refitter/refs/heads/main/images/console-output.png)

## Basic Usage

To generate code from an OpenAPI specifications file, run the following:

```shell
Expand Down
4 changes: 4 additions & 0 deletions docs/docfx_project/articles/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Here's an example generated output from the [Swagger Petstore example](https://p
$ refitter ./openapi.json --namespace "Your.Namespace.Of.Choice.GeneratedCode"
```

**Console Output**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use a Markdown heading instead of bold text for section titles.

The new section is introduced with **Console Output**, which triggers MD036 (emphasis used instead of a heading). Replace it with an appropriate heading level (e.g., ### Console Output) for consistency and accessibility.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

11-11: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)

🤖 Prompt for AI Agents
In docs/docfx_project/articles/examples.md at line 11, replace the bold text
"**Console Output**" with a Markdown heading, such as "### Console Output", to
properly format the section title and resolve the MD036 warning.


![Console Output](https://raw.githubusercontent.com/christianhelle/refitter/refs/heads/main/images/console-output.png)

**Source Generator ***.refitter*** file**

```json
Expand Down
9 changes: 7 additions & 2 deletions src/Refitter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,15 @@ OPTIONS:
Replaces NSwag JsonInheritanceConverter attributes with System.Text.Json JsonPolymorphicAttributes.
To have the native support of inheritance (de)serialization and fallback to base types when
payloads with (yet) unknown types are offered by newer versions of an API
See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information
--disposable Generate refit clients that implement IDisposable
See https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism for more information --disposable Generate refit clients that implement IDisposable
```

## CLI Tool Output Example

Here's what the console output looks like when running the Refitter CLI tool:

![Console Output](https://raw.githubusercontent.com/christianhelle/refitter/refs/heads/main/images/console-output.png)

### .Refitter File format

The following is an example `.refitter` file
Expand Down