Skip to content

Commit a0d5bff

Browse files
committed
review feedback on docs
1 parent ea46194 commit a0d5bff

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

docs/usage/openapi/openapi-generator.md renamed to docs/usage/openapi/api-description.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenAPI generator
1+
# OpenAPI API Description
22

33
You can describe your API with an OpenAPI specification using the [Swashbuckle](https://github.com/domaindrivendev/Swashbuckle.AspNetCore) integration for JsonApiDotNetCore.
44

docs/usage/openapi/client-generator.md renamed to docs/usage/openapi/client-library.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Client Generator
1+
# OpenAPI Client Library
22

3-
You can you can generate a client library from an OpenAPI specification that describes a JsonApiDotNetCore application. For clients genearted with using [NSwag](http://stevetalkscode.co.uk/openapireference-commands) we provide an additional package that enables partial write requests.
3+
You can generate a client library in various programming languages from the OpenAPI specification file that JsonApiDotNetCore APIs provide. For C# .NET clients generated using NSwag, we provide an additional package that introduces support for sending partial write requests.
44

55
## Installation
66

@@ -42,8 +42,8 @@ Add a reference to your OpenAPI specification in your project file as demonstrat
4242
```xml
4343
<ItemGroup>
4444
<OpenApiReference Include="swagger.json">
45-
<Namespace>ApiConsumer.GeneratedCode</Namespace>
46-
<ClassName>OpenApiClient</ClassName>
45+
<Namespace>JsonApiDotNetCoreExampleClient.GeneratedCode</Namespace>
46+
<ClassName>ExampleApiClient</ClassName>
4747
<CodeGenerator>NSwagCSharp</CodeGenerator>
4848
<Options>/UseBaseUrl:false /GenerateClientInterfaces:true</Options>
4949
</OpenApiReference>
@@ -57,17 +57,17 @@ The NSwag tooling generates the OpenAPI client during a prebuild step. Once your
5757
you can instantiate it using the class name as indicated in the project file.
5858

5959
```c#
60-
namespace ApiConsumer
60+
namespace JsonApiDotNetCoreExampleClient
6161
{
6262
class Program
6363
{
6464
static void Main(string[] args)
6565
{
6666
using (HttpClient httpClient = new HttpClient())
6767
{
68-
OpenApiClient openApiClient = new OpenApiClient(httpClient);
68+
ExampleApiClient exampleApiClient = new ExampleApiClient(httpClient);
6969

70-
// IntelliSense is now available on `openApiClient`!
70+
// IntelliSense is now available on `exampleApiClient`!
7171
}
7272
}
7373
}
@@ -77,10 +77,10 @@ namespace ApiConsumer
7777
Support for partial write requests can be enabled by leveraging the extensibility points of the generated client.
7878

7979
```c#
80-
// Note that this class should be namespace in which NSwag generates the client.
81-
namespace ApiConsumer.GeneratedCode
80+
namespace JsonApiDotNetCoreExampleClient.GeneratedCode
8281
{
83-
public partial class OpenApiClient : JsonApiClient
82+
// Note that this class should be in the same namespace as the ExampleApiClient generated by NSwag.
83+
public partial class ExampleApiClient : JsonApiClient
8484
{
8585
partial void UpdateJsonSerializerSettings(JsonSerializerSettings settings)
8686
{
@@ -98,34 +98,34 @@ static void Main(string[] args)
9898
{
9999
using (HttpClient httpClient = new HttpClient())
100100
{
101-
OpenApiClient openApiClient = new OpenApiClient(httpClient);
101+
ExampleApiClient exampleApiClient = new ExampleApiClient(httpClient);
102102

103-
var requestDocument = new ApiResourcePatchRequestDocument
103+
var requestDocument = new PersonPatchRequestDocument
104104
{
105-
Data = new ApiResourceDataInPatchRequest
105+
Data = new PersonDataInPatchRequest
106106
{
107-
Id = 543,
108-
Type = ApiResourceResourceType.Airplanes,
109-
Attributes = new ApiResourceAttributesInPatchRequest
107+
Id = "546",
108+
Type = PersonResourceType.People,
109+
Attributes = new PersonAttributesInPatchRequest
110110
{
111-
someNullableAttribute = "Value"
111+
FirstName = "Jack"
112112
}
113113
}
114114
};
115115

116-
using (apiClient.RegisterAttributesForRequestDocument<ApiResourcePatchRequestDocument, ApiResourceDataInPatchRequest>(requestDocument, apiResource => apiResource.AnotherNullableAttribute)
116+
using (apiClient.RegisterAttributesForRequestDocument<PersonPatchRequestDocument, PersonDataInPatchRequest>(requestDocument, person => person.LastName)
117117
{
118-
await apiClient.PatchApiResourceAsync(543, requestDocument));
118+
await exampleApiClient.PatchPersonAsync(543, requestDocument));
119119

120120
// The request will look like this:
121121
//
122122
// {
123123
// "data": {
124-
// "type": "apiResource",
124+
// "type": "people",
125125
// "id": "543",
126126
// "attributes": {
127-
// "someNullableAttribute": "Value",
128-
// "anotherNullableAttribute": null,
127+
// "firstName": "Jack",
128+
// "lastName": null,
129129
// }
130130
// }
131131
// }

docs/usage/toc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
# [Caching](caching.md)
2424

2525
# OpenAPI
26-
## [Describing Your API](openapi/openapi-generator.md))
27-
## [Generating A Client](openapi/client-generator.md))
26+
## [API Description](openapi/api-description.md))
27+
## [Client Library](openapi/client-library.md))
2828

2929
# Extensibility
3030
## [Layer Overview](extensibility/layer-overview.md)

0 commit comments

Comments
 (0)