Skip to content

Commit

Permalink
# CICD and docs
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed May 2, 2024
1 parent acbd301 commit 3ed4580
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: |-
mkdir -p ../build
npm install
export ROOT_PATH=../spec/opensearch-openapi.yaml
export ROOT_PATH=../spec
export OUTPUT_PATH=../build/opensearch-openapi.yaml
npm run merge -- $ROOT_PATH $OUTPUT_PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage-gather.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: |-
mkdir -p ../build
npm install
export ROOT_PATH=../spec/opensearch-openapi.yaml
export ROOT_PATH=../spec
export OUTPUT_PATH=../build/opensearch-openapi.yaml
npm run merge -- $ROOT_PATH $OUTPUT_PATH
- name: Build and Run Docker Container
Expand Down
11 changes: 6 additions & 5 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ spec
│ ├── cat.aliases.yaml
│ └── ...
└── opensearch-openapi.yaml
├── _info.yaml
├── _global_parameters.yaml
└── _superseded_operations.yaml
```

- The API Operations are grouped by namespaces in [spec/namespaces/](spec/namespaces) directory. Each file in this directory represents a namespace and holds all paths and operations of the namespace.
- The data schemas are grouped by categories in [spec/schemas/](spec/schemas) directory. Each file in this directory represents a category.
- The [spec/opensearch-openapi.yaml](spec/opensearch-openapi.yaml) file is the OpenAPI root file that ties everything together.

Every `.yaml` file is a OpenAPI 3 document. This means that you can use any OpenAPI 3 compatible tool to view and edit the files, and IDEs with OpenAPI support will also offer autocomplete and validation in realtime.
Every `.yaml` file in the namespaces and schemas folders is a OpenAPI 3 document. This means that you can use any OpenAPI 3 compatible tool to view and edit the files, and IDEs with OpenAPI support will also offer autocomplete and validation in realtime.

## Grouping Operations

Expand Down Expand Up @@ -100,7 +101,7 @@ if and only if the superseding operations exist in the spec. A warning will be p
Note that the path parameter names do not need to match. So, if the actual superseding operations have path of `/_plugins/_anomaly_detection/{node_id}/stats/{stat_id}`, the merger tool will recognize that it is the same as `/_plugins/_anomaly_detection/{nodeId}/stats/{stat}` and generate the superseded operations accordingly with the correct path parameter names.

## Global Parameters
Certain query parameters are global, and they are accepted by every operation. These parameters are listed in the [root file](spec/opensearch-openapi.yaml) under the `parameters` section with `x-global` set to true. The merger tool will automatically add these parameters to all operations.
Certain query parameters are global, and they are accepted by every operation. These parameters are listed in the [spec/_global_parameters.yaml](spec/_global_parameters.yaml). The merger tool will automatically add these parameters to all operations.

## OpenAPI Extensions

Expand All @@ -112,7 +113,7 @@ This repository includes several OpenAPI Specification Extensions to fill in any
- `x-version-removed`: OpenSearch version when the operation/parameter was removed.
- `x-deprecation-message`: Reason for deprecation and guidance on how to prepare for the next major version.
- `x-ignorable`: Denotes that the operation should be ignored by the client generator. This is used in operation groups where some operations have been replaced by newer ones, but we still keep them in the specs because the server still supports them.
- `x-global`: Denotes that the parameter is a global parameter that is included in every operation. These parameters are listed in the [root file](spec/opensearch-openapi.yaml).
- `x-global`: Denotes that the parameter is a global parameter that is included in every operation. These parameters are listed in the [spec/_global_parameters.yaml](spec/_global_parameters.yaml).
- `x-default`: Contains the default value of a parameter. This is often used to override the default value specified in the schema, or to avoid accidentally changing the default value when updating a shared schema.

## Tools
Expand Down
2 changes: 1 addition & 1 deletion _plugins/openapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def self.generate(_site, _payload)

Dir.chdir('tools') do
system 'npm install'
system 'npm run merge -- ../spec/opensearch-openapi.yaml ../_site/opensearch-openapi.yaml'
system 'npm run merge -- ../spec ../_site/opensearch-openapi.yaml'
end

@generated = true
Expand Down
4 changes: 2 additions & 2 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Example:

```bash
mkdir -p ../build
export ROOT_PATH=../spec/opensearch-openapi.yaml
export ROOT_PATH=../spec
export OUTPUT_PATH=../build/opensearch-openapi.yaml
npm run merge -- $ROOT_PATH $OUTPUT_PATH
```

As a shortcut, if those parameters are not provided, the tool will use the default values:
- `../spec/opensearch-openapi.yaml` as the root path (i.e. the root file of the repo's [spec folder](../spec))
- `../spec` as the root path (i.e. the repo's [spec folder](../spec))
- `../opensearch-openapi.yaml` as the output path

```bash
Expand Down

0 comments on commit 3ed4580

Please sign in to comment.