Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d428c57
Updating Spect Insert tool to support client code translations
Jun 17, 2025
46b0106
Continued working on the Spect Insert feature for automatic conversio…
Jul 22, 2025
b545d6a
Merge branch 'main' into Spec-Insert->HTTP-to-ProLang_Start
ReveristRealm Jul 25, 2025
5f75fb5
Continued working on the Spect Insert feature for automatic conversio…
Jul 29, 2025
2ac865f
Merge remote-tracking branch 'origin/Spec-Insert->HTTP-to-ProLang_Sta…
Jul 29, 2025
32c1278
Merge branch 'main' into Spec-Insert->HTTP-to-ProLang_Start
ReveristRealm Jul 29, 2025
cd93360
Updating Example Request with spec_insert tags
Jul 31, 2025
d83404b
Continued working on the Spec-Insert tool.
Aug 7, 2025
f26c32d
Continued working on the Spec-Insert tool.
Aug 8, 2025
9f43033
Finished Python Client Code Conversion from HTTP w/ some minor tweaks.
Aug 8, 2025
9df6657
Merge branch 'main' into Spec-Insert->HTTP-to-ProLang_Start
ReveristRealm Aug 8, 2025
dd4ebbe
Merge remote-tracking branch 'origin/Spec-Insert->HTTP-to-ProLang_Sta…
Aug 8, 2025
1c99540
Finished Python Client Code Conversion from HTTP w/ some minor tweaks.
Aug 13, 2025
d5d987f
Merge remote-tracking branch 'origin/Spec-Insert->HTTP-to-ProLang_Sta…
Aug 14, 2025
758e9b6
Finished Spec-Insert feature allowing for multi-language support.
Aug 15, 2025
2a9bb71
Merge branch 'main' into tags
ReveristRealm Aug 15, 2025
44c8528
Apply suggestions from code review
kolchfa-aws Sep 2, 2025
7e37d7b
Apply suggestions from code review
kolchfa-aws Sep 2, 2025
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
115 changes: 114 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 Expand Up @@ -153,6 +213,59 @@ pretty: true
-->
<!-- spec_insert_end -->
```
### Inserting new tags

`_script/insert_tags_block.py`

This script scans markdown documentation files in `/_api-reference` for `## Example Request(s)` headings and automatically inserts a blank `spec-insert` block for the `example_code` component. It will be placed immediately beneath the first matching
header. It supports scanning individual files, multiple files or the whole `_api-reference` tree.

Update entire _api-reference/ tree:
```
python3 _script/insert_tags_block.py
```

Update a specific folder (recursively):
```
python3 _script/insert_tags_block.py _api-reference/cat
```

Update only the top-level files in a folder (no recursion):
```
python3 _script/insert_tags_block.py _api-reference/cat --no-recursive
```

Update a specific file:
```
python3 _script/insert_tags_block.py _api-reference/cat/cat-allocation.md
```

Update multiple files/folders at once:
```
python3 _script/insert_tags_block.py _api-reference/cat _api-reference/indices/create-index.md
```

`--dry-runs` will show you what files will be modified:

Dry-run on the entire _api-reference/ tree:
```
python3 _script/insert_tags_block.py --dry-run
```

Dry-run on a specific folder (recursively):
```
python3 _script/insert_tags_block.py _api-reference/cat --dry-run
```

Dry-run on a specific file:
```
python3 _script/insert_tags_block.py _api-reference/cat/cat-allocation.md --dry-run
```

Dry-run on multiple files/folders:
```
python3 _script/insert_tags_block.py _api-reference/cat _api-reference/indices/create-index.md --dry-run
```

### Request and response bodies (Beta)

Expand Down
Loading
Loading