Skip to content

Commit bad2687

Browse files
committed
Use WrapResponses option for NSwag
1 parent b06f338 commit bad2687

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Examples/JsonApiDotNetCoreExampleClient/JsonApiDotNetCoreExampleClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<ItemGroup>
2727
<OpenApiReference Include="..\JsonApiDotNetCoreExample\GeneratedSwagger\JsonApiDotNetCoreExample.json" CodeGenerator="NSwagCSharp" ClassName="ExampleApiClient">
28-
<Options>/GenerateExceptionClasses:false /AdditionalNamespaceUsages:JsonApiDotNetCore.OpenApi.Client.Exceptions</Options>
28+
<Options>/GenerateExceptionClasses:false /WrapResponses:true /ResponseClass:JsonApiResponse /AdditionalNamespaceUsages:JsonApiDotNetCore.OpenApi.Client.Exceptions</Options>
2929
</OpenApiReference>
3030
</ItemGroup>
3131
</Project>

src/Examples/JsonApiDotNetCoreExampleClient/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212

1313
var apiClient = new ExampleApiClient(httpClient);
1414

15-
PersonCollectionResponseDocument getResponse = await apiClient.GetPersonCollectionAsync(new Dictionary<string, string?>
15+
JsonApiResponse<PersonCollectionResponseDocument> getResponse = await apiClient.GetPersonCollectionAsync(new Dictionary<string, string?>
1616
{
1717
["filter"] = "has(assignedTodoItems)",
1818
["sort"] = "-lastName",
1919
["page[size]"] = "5",
2020
["include"] = "assignedTodoItems.tags"
2121
});
2222

23-
foreach (PersonDataInResponse person in getResponse.Data)
23+
foreach (PersonDataInResponse person in getResponse.Result.Data)
2424
{
25-
PrintPerson(person, getResponse.Included);
25+
PrintPerson(person, getResponse.Result.Included);
2626
}
2727

2828
var patchRequest = new PersonPatchRequestDocument

0 commit comments

Comments
 (0)