diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ceb549a69..a325840b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/coverage-gather.yml b/.github/workflows/coverage-gather.yml index 703c0c6ab..d3b378b90 100644 --- a/.github/workflows/coverage-gather.yml +++ b/.github/workflows/coverage-gather.yml @@ -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 diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 37274d43e..145d9c2e1 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -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 @@ -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 @@ -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 diff --git a/_plugins/openapi.rb b/_plugins/openapi.rb index 82bae554f..23a612b27 100644 --- a/_plugins/openapi.rb +++ b/_plugins/openapi.rb @@ -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 diff --git a/tools/README.md b/tools/README.md index 008449bd8..a9bffabab 100644 --- a/tools/README.md +++ b/tools/README.md @@ -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