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/Customization.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Customizations
2
2
3
-
OpenAPI and Swagger type providers one or several provided API client (depending on the value of `IgnoreControllerPrefix`).
4
-
Each provided API client is subclass of `ProvidedApiClientBase` that allow you control and customize HTTP calls.
3
+
OpenAPI and Swagger type providers one or several provided API clients (depending on the value of `IgnoreControllerPrefix`).
4
+
Each provided API client is a subclass of `ProvidedApiClientBase` that allows you to control and customize HTTP calls.
5
5
6
6
```fsharp
7
7
type ProvidedApiClientBase(httpClient: HttpClient) =
@@ -11,11 +11,11 @@ type ProvidedApiClientBase(httpClient: HttpClient) =
11
11
abstract member Deserialize: string * Type -> obj
12
12
```
13
13
14
-
Snippet shows only most important parts of `ProvidedApiClientBase`, the full source code provide default implementation for `Serialize` & `Deserialize` methods that tightly coupled with [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/).
14
+
The snippet shows only the most important parts of `ProvidedApiClientBase`, the full source code provides a default implementation for `Serialize` & `Deserialize` methods that tightly coupled with [Newtonsoft.Json](https://www.nuget.org/packages/Newtonsoft.Json/).
15
15
16
16
**Key features:**
17
-
1. You can provide your own instance of `HttpClient` during API client construction and control HTTP request execution (If you will not provide `HttpClient`, type provider create default one for you).
18
-
2.`Serialize` and `Deserialize` methods are abstract. If you are not happy with default `JsonSerializerSettings` you can override them and configure `Newtonsoft.Json` as you like.
17
+
1. You can provide your own instance of `HttpClient` during API client construction and control HTTP request execution (If you will not provide `HttpClient`, the type provider creates the default one for you).
18
+
2.`Serialize` and `Deserialize` methods are abstract. If you are not happy with the default `JsonSerializerSettings` you can override them and configure `Newtonsoft.Json` as you like.
19
19
20
20
## Request interception
21
21
@@ -55,7 +55,7 @@ let main argv =
55
55
56
56
## Authentication
57
57
58
-
Authentication is just a special case `Request interception`. Your custom `DelegatingHandler` is fully responsible for management of authentication information (attach Authentication Header, authentication cookie, invalidate it and etc.).
58
+
Authentication is just a special case of `Request interception`. Your custom `DelegatingHandler` is fully responsible for the management of authentication information (attach Authentication Header, authentication cookie, invalidate it and etc.).
59
59
60
60
```fsharp {highlight:['4-6']}
61
61
type AuthHandler(messageHandler) =
@@ -80,7 +80,7 @@ let client = PetStore.Client(httpClient)
80
80
81
81
## Serialization
82
82
83
-
Serialization is also quite flexible. All you need it to define your own type for API client that will be subclass of API client generated by type provider and override `Serialize` and `Deserialize` members.
83
+
Serialization is also quite flexible. All you need is to define your own type for API client that will be a subclass of API client generated by the type provider and override `Serialize` and `Deserialize` members.
Copy file name to clipboardExpand all lines: docs/OpenApiClientProvider.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# OpenAPI Client Provider
2
2
3
-
OpenApiClientProvider is generative F# Type Provider, build on top of [Microsoft.OpenApi.Readers](https://www.nuget.org/packages/Microsoft.OpenApi.Readers/) schema parser that supports 3.0 and 2.0 schema formats.
3
+
OpenApiClientProvider is a generative F# Type Provider, built on top of [Microsoft.OpenApi.Readers](https://www.nuget.org/packages/Microsoft.OpenApi.Readers/) schema parser that supports 3.0 and 2.0 schema formats.
4
4
5
5
```fsharp
6
6
open SwaggerProvider
@@ -12,7 +12,7 @@ let client = PetStore.Client()
12
12
13
13
## Parameters
14
14
15
-
`OpenApiClientProvider` supports following configuration parametes
15
+
`OpenApiClientProvider` supports the following configuration parameters
16
16
17
17
| Parameter | Description |
18
18
|-----------|-------------|
@@ -43,15 +43,15 @@ type PetStore = OpenApiClientProvider<Schema>
43
43
let main argv =
44
44
// `UseCookies = false` is required if you use Cookie Parameters
45
45
let handler = new HttpClientHandler (UseCookies = false)
46
-
// `BaseAddress` uri should ends with '/' because TP generate relative uri
46
+
// `BaseAddress` uri should end with '/' because TP generate relative uri
47
47
let baseUri = Uri("https://petstore.swagger.io/v2/")
48
48
use httpClient = new HttpClient(handler, true, BaseAddress=baseUri)
49
-
// You can provide your instance of `HttpClient` to provided api client
49
+
// You can provide your instance of `HttpClient` to the provided api client
50
50
// or change it any time in runtime using `client.HttpClient` property
51
51
let client = PetStore.Client(httpClient)
52
52
53
53
task {
54
-
// Create new instance of provided type and add to store
54
+
// Create a new instance of the provided type and add to store
55
55
let pet = PetStore.Pet(Id = Some(24L), Name = "Shani")
`SwaggerProvider` is an umbrella project for two F# generative Type Providers that generate object model and HTTP clients for APIs described by [OpenApi 3.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md) and [Swagger 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) schemas
4
+
`SwaggerProvider` is an umbrella project for two F# generative Type Providers that generate object models and HTTP clients for APIs described by [OpenApi 3.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md) and [Swagger 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md) schemas
5
5
-[OpenApiClientProvider](/OpenApiClientProvider) <Badgetype="success">New</Badge> - uses [Microsoft.OpenApi.Readers](https://www.nuget.org/packages/Microsoft.OpenApi.Readers/) to parse schema. Support both OpenApi and Swagger schemas, but Swagger support is limited.
6
-
-[SwaggerClientProvider](/SwaggerClientProvider) - uses custom old good Swagger 2.0 schema parser and tested on several hundreds schemas available in [APIs.guru](https://apis.guru/openapi-directory/) (Wikipedia for WEB APIs)
6
+
-[SwaggerClientProvider](/SwaggerClientProvider) - uses custom old good Swagger 2.0 schema parser and tested on several hundred schemas available in [APIs.guru](https://apis.guru/openapi-directory/) (Wikipedia for WEB APIs)
7
7
8
-
Type Providers support schemas in `JSON` & `YAML` formats and runs on `netcoreapp3.1` and `net46`.
8
+
Type Providers support schemas in `JSON` & `YAML` formats and run on `netcoreapp3.1` and `net46`.
9
9
10
10
### Getting started
11
11
@@ -56,13 +56,13 @@ let main argv =
56
56
0
57
57
```
58
58
59
-
build and run project
59
+
build and run the project
60
60
61
61
```bash
62
62
dotnet run
63
63
```
64
64
65
-
in the console you should see printed inventory from the server.
65
+
in the console, you should see printed inventory from the server.
Copy file name to clipboardExpand all lines: docs/SwaggerClientProvider.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3
<Notetype="warning">
4
4
5
-
The SwaggerClientProvider is outdated. There is no plans to improve custom Swagger 2.0 schema parser or bring new features to this type provider. We hope to remove it from source code when users migrate to [OpenApiClientProvider](/OpenApiClientProvider) and OpenApi 3.0 schemas.
5
+
The SwaggerClientProvider is outdated. There are no plans to improve the custom Swagger 2.0 schema parser or bring new features to this type provider. We hope to remove it from the source code when users migrate to [OpenApiClientProvider](/OpenApiClientProvider) and OpenApi 3.0 schemas.
6
6
7
7
</Note>
8
8
9
-
SwaggerClientProvider is generative F# Type Provider, build on top of custom Swagger schema parser that supports **only** 2.0 schema format.
9
+
SwaggerClientProvider is a generative F# Type Provider, built on top of a custom Swagger schema parser that supports **only** 2.0 schema format.
10
10
11
11
```fsharp
12
12
open SwaggerProvider
@@ -18,12 +18,12 @@ let petStore = PetStore.Client()
18
18
19
19
## Parameters
20
20
21
-
When you use TP you can specify following parameters
21
+
When you use TP you can specify the following parameters
22
22
23
23
| Parameter | Description |
24
24
|-----------|-------------|
25
25
|`Schema`| Url or Path to Swagger schema file. |
26
-
|`Headers`| HTTP Headers requiried to access the schema. |
26
+
|`Headers`| HTTP Headers required to access the schema. |
27
27
|`IgnoreOperationId`| Do not use `operationsId` and generate method names using `path` only. Default value `false`. |
28
28
|`IgnoreControllerPrefix`| Do not parse `operationsId` as `<controllerName>_<methodName>` and generate one client class for all operations. Default value `true`. |
29
29
|`PreferNullable`| Provide `Nullable<_>` for not required properties, instead of `Option<_>`. Defaults value `false`. |
@@ -47,7 +47,7 @@ let main argv =
47
47
// Type Provider creates HttpClient for you under the hood
48
48
let client = PetStore.Client()
49
49
async {
50
-
// Create new instance of provided type and add to store
50
+
// Create a new instance of the provided type and add it to the store
51
51
let pet = PetStore.Pet(Id = Some(24L), Name = "Shani")
0 commit comments