Skip to content

Commit

Permalink
docs: Updated README.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed May 19, 2024
1 parent 17ae36b commit 355eb79
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenApiGenerator
Allows you to partially (for example, only models) or completely generate a native (without dependencies) C# client sdk according to the OpenAPI specification.
Inspired by NSwag
Inspired by [NSwag](https://github.com/RicoSuter/NSwag) ❤️.

## 🔥Features🔥
- Uses Incremental Source Generators for efficient generation and caching.
Expand All @@ -19,19 +19,28 @@ Inspired by NSwag
```bash
dotnet add package OpenApiGenerator
```
- Add the following to your csproj file. You can check all settings [here](https://github.com/HavenDV/OpenApiGenerator/blob/76c06e6e2265bc875d0619cfe96e28002fba1d3d/src/libs/OpenApiGenerator/OpenApiGenerator.props):
- Add the following optional settings to your csproj file to customize generation. You can check all settings [here](https://github.com/HavenDV/OpenApiGenerator/blob/76c06e6e2265bc875d0619cfe96e28002fba1d3d/src/libs/OpenApiGenerator/OpenApiGenerator.props):
```xml
<!-- This generator automatically detects all .yaml files in the project directory and adds them to the generation -->
<!-- If your yaml file is not in the project directory, you can specify the path to it -->
<ItemGroup Label="OpenApiGenerator">
<AdditionalFiles Include="$(MSBuildThisFileDirectory)../../../docs/openapi.yaml" />
</ItemGroup>

<!-- All settings optional -->
<PropertyGroup Label="OpenApiGenerator">
<OpenApiGenerator_Namespace>Ollama</OpenApiGenerator_Namespace>
<OpenApiGenerator_ClassName>OllamaApi</OpenApiGenerator_ClassName>
<OpenApiGenerator_GenerateModels>true</OpenApiGenerator_GenerateModels>

<!-- By default, it generates all models/methods. You can disable this behavior using these properties -->
<OpenApiGenerator_GenerateSdk>false</OpenApiGenerator_GenerateSdk>
<OpenApiGenerator_GenerateModels>true</OpenApiGenerator_GenerateModels>
<OpenApiGenerator_GenerateMethods>true</OpenApiGenerator_GenerateMethods>
<OpenApiGenerator_GenerateConstructors>true</OpenApiGenerator_GenerateConstructors>
<OpenApiGenerator_IncludeOperationIds>getPet;deletePet</OpenApiGenerator_IncludeOperationIds>
<OpenApiGenerator_ExcludeOperationIds>getPet;deletePet</OpenApiGenerator_ExcludeOperationIds>
<OpenApiGenerator_IncludeModels>Pet;Model</OpenApiGenerator_IncludeModels>
<OpenApiGenerator_ExcludeModels>Pet;Model</OpenApiGenerator_ExcludeModels>
</PropertyGroup>
```
- It's all! Now you can build your project and use the generated code. You also can use IDE to see the generated code in any moment, this is a example for Rider:
Expand Down

0 comments on commit 355eb79

Please sign in to comment.