diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 06520a13d..762ba9841 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -84,6 +84,19 @@ This repository includes several penAPI Specification Extensions to fill in any - `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-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. +## Auto-generating Superseded Operations + +When an operation is superseded by another operation with **IDENTICAL FUNCTIONALITY**, that is a rename or a change in the URL, it should be listed in [_superseded_operations.yaml](./spec/_superseded_operations.yaml) file. The merger tool will automatically generate the superseded operation in the OpenAPI spec. The superseded operation will have `deprecated` and `x-ignorable` properties set to `true` to indicate that it should be ignored by the client generator. +For example, if the `_superseded_operations.yaml` file contains the following entry: +```yaml +/_opendistro/_anomaly_detection/{nodeId}/stats/{stat}: + superseded_by: /_plugins/_anomaly_detection/{nodeId}/stats/{stat} + operations: + - GET + - POST +``` +Then, the merger tool will generate 2 operations: `GET /_opendistro/_anomaly_detection/{nodeId}/stats/{stat}` and `POST /_opendistro/_anomaly_detection/{nodeId}/stats/{stat}` from `GET /_plugins/_anomaly_detection/{nodeId}/stats/{stat}` and `POST /_plugins/_anomaly_detection/{nodeId}/stats/{stat}` respectively, if they exist (A warning will be printed on the console if they do not). 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. + ## Linting We have a linter that validates every `yaml` file in the `./spec` folder to assure that they follow the guidelines we have set. Check out the [Linter](tools/README.md#linter) tool for more information on how to run it locally. Make sure to run the linter before submitting a PR. diff --git a/spec/_replaced_operations.yaml b/spec/_superseded_operations.yaml similarity index 57% rename from spec/_replaced_operations.yaml rename to spec/_superseded_operations.yaml index 2bb951699..5191a5b6f 100644 --- a/spec/_replaced_operations.yaml +++ b/spec/_superseded_operations.yaml @@ -1,566 +1,566 @@ /_opendistro/_alerting/destinations: - replaced_by: /_plugins/_alerting/destinations + superseded_by: /_plugins/_alerting/destinations operations: - GET /_opendistro/_alerting/destinations/email_accounts/_search: - replaced_by: /_plugins/_alerting/destinations/email_accounts/_search + superseded_by: /_plugins/_alerting/destinations/email_accounts/_search operations: - GET - POST /_opendistro/_alerting/destinations/email_accounts/{emailAccountID}: - replaced_by: /_plugins/_alerting/destinations/email_accounts/{emailAccountID} + superseded_by: /_plugins/_alerting/destinations/email_accounts/{emailAccountID} operations: - GET - HEAD /_opendistro/_alerting/destinations/email_groups/_search: - replaced_by: /_plugins/_alerting/destinations/email_groups/_search + superseded_by: /_plugins/_alerting/destinations/email_groups/_search operations: - GET - POST /_opendistro/_alerting/destinations/email_groups/{emailGroupID}: - replaced_by: /_plugins/_alerting/destinations/email_groups/{emailGroupID} + superseded_by: /_plugins/_alerting/destinations/email_groups/{emailGroupID} operations: - GET - HEAD /_opendistro/_alerting/destinations/{destinationID}: - replaced_by: /_plugins/_alerting/destinations/{destinationID} + superseded_by: /_plugins/_alerting/destinations/{destinationID} operations: - GET /_opendistro/_alerting/monitors: - replaced_by: /_plugins/_alerting/monitors + superseded_by: /_plugins/_alerting/monitors operations: - POST /_opendistro/_alerting/monitors/_execute: - replaced_by: /_plugins/_alerting/monitors/_execute + superseded_by: /_plugins/_alerting/monitors/_execute operations: - POST /_opendistro/_alerting/monitors/_search: - replaced_by: /_plugins/_alerting/monitors/_search + superseded_by: /_plugins/_alerting/monitors/_search operations: - GET - POST /_opendistro/_alerting/monitors/alerts: - replaced_by: /_plugins/_alerting/monitors/alerts + superseded_by: /_plugins/_alerting/monitors/alerts operations: - GET /_opendistro/_alerting/monitors/{monitorID}: - replaced_by: /_plugins/_alerting/monitors/{monitorID} + superseded_by: /_plugins/_alerting/monitors/{monitorID} operations: - GET - PUT - DELETE - HEAD /_opendistro/_alerting/monitors/{monitorID}/_acknowledge/alerts: - replaced_by: /_plugins/_alerting/monitors/{monitorID}/_acknowledge/alerts + superseded_by: /_plugins/_alerting/monitors/{monitorID}/_acknowledge/alerts operations: - POST /_opendistro/_alerting/monitors/{monitorID}/_execute: - replaced_by: /_plugins/_alerting/monitors/{monitorID}/_execute + superseded_by: /_plugins/_alerting/monitors/{monitorID}/_execute operations: - POST /_opendistro/_alerting/stats/: - replaced_by: /_plugins/_alerting/stats/ + superseded_by: /_plugins/_alerting/stats/ operations: - GET /_opendistro/_alerting/stats/{metric}: - replaced_by: /_plugins/_alerting/stats/{metric} + superseded_by: /_plugins/_alerting/stats/{metric} operations: - GET /_opendistro/_alerting/{nodeId}/stats/: - replaced_by: /_plugins/_alerting/{nodeId}/stats/ + superseded_by: /_plugins/_alerting/{nodeId}/stats/ operations: - GET /_opendistro/_alerting/{nodeId}/stats/{metric}: - replaced_by: /_plugins/_alerting/{nodeId}/stats/{metric} + superseded_by: /_plugins/_alerting/{nodeId}/stats/{metric} operations: - GET /_opendistro/_anomaly_detection/detectors: - replaced_by: /_plugins/_anomaly_detection/detectors + superseded_by: /_plugins/_anomaly_detection/detectors operations: - POST /_opendistro/_anomaly_detection/detectors/_search: - replaced_by: /_plugins/_anomaly_detection/detectors/_search + superseded_by: /_plugins/_anomaly_detection/detectors/_search operations: - GET - POST /_opendistro/_anomaly_detection/detectors/count: - replaced_by: /_plugins/_anomaly_detection/detectors/count + superseded_by: /_plugins/_anomaly_detection/detectors/count operations: - GET /_opendistro/_anomaly_detection/detectors/match: - replaced_by: /_plugins/_anomaly_detection/detectors/match + superseded_by: /_plugins/_anomaly_detection/detectors/match operations: - GET /_opendistro/_anomaly_detection/detectors/results/_search: - replaced_by: /_plugins/_anomaly_detection/detectors/results/_search + superseded_by: /_plugins/_anomaly_detection/detectors/results/_search operations: - GET - POST /_opendistro/_anomaly_detection/detectors/tasks/_search: - replaced_by: /_plugins/_anomaly_detection/detectors/tasks/_search + superseded_by: /_plugins/_anomaly_detection/detectors/tasks/_search operations: - GET - POST /_opendistro/_anomaly_detection/detectors/{detectorID}: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID} + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID} operations: - GET - PUT - DELETE - HEAD /_opendistro/_anomaly_detection/detectors/{detectorID}/_preview: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_preview + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_preview operations: - POST /_opendistro/_anomaly_detection/detectors/{detectorID}/_profile: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_profile + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_profile operations: - GET /_opendistro/_anomaly_detection/detectors/{detectorID}/_profile/{type}: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_profile/{type} + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_profile/{type} operations: - GET /_opendistro/_anomaly_detection/detectors/{detectorID}/_run: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_run + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_run operations: - POST /_opendistro/_anomaly_detection/detectors/{detectorID}/_start: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_start + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_start operations: - POST /_opendistro/_anomaly_detection/detectors/{detectorID}/_stop: - replaced_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_stop + superseded_by: /_plugins/_anomaly_detection/detectors/{detectorID}/_stop operations: - POST /_opendistro/_anomaly_detection/stats/: - replaced_by: /_plugins/_anomaly_detection/stats/ + superseded_by: /_plugins/_anomaly_detection/stats/ operations: - GET /_opendistro/_anomaly_detection/stats/{stat}: - replaced_by: /_plugins/_anomaly_detection/stats/{stat} + superseded_by: /_plugins/_anomaly_detection/stats/{stat} operations: - GET /_opendistro/_anomaly_detection/{nodeId}/stats/: - replaced_by: /_plugins/_anomaly_detection/{nodeId}/stats/ + superseded_by: /_plugins/_anomaly_detection/{nodeId}/stats/ operations: - GET /_opendistro/_anomaly_detection/{nodeId}/stats/{stat}: - replaced_by: /_plugins/_anomaly_detection/{nodeId}/stats/{stat} + superseded_by: /_plugins/_anomaly_detection/{nodeId}/stats/{stat} operations: - GET /_opendistro/_asynchronous_search: - replaced_by: /_plugins/_asynchronous_search + superseded_by: /_plugins/_asynchronous_search operations: - POST /_opendistro/_asynchronous_search/_nodes/{nodeId}/stats: - replaced_by: /_plugins/_asynchronous_search/_nodes/{nodeId}/stats + superseded_by: /_plugins/_asynchronous_search/_nodes/{nodeId}/stats operations: - GET /_opendistro/_asynchronous_search/stats: - replaced_by: /_plugins/_asynchronous_search/stats + superseded_by: /_plugins/_asynchronous_search/stats operations: - GET /_opendistro/_asynchronous_search/{id}: - replaced_by: /_plugins/_asynchronous_search/{id} + superseded_by: /_plugins/_asynchronous_search/{id} operations: - GET - DELETE /_opendistro/_ism/add: - replaced_by: /_plugins/_ism/add + superseded_by: /_plugins/_ism/add operations: - POST /_opendistro/_ism/add/{index}: - replaced_by: /_plugins/_ism/add/{index} + superseded_by: /_plugins/_ism/add/{index} operations: - POST /_opendistro/_ism/change_policy: - replaced_by: /_plugins/_ism/change_policy + superseded_by: /_plugins/_ism/change_policy operations: - POST /_opendistro/_ism/change_policy/{index}: - replaced_by: /_plugins/_ism/change_policy/{index} + superseded_by: /_plugins/_ism/change_policy/{index} operations: - POST /_opendistro/_ism/explain: - replaced_by: /_plugins/_ism/explain + superseded_by: /_plugins/_ism/explain operations: - GET /_opendistro/_ism/explain/{index}: - replaced_by: /_plugins/_ism/explain/{index} + superseded_by: /_plugins/_ism/explain/{index} operations: - GET /_opendistro/_ism/policies: - replaced_by: /_plugins/_ism/policies + superseded_by: /_plugins/_ism/policies operations: - GET - PUT /_opendistro/_ism/policies/{policyID}: - replaced_by: /_plugins/_ism/policies/{policyID} + superseded_by: /_plugins/_ism/policies/{policyID} operations: - GET - PUT - DELETE - HEAD /_opendistro/_ism/remove: - replaced_by: /_plugins/_ism/remove + superseded_by: /_plugins/_ism/remove operations: - POST /_opendistro/_ism/remove/{index}: - replaced_by: /_plugins/_ism/remove/{index} + superseded_by: /_plugins/_ism/remove/{index} operations: - POST /_opendistro/_ism/retry: - replaced_by: /_plugins/_ism/retry + superseded_by: /_plugins/_ism/retry operations: - POST /_opendistro/_ism/retry/{index}: - replaced_by: /_plugins/_ism/retry/{index} + superseded_by: /_plugins/_ism/retry/{index} operations: - POST /_opendistro/_knn/stats/: - replaced_by: /_plugins/_knn/stats/ + superseded_by: /_plugins/_knn/stats/ operations: - GET /_opendistro/_knn/stats/{stat}: - replaced_by: /_plugins/_knn/stats/{stat} + superseded_by: /_plugins/_knn/stats/{stat} operations: - GET /_opendistro/_knn/warmup/{index}: - replaced_by: /_plugins/_knn/warmup/{index} + superseded_by: /_plugins/_knn/warmup/{index} operations: - GET /_opendistro/_knn/{nodeId}/stats/: - replaced_by: /_plugins/_knn/{nodeId}/stats/ + superseded_by: /_plugins/_knn/{nodeId}/stats/ operations: - GET /_opendistro/_knn/{nodeId}/stats/{stat}: - replaced_by: /_plugins/_knn/{nodeId}/stats/{stat} + superseded_by: /_plugins/_knn/{nodeId}/stats/{stat} operations: - GET /_opendistro/_performanceanalyzer/_agent/{redirectEndpoint}: - replaced_by: /_plugins/_performanceanalyzer/_agent/{redirectEndpoint} + superseded_by: /_plugins/_performanceanalyzer/_agent/{redirectEndpoint} operations: - GET /_opendistro/_performanceanalyzer/batch/cluster/config: - replaced_by: /_plugins/_performanceanalyzer/batch/cluster/config + superseded_by: /_plugins/_performanceanalyzer/batch/cluster/config operations: - GET - POST /_opendistro/_performanceanalyzer/batch/config: - replaced_by: /_plugins/_performanceanalyzer/batch/config + superseded_by: /_plugins/_performanceanalyzer/batch/config operations: - GET - POST /_opendistro/_performanceanalyzer/cluster/config: - replaced_by: /_plugins/_performanceanalyzer/cluster/config + superseded_by: /_plugins/_performanceanalyzer/cluster/config operations: - GET - POST /_opendistro/_performanceanalyzer/config: - replaced_by: /_plugins/_performanceanalyzer/config + superseded_by: /_plugins/_performanceanalyzer/config operations: - GET - POST /_opendistro/_performanceanalyzer/logging/cluster/config: - replaced_by: /_plugins/_performanceanalyzer/logging/cluster/config + superseded_by: /_plugins/_performanceanalyzer/logging/cluster/config operations: - GET - POST /_opendistro/_performanceanalyzer/logging/config: - replaced_by: /_plugins/_performanceanalyzer/logging/config + superseded_by: /_plugins/_performanceanalyzer/logging/config operations: - GET - POST /_opendistro/_performanceanalyzer/override/cluster/config: - replaced_by: /_plugins/_performanceanalyzer/override/cluster/config + superseded_by: /_plugins/_performanceanalyzer/override/cluster/config operations: - GET - POST /_opendistro/_performanceanalyzer/rca/cluster/config: - replaced_by: /_plugins/_performanceanalyzer/rca/cluster/config + superseded_by: /_plugins/_performanceanalyzer/rca/cluster/config operations: - GET - POST /_opendistro/_performanceanalyzer/rca/config: - replaced_by: /_plugins/_performanceanalyzer/rca/config + superseded_by: /_plugins/_performanceanalyzer/rca/config operations: - GET - POST /_opendistro/_ppl: - replaced_by: /_plugins/_ppl + superseded_by: /_plugins/_ppl operations: - POST /_opendistro/_ppl/_explain: - replaced_by: /_plugins/_ppl/_explain + superseded_by: /_plugins/_ppl/_explain operations: - POST /_opendistro/_ppl/stats: - replaced_by: /_plugins/_ppl/stats + superseded_by: /_plugins/_ppl/stats operations: - GET - POST /_opendistro/_refresh_search_analyzers: - replaced_by: /_plugins/_refresh_search_analyzers + superseded_by: /_plugins/_refresh_search_analyzers operations: - POST /_opendistro/_refresh_search_analyzers/{index}: - replaced_by: /_plugins/_refresh_search_analyzers/{index} + superseded_by: /_plugins/_refresh_search_analyzers/{index} operations: - POST /_opendistro/_reports/_local/stats: - replaced_by: /_plugins/_reports/_local/stats + superseded_by: /_plugins/_reports/_local/stats operations: - GET /_opendistro/_reports/definition: - replaced_by: /_plugins/_reports/definition + superseded_by: /_plugins/_reports/definition operations: - POST /_opendistro/_reports/definition/{reportDefinitionId}: - replaced_by: /_plugins/_reports/definition/{reportDefinitionId} + superseded_by: /_plugins/_reports/definition/{reportDefinitionId} operations: - GET - PUT - DELETE /_opendistro/_reports/definitions: - replaced_by: /_plugins/_reports/definitions + superseded_by: /_plugins/_reports/definitions operations: - GET /_opendistro/_reports/instance/{reportInstanceId}: - replaced_by: /_plugins/_reports/instance/{reportInstanceId} + superseded_by: /_plugins/_reports/instance/{reportInstanceId} operations: - GET - POST /_opendistro/_reports/instances: - replaced_by: /_plugins/_reports/instances + superseded_by: /_plugins/_reports/instances operations: - GET /_opendistro/_reports/on_demand: - replaced_by: /_plugins/_reports/on_demand + superseded_by: /_plugins/_reports/on_demand operations: - PUT /_opendistro/_reports/on_demand/{reportDefinitionId}: - replaced_by: /_plugins/_reports/on_demand/{reportDefinitionId} + superseded_by: /_plugins/_reports/on_demand/{reportDefinitionId} operations: - POST /_opendistro/_rollup/jobs: - replaced_by: /_plugins/_rollup/jobs + superseded_by: /_plugins/_rollup/jobs operations: - GET - PUT /_opendistro/_rollup/jobs/{rollupID}: - replaced_by: /_plugins/_rollup/jobs/{rollupID} + superseded_by: /_plugins/_rollup/jobs/{rollupID} operations: - GET - PUT - DELETE - HEAD /_opendistro/_rollup/jobs/{rollupID}/_explain: - replaced_by: /_plugins/_rollup/jobs/{rollupID}/_explain + superseded_by: /_plugins/_rollup/jobs/{rollupID}/_explain operations: - GET /_opendistro/_rollup/jobs/{rollupID}/_start: - replaced_by: /_plugins/_rollup/jobs/{rollupID}/_start + superseded_by: /_plugins/_rollup/jobs/{rollupID}/_start operations: - POST /_opendistro/_rollup/jobs/{rollupID}/_stop: - replaced_by: /_plugins/_rollup/jobs/{rollupID}/_stop + superseded_by: /_plugins/_rollup/jobs/{rollupID}/_stop operations: - POST /_opendistro/_security/api/account: - replaced_by: /_plugins/_security/api/account + superseded_by: /_plugins/_security/api/account operations: - GET - PUT /_opendistro/_security/api/actiongroup/: - replaced_by: /_plugins/_security/api/actiongroup/ + superseded_by: /_plugins/_security/api/actiongroup/ operations: - GET /_opendistro/_security/api/actiongroup/{name}: - replaced_by: /_plugins/_security/api/actiongroup/{name} + superseded_by: /_plugins/_security/api/actiongroup/{name} operations: - GET - PUT - DELETE /_opendistro/_security/api/actiongroups/: - replaced_by: /_plugins/_security/api/actiongroups/ + superseded_by: /_plugins/_security/api/actiongroups/ operations: - GET - PATCH /_opendistro/_security/api/actiongroups/{name}: - replaced_by: /_plugins/_security/api/actiongroups/{name} + superseded_by: /_plugins/_security/api/actiongroups/{name} operations: - GET - PUT - DELETE - PATCH /_opendistro/_security/api/audit/: - replaced_by: /_plugins/_security/api/audit/ + superseded_by: /_plugins/_security/api/audit/ operations: - GET - PATCH /_opendistro/_security/api/audit/config: - replaced_by: /_plugins/_security/api/audit/config + superseded_by: /_plugins/_security/api/audit/config operations: - PUT /_opendistro/_security/api/authtoken: - replaced_by: /_plugins/_security/api/authtoken + superseded_by: /_plugins/_security/api/authtoken operations: - POST /_opendistro/_security/api/cache: - replaced_by: /_plugins/_security/api/cache + superseded_by: /_plugins/_security/api/cache operations: - GET - PUT - POST - DELETE /_opendistro/_security/api/internalusers/: - replaced_by: /_plugins/_security/api/internalusers/ + superseded_by: /_plugins/_security/api/internalusers/ operations: - GET - PATCH /_opendistro/_security/api/internalusers/{name}: - replaced_by: /_plugins/_security/api/internalusers/{name} + superseded_by: /_plugins/_security/api/internalusers/{name} operations: - GET - PUT - DELETE - PATCH /_opendistro/_security/api/internalusers/{name}/authtoken: - replaced_by: /_plugins/_security/api/internalusers/{name}/authtoken + superseded_by: /_plugins/_security/api/internalusers/{name}/authtoken operations: - POST /_opendistro/_security/api/migrate: - replaced_by: /_plugins/_security/api/migrate + superseded_by: /_plugins/_security/api/migrate operations: - POST /_opendistro/_security/api/permissionsinfo: - replaced_by: /_plugins/_security/api/permissionsinfo + superseded_by: /_plugins/_security/api/permissionsinfo operations: - GET /_opendistro/_security/api/roles/: - replaced_by: /_plugins/_security/api/roles/ + superseded_by: /_plugins/_security/api/roles/ operations: - GET - PATCH /_opendistro/_security/api/roles/{name}: - replaced_by: /_plugins/_security/api/roles/{name} + superseded_by: /_plugins/_security/api/roles/{name} operations: - GET - PUT - DELETE - PATCH /_opendistro/_security/api/rolesmapping/: - replaced_by: /_plugins/_security/api/rolesmapping/ + superseded_by: /_plugins/_security/api/rolesmapping/ operations: - GET - PATCH /_opendistro/_security/api/rolesmapping/{name}: - replaced_by: /_plugins/_security/api/rolesmapping/{name} + superseded_by: /_plugins/_security/api/rolesmapping/{name} operations: - GET - PUT - DELETE - PATCH /_opendistro/_security/api/securityconfig: - replaced_by: /_plugins/_security/api/securityconfig + superseded_by: /_plugins/_security/api/securityconfig operations: - GET - PATCH /_opendistro/_security/api/securityconfig/config: - replaced_by: /_plugins/_security/api/securityconfig/config + superseded_by: /_plugins/_security/api/securityconfig/config operations: - PUT /_opendistro/_security/api/ssl/certs: - replaced_by: /_plugins/_security/api/ssl/certs + superseded_by: /_plugins/_security/api/ssl/certs operations: - GET /_opendistro/_security/api/ssl/{certType}/reloadcerts/: - replaced_by: /_plugins/_security/api/ssl/{certType}/reloadcerts/ + superseded_by: /_plugins/_security/api/ssl/{certType}/reloadcerts/ operations: - PUT /_opendistro/_security/api/tenancy/config: - replaced_by: /_plugins/_security/api/tenancy/config + superseded_by: /_plugins/_security/api/tenancy/config operations: - GET - PUT /_opendistro/_security/api/tenants/: - replaced_by: /_plugins/_security/api/tenants/ + superseded_by: /_plugins/_security/api/tenants/ operations: - GET - PATCH /_opendistro/_security/api/tenants/{name}: - replaced_by: /_plugins/_security/api/tenants/{name} + superseded_by: /_plugins/_security/api/tenants/{name} operations: - GET - PUT - DELETE - PATCH /_opendistro/_security/api/user/: - replaced_by: /_plugins/_security/api/user/ + superseded_by: /_plugins/_security/api/user/ operations: - GET /_opendistro/_security/api/user/{name}: - replaced_by: /_plugins/_security/api/user/{name} + superseded_by: /_plugins/_security/api/user/{name} operations: - GET - PUT - DELETE /_opendistro/_security/api/user/{name}/authtoken: - replaced_by: /_plugins/_security/api/user/{name}/authtoken + superseded_by: /_plugins/_security/api/user/{name}/authtoken operations: - POST /_opendistro/_security/api/validate: - replaced_by: /_plugins/_security/api/validate + superseded_by: /_plugins/_security/api/validate operations: - GET /_opendistro/_security/api/whitelist: - replaced_by: /_plugins/_security/api/whitelist + superseded_by: /_plugins/_security/api/whitelist operations: - GET - PUT - PATCH /_opendistro/_security/authinfo: - replaced_by: /_plugins/_security/authinfo + superseded_by: /_plugins/_security/authinfo operations: - GET - POST /_opendistro/_security/health: - replaced_by: /_plugins/_security/health + superseded_by: /_plugins/_security/health operations: - GET - POST /_opendistro/_security/kibanainfo: - replaced_by: /_plugins/_security/kibanainfo + superseded_by: /_plugins/_security/kibanainfo operations: - GET - POST /_opendistro/_security/sslinfo: - replaced_by: /_plugins/_security/sslinfo + superseded_by: /_plugins/_security/sslinfo operations: - GET /_opendistro/_security/tenantinfo: - replaced_by: /_plugins/_security/tenantinfo + superseded_by: /_plugins/_security/tenantinfo operations: - GET - POST /_opendistro/_sql: - replaced_by: /_plugins/_sql + superseded_by: /_plugins/_sql operations: - POST /_opendistro/_sql/_explain: - replaced_by: /_plugins/_sql/_explain + superseded_by: /_plugins/_sql/_explain operations: - POST /_opendistro/_sql/close: - replaced_by: /_plugins/_sql/close + superseded_by: /_plugins/_sql/close operations: - POST /_opendistro/_sql/settings: - replaced_by: /_plugins/_sql/settings + superseded_by: /_plugins/_sql/settings operations: - PUT /_opendistro/_sql/stats: - replaced_by: /_plugins/_sql/stats + superseded_by: /_plugins/_sql/stats operations: - GET - POST diff --git a/tools/merger/OpenApiMerger.ts b/tools/merger/OpenApiMerger.ts index a82ed2738..bb7155942 100644 --- a/tools/merger/OpenApiMerger.ts +++ b/tools/merger/OpenApiMerger.ts @@ -3,7 +3,7 @@ import fs from 'fs'; import _ from 'lodash'; import yaml from 'yaml'; import { write2file } from '../helpers'; -import ReplacedOpsGenerator from "./ReplacedOpsGenerator"; +import SupersededOpsGenerator from "./SupersededOpsGenerator"; // Create a single-file OpenAPI spec from multiple files for OpenAPI validation and programmatic consumption export default class OpenApiMerger { @@ -128,7 +128,7 @@ export default class OpenApiMerger { } #generate_replaced_ops(): void { - const gen = new ReplacedOpsGenerator(this.root_folder); + const gen = new SupersededOpsGenerator(this.root_folder); gen.generate(this.spec); } } \ No newline at end of file diff --git a/tools/merger/OpenDistro.ts b/tools/merger/OpenDistro.ts index 253f33285..a8da6c349 100644 --- a/tools/merger/OpenDistro.ts +++ b/tools/merger/OpenDistro.ts @@ -1,14 +1,14 @@ import fs from "fs"; import YAML from "yaml"; -import { OperationPath, HttpVerb, ReplacedOperationMap } from "../types"; +import { OperationPath, HttpVerb, SupersededOperationMap } from "../types"; import { write2file } from "../helpers"; -// One-time script to generate _replaced_operations.yaml file for OpenDistro +// One-time script to generate _superseded_operations.yaml file for OpenDistro // Keeping this for now in case we need to update the file in the near future. Can be removed after a few months. // TODO: Remove this file in 2025. export default class OpenDistro { input: Record; - output: ReplacedOperationMap = {}; + output: SupersededOperationMap = {}; constructor(file_path: string) { this.input = YAML.parse(fs.readFileSync(file_path, 'utf8')); @@ -19,7 +19,7 @@ export default class OpenDistro { build_output() { for(const [path, operations] of Object.entries(this.input)) { const replaced_by = path.replace('_opendistro', '_plugins'); - this.output[path] = { replaced_by, operations }; + this.output[path] = { superseded_by: replaced_by, operations }; } } } \ No newline at end of file diff --git a/tools/merger/ReplacedOpsGenerator.ts b/tools/merger/SupersededOpsGenerator.ts similarity index 65% rename from tools/merger/ReplacedOpsGenerator.ts rename to tools/merger/SupersededOpsGenerator.ts index 219f7d393..34f4110ab 100644 --- a/tools/merger/ReplacedOpsGenerator.ts +++ b/tools/merger/SupersededOpsGenerator.ts @@ -1,25 +1,24 @@ -import {OperationSpec, ReplacedOperationMap} from "../types"; +import {OperationSpec, SupersededOperationMap} from "../types"; import YAML from "yaml"; import fs from "fs"; import _ from "lodash"; -export default class ReplacedOpsGenerator { - file_path: string; - replaced_ops: ReplacedOperationMap; +export default class SupersededOpsGenerator { + superseded_ops: SupersededOperationMap; constructor(root_path: string) { - this.file_path = root_path + '/_replaced_operations.yaml'; - this.replaced_ops = YAML.parse(fs.readFileSync(this.file_path, 'utf8')); + const file_path = root_path + '/_superseded_operations.yaml'; + this.superseded_ops = YAML.parse(fs.readFileSync(file_path, 'utf8')); } generate(spec: Record): void { - for(const [path, { replaced_by, operations }] of _.entries(this.replaced_ops)) { - const regex = this.path_to_regex(replaced_by); + for(const [path, { superseded_by, operations }] of _.entries(this.superseded_ops)) { + const regex = this.path_to_regex(superseded_by); const operation_keys = operations.map(op => op.toLowerCase()); - const replaced_path = this.copy_params(replaced_by, path); + const superseded_path = this.copy_params(superseded_by, path); const path_entry = _.entries(spec.paths).find(([path, _]) => regex.test(path)); - if(!path_entry) console.log(`Path not found: ${replaced_by}`); - else spec.paths[replaced_path] = this.path_object(path_entry[1] as any, operation_keys); + if(!path_entry) console.log(`Path not found: ${superseded_by}`); + else spec.paths[superseded_path] = this.path_object(path_entry[1] as any, operation_keys); } } @@ -27,7 +26,7 @@ export default class ReplacedOpsGenerator { const cloned_obj = _.cloneDeep(_.pick(obj, keys)); for(const key in cloned_obj) { const operation = cloned_obj[key] as OperationSpec; - operation.operationId = operation.operationId + '_replaced'; + operation.operationId = operation.operationId + '_superseded'; operation.deprecated = true; operation['x-ignorable'] = true; } diff --git a/tools/test/merger/fixtures/expected.yaml b/tools/test/merger/fixtures/expected.yaml index 76d99b7dd..95772eb3b 100644 --- a/tools/test/merger/fixtures/expected.yaml +++ b/tools/test/merger/fixtures/expected.yaml @@ -27,7 +27,7 @@ paths: $ref: '#/components/responses/adopt@200' /replaced/adopting/{animal}/something/{docket}: get: - operationId: adopt.0_replaced + operationId: adopt.0_superseded parameters: - $ref: '#/components/parameters/adopt::path.animal' - $ref: '#/components/parameters/adopt::path.docket' diff --git a/tools/test/merger/fixtures/spec/_replaced_operations.yaml b/tools/test/merger/fixtures/spec/_superseded_operations.yaml similarity index 62% rename from tools/test/merger/fixtures/spec/_replaced_operations.yaml rename to tools/test/merger/fixtures/spec/_superseded_operations.yaml index dd014f906..4ddca20c2 100644 --- a/tools/test/merger/fixtures/spec/_replaced_operations.yaml +++ b/tools/test/merger/fixtures/spec/_superseded_operations.yaml @@ -1,10 +1,10 @@ /replaced/adopting/{a}/something/{b}: - replaced_by: /adopt/{animal}/dockets/{docket} + superseded_by: /adopt/{animal}/dockets/{docket} operations: - GET - DELETE /something/else: - replaced_by: /not/here + superseded_by: /not/here operations: - POST - PUT \ No newline at end of file diff --git a/tools/types.ts b/tools/types.ts index b9a5a4f90..1f313f5cf 100644 --- a/tools/types.ts +++ b/tools/types.ts @@ -29,4 +29,4 @@ export interface ValidationError { export type HttpVerb = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'TRACE' export type OperationPath = string; -export type ReplacedOperationMap = Record; +export type SupersededOperationMap = Record;