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: website/docs/contributing/add-new-api-client.md
+10-12Lines changed: 10 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,6 @@ Make sure to first [setup the repository tooling](/docs/contributing/setup-repos
8
8
9
9
:::
10
10
11
-
# Add a new API client
12
-
13
11
Adding a new API client requires some manual steps in order to have a properly working client:
14
12
15
13
1.[Writing specs](#1-writing-specs)
@@ -40,34 +38,34 @@ We recommend to have a look at [existing spec files](https://github.com/algolia/
40
38
41
39
> Example with the [search client spec](https://github.com/algolia/api-clients-automation/blob/main/specs/search/)
42
40
43
-
#### `spec.yml` file
41
+
#### **`spec.yml` file**
44
42
45
43
The `spec.yml` file is the entry point of the client spec, it contains `servers`, `paths` and other specific information of the API. We recommend to copy an existing [`spec.yml` file](https://github.com/algolia/api-clients-automation/blob/main/specs/search/spec.yml) to get started.
46
44
47
-
#### `<clientName>`/common folder
45
+
#### **`<clientName>`/common folder**
48
46
49
47
Same as [the `common` folder](#common-spec-folder) but only related to the current client.
50
48
51
-
#### `<clientName>`/paths folder
49
+
#### **`<clientName>`/paths folder**
52
50
53
51
Path definition of the paths defined in the [spec file](#specyml-file). See [guidelines](#guidelines).
In some cases, you can encounter wrongly named `requestBody` from the specs, which is due to:
59
+
In some cases, you can encounter wrongly named `requestBody` from the specs, which could be due to:
62
60
63
61
- The type is too complex/too broad to be generated. (e.g. [An object with `additionalProperties`](https://github.com/algolia/api-clients-automation/tree/main/specs/search/paths/objects/partialUpdate.yml#L24-L33))
64
-
- The body is an alias of its sub type (e.g. [A list of sub models](https://github.com/algolia/api-clients-automation/tree/main/specs/search/paths/rules/saveRules.yml#L12-L20))
62
+
- The type is an alias of its model (e.g. [A list of `model`](https://github.com/algolia/api-clients-automation/tree/main/specs/search/paths/rules/saveRules.yml#L12-L20))
65
63
66
-
The `x-codegen-request-body-name` property can be added at the root of the spec, to force the name of the generated `requestBody` property.
64
+
The [`x-codegen-request-body-name`](https://openapi-generator.tech/docs/swagger-codegen-migration/#body-parameter-name) property can be added at the root of the spec, to force the name of the generated `requestBody` property.
67
65
68
66
You can find an example of this implementation [on this PR](https://github.com/algolia/api-clients-automation/pull/896).
69
67
70
-
#### Send additional options to the template
68
+
#### **Send additional options to the template**
71
69
72
70
You might want to send additional information to the generators. To do so, you can add parameters starting with an `x-` at the root level of your spec, which will be available in the `mustache` template under the `vendorExtensions` object.
73
71
@@ -77,11 +75,11 @@ You might want to send additional information to the generators. To do so, you c
77
75
78
76
> The generator follows its own configuration file named `config/openapitools.json`
79
77
80
-
### Generation config
78
+
### Configs
81
79
82
80
[`config/openapitools.json`](https://github.com/algolia/api-clients-automation/blob/main/config/openapitools.json) and [`config/clients.config.json`](https://github.com/algolia/api-clients-automation/blob/main/config/clients.config.json) hosts the configuration of all of the generated clients with their available languages and extra information.
83
81
84
-
#### `generators`
82
+
#### Settings
85
83
86
84
Generators are referenced by key with the following pattern `<languageName>-<clientName>`. You can copy an existing object of a client and replace the `<clientName>` value with the one you'd like to generate.
0 commit comments