Skip to content

OpenAPI: Support including related resources #1448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add current server into OAS, fix invalid data type warning in examples
  • Loading branch information
bkoelman committed Feb 2, 2024
commit e27c98fa04fe2c42f2d870eff6e8d64d0b5baafb
6 changes: 3 additions & 3 deletions docs/usage/openapi-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The next steps describe how to generate a JSON:API client library and use our pa

```c#
using var httpClient = new HttpClient();
var apiClient = new ExampleApiClient("http://localhost:14140", httpClient);
var apiClient = new ExampleApiClient(httpClient);

PersonCollectionResponseDocument getResponse = await apiClient.GetPersonCollectionAsync(new Dictionary<string, string?>
{
Expand Down Expand Up @@ -145,13 +145,13 @@ From here, continue from step 3 in the list of steps for Visual Studio.
The `OpenApiReference` element in the project file accepts an `Options` element to pass additional settings to the client generator,
which are listed [here](https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Commands/Commands/CodeGeneration/OpenApiToCSharpClientCommand.cs).

For example, the next section puts the generated code in a namespace, removes the `baseUrl` parameter and generates an interface (which is handy for dependency injection):
For example, the next section puts the generated code in a namespace and generates an interface (which is handy for dependency injection):

```xml
<OpenApiReference Include="swagger.json">
<Namespace>ExampleProject.GeneratedCode</Namespace>
<ClassName>SalesApiClient</ClassName>
<CodeGenerator>NSwagCSharp</CodeGenerator>
<Options>/UseBaseUrl:false /GenerateClientInterfaces:true</Options>
<Options>/GenerateClientInterfaces:true</Options>
</OpenApiReference>
```
Loading