You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/openapi-client.md
+14-9Lines changed: 14 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@ The easiest way to get started is by using the built-in capabilities of Visual S
16
16
Optionally provide a class name and namespace and click **Finish**.
17
17
Visual Studio now downloads your swagger.json and updates your project file. This results in a pre-build step that generates the client code.
18
18
19
-
Tip: To later re-download swagger.json and regenerate the client code, right-click **Dependencies** > **Manage Connected Services** and click the **Refresh** icon.
19
+
> [!TIP]
20
+
> To later re-download swagger.json and regenerate the client code, right-click **Dependencies** > **Manage Connected Services** and click the **Refresh** icon.
21
+
20
22
3. Although not strictly required, we recommend to run package update now, which fixes some issues and removes the `Stream` parameter from generated calls.
21
23
22
24
4. Add some demo code that calls one of your JSON:API endpoints. For example:
@@ -41,7 +43,7 @@ The easiest way to get started is by using the built-in capabilities of Visual S
6. Add the following glue code to connect our package with your generated code. The code below assumes you specified `ExampleApiClient` as class name in step 2.
46
+
6. Add the following glue code to connect our package with your generated code. The code below assumes you specified `ExampleApiClient` as the class name in step 2.
45
47
46
48
```c#
47
49
using JsonApiDotNetCore.OpenApi.Client;
@@ -56,6 +58,9 @@ The easiest way to get started is by using the built-in capabilities of Visual S
56
58
}
57
59
```
58
60
61
+
> [!NOTE]
62
+
> If you specified a namespace in step 2, put this class in the same namespace. For example, add `namespace GeneratedCode;` below the `using` lines.
63
+
59
64
7. Extend your demo code to send a partial PATCH request with the help of our package:
60
65
61
66
```c#
@@ -72,11 +77,11 @@ The easiest way to get started is by using the built-in capabilities of Visual S
72
77
};
73
78
74
79
// This line results in sending "lastName: null" instead of omitting it.
75
-
using (apiClient.RegisterAttributesForRequestDocument<PersonPatchRequestDocument,
76
-
PersonAttributesInPatchRequest>(patchRequest, person => person.LastName))
80
+
using (apiClient.WithPartialAttributeSerialization<PersonPatchRequestDocument, PersonAttributesInPatchRequest>(patchRequest,
By default, the OpenAPI specification will be available at `http://localhost:<port>/swagger/v1/swagger.json`.
34
35
35
36
## Documentation
36
37
37
-
Swashbuckle also ships with [SwaggerUI](https://swagger.io/tools/swagger-ui/), tooling for a generated documentation page. This can be enabled by installing the `Swashbuckle.AspNetCore.SwaggerUI` NuGet package and adding the following to your `Program.cs` file:
38
+
Swashbuckle also ships with [SwaggerUI](https://swagger.io/tools/swagger-ui/), which enables to visualize and interact with the API endpoints through a web page. This can be enabled by installing the `Swashbuckle.AspNetCore.SwaggerUI` NuGet package and adding the following to your `Program.cs` file:
0 commit comments