Skip to content

Multi-Language Support for Spec-Insert -> Python #10187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
- [Query parameters](#query-parameters)
- [Path parameters](#path-parameters)
- [Endpoints](#endpoints)

- [Example_Code](#example_code)

## Introduction

The `.md` documents in this repository are rendered into HTML pages using [Jekyll](https://jekyllrb.com/). These HTML pages are hosted on [opensearch.org](https://docs.opensearch.org/latest/).
Expand Down Expand Up @@ -88,6 +89,65 @@ All spec insert components accept the following arguments:
- `component` (String; required): The name of the component to render, such as `query_parameters`, `path_parameters`, or `endpoints`.
- `omit_header` (Boolean; Default is `false`): If set to `true`, the markdown header of the component will not be rendered.

### Example_Code

- `api` should not be placed for the `component: example_code` tag. `rest` is mapped to the correct API by regex mapping.
- `rest` (String; required): The HTTP request line (`HTTP method` + `endpoint path`) that is regex mapped to the `opensearch-openapi.yaml`.

The following tags are included to help with additional needs:

- `body` (String; optional): The request body for the API call, using YAML `|` to preserve newlines and indentation.
- `include_client_setup:` (Boolean; Default is `false`): If set to `true`, the client setup for the language will be rendered.
- `skip` (Boolean; Default is `false`): If set to `true`, the language conversions will not render/re-render. Use for manual conversions.

To insert multi-language support for the `cat.allocation` API, use the following snippet:

```markdown
<!-- spec_insert_start
component: example_code
rest: GET /_cat/allocation?v
-->
<!-- spec_insert_end -->
```

To insert multi-language support for the `index` API with a request body, use the following snippet. The `|` is needed for multiline support for the body:

```markdown
<!-- spec_insert_start
component: example_code
rest: PUT /_settings?expand_wildcards=all&analyze_wildcard
body: |
{
"index": {
"number_of_replicas": 2
}
}
-->
<!-- spec_insert_end -->
```

To insert multi-language support for the `index` API and include the client setup for each language, use the following snippet:

```markdown
<!-- spec_insert_start
component: example_code
rest: PUT /_settings?expand_wildcards=all&analyze_wildcard
include_client_setup: true
-->
<!-- spec_insert_end -->
```

To insert multi-language support for the `index` API but need to manually set the multi-language example for the `index` API, use the following snippet:

```markdown
<!-- spec_insert_start
component: example_code
rest: PUT /_settings?expand_wildcards=all&analyze_wildcard
skip: true
-->
<!-- spec_insert_end -->
```

### Endpoints
To insert endpoints for the `search` API, use the following snippet:

Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-allocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-cluster_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-count.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-field-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-health.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-nodeattrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/cat/cat-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -47,7 +47,7 @@ The following table lists the available query parameters. All query parameters a
| `h` | List | A comma-separated list of column names to display. | N/A |
| `help` | Boolean | Returns help information. | `false` |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/cat/cat-pending-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -44,7 +44,7 @@ The following table lists the available query parameters. All query parameters a
| `help` | Boolean | Returns help information. | `false` |
| `local` | Boolean | Returns local information but does not retrieve the state from the cluster manager node. | `false` |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-pit-segments.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/cat/cat-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -47,7 +47,7 @@ The following table lists the available query parameters. All query parameters a
| `help` | Boolean | Returns help information. | `false` |
| `index` | List | A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. | N/A |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
6 changes: 3 additions & 3 deletions _api-reference/cat/cat-segment-replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ include_deprecated: false
-->
## Path parameters

The following table lists the available path parameters. All path parameters are optional.
The following table lists the available path parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand All @@ -51,7 +51,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -69,7 +69,7 @@ The following table lists the available query parameters. All query parameters a
| `index` | List | A comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (`*`). To target all data streams and indexes, omit this parameter or use `*` or `_all`. | N/A |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `shards` | List | A comma-separated list of shards to display. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `timeout` | String | The operation timeout. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-segments.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/cat/cat-shards.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -46,7 +46,7 @@ The following table lists the available query parameters. All query parameters a
| `help` | Boolean | Returns help information. | `false` |
| `local` | Boolean | Returns local information but does not retrieve the state from the cluster manager node. | `false` |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The following table lists the available query parameters.
| `help` | Boolean | Returns help information. | `false` |
| `ignore_unavailable` | Boolean | When `true`, the response does not include information from unavailable snapshots. | `false` |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/cat/cat-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand All @@ -45,7 +45,7 @@ The following table lists the available query parameters. All query parameters a
| `nodes` | List | A comma-separated list of node IDs or names used to limit the returned information. Use `_local` to return information from the node to which you're connecting, specify a specific node from which to get information, or keep the parameter empty to get information from all nodes. | N/A |
| `parent_task_id` | String | The parent task identifier, which is used to limit the response. | N/A |
| `s` | List | A comma-separated list of column names or column aliases to sort by. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units]({{site.url}}{{site.baseurl}}/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `time` | String | Specifies the time units, for example, `5d` or `7h`. For more information, see [Supported units](https://opensearch.org/docs/latest/api-reference/units/). <br> Valid values are: `nanos`, `micros`, `ms`, `s`, `m`, `h`, and `d`. | N/A |
| `v` | Boolean | Enables verbose mode, which displays column headers. | `false` |

<!-- spec_insert_end -->
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/cat/cat-thread-pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/document-apis/mtermvectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ component: path_parameters
-->
## Path parameters

The following table lists the available path parameters. All path parameters are optional.
The following table lists the available path parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand All @@ -43,7 +43,7 @@ columns: Parameter, Data type, Description
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/security/authentication/auth-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand Down
4 changes: 2 additions & 2 deletions _api-reference/snapshots/clone-snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ include_deprecated: false
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
| `cluster_manager_timeout` | String | The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters]({{site.url}}{{site.baseurl}}/api-reference/common-parameters/#time-units). |
| `cluster_manager_timeout` | String | The amount of time to wait for a response from the cluster manager node. For more information about supported time units, see [Common parameters](https://opensearch.org/docs/latest/api-reference/common-parameters/#time-units). |

<!-- spec_insert_end -->

Expand Down
4 changes: 2 additions & 2 deletions _api-reference/tasks/cancel-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ component: path_parameters
-->
## Path parameters

The following table lists the available path parameters. All path parameters are optional.
The following table lists the available path parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand All @@ -43,7 +43,7 @@ component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description |
| :--- | :--- | :--- |
Expand Down
2 changes: 1 addition & 1 deletion _api-reference/tasks/get-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ component: query_parameters
-->
## Query parameters

The following table lists the available query parameters. All query parameters are optional.
The following table lists the available query parameters.

| Parameter | Data type | Description | Default |
| :--- | :--- | :--- | :--- |
Expand Down
Loading