From 6e9177caacb43e1634c6e8d892c15b9bec39b8c6 Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Thu, 12 Nov 2020 17:51:42 +0100 Subject: [PATCH] [ML] Update apidoc config with the Trained models endpoints (#83274) * [ML] fix apidoc annotations * [ML] add trained models * [ML] use full path to the apidoc-markdown package --- x-pack/plugins/ml/package.json | 2 +- x-pack/plugins/ml/server/routes/apidoc.json | 8 ++++- .../ml/server/routes/trained_models.ts | 30 +++++++++---------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/ml/package.json b/x-pack/plugins/ml/package.json index a41e9e845063f..1ec697568a849 100644 --- a/x-pack/plugins/ml/package.json +++ b/x-pack/plugins/ml/package.json @@ -6,6 +6,6 @@ "license": "Elastic-License", "scripts": { "build:apiDocScripts": "cd server/routes/apidoc_scripts && ../../../../../../node_modules/.bin/tsc", - "apiDocs": "yarn build:apiDocScripts && cd ./server/routes/ && ../../../../../node_modules/.bin/apidoc --parse-workers apischema=./apidoc_scripts/target/schema_worker.js --parse-parsers apischema=./apidoc_scripts/target/schema_parser.js --parse-filters apiversion=./apidoc_scripts/target/version_filter.js -i . -o ../routes_doc && apidoc-markdown -p ../routes_doc -o ../routes_doc/ML_API.md -t ./apidoc_scripts/template.md" + "apiDocs": "yarn build:apiDocScripts && cd ./server/routes/ && ../../../../../node_modules/.bin/apidoc --parse-workers apischema=./apidoc_scripts/target/schema_worker.js --parse-parsers apischema=./apidoc_scripts/target/schema_parser.js --parse-filters apiversion=./apidoc_scripts/target/version_filter.js -i . -o ../routes_doc && ../../../../../node_modules/.bin/apidoc-markdown -p ../routes_doc -o ../routes_doc/ML_API.md -t ./apidoc_scripts/template.md" } } \ No newline at end of file diff --git a/x-pack/plugins/ml/server/routes/apidoc.json b/x-pack/plugins/ml/server/routes/apidoc.json index 780835e2a300b..8d6dd692cc130 100644 --- a/x-pack/plugins/ml/server/routes/apidoc.json +++ b/x-pack/plugins/ml/server/routes/apidoc.json @@ -148,6 +148,12 @@ "InitializeJobSavedObjects", "AssignJobsToSpaces", "RemoveJobsFromSpaces", - "JobsSpaces" + "JobsSpaces", + + "TrainedModels", + "GetTrainedModel", + "GetTrainedModelStats", + "GetTrainedModelPipelines", + "DeleteTrainedModel" ] } diff --git a/x-pack/plugins/ml/server/routes/trained_models.ts b/x-pack/plugins/ml/server/routes/trained_models.ts index 579f63e13328d..e9bd854864c2d 100644 --- a/x-pack/plugins/ml/server/routes/trained_models.ts +++ b/x-pack/plugins/ml/server/routes/trained_models.ts @@ -16,11 +16,11 @@ import { InferenceConfigResponse } from '../../common/types/trained_models'; export function trainedModelsRoutes({ router, routeGuard }: RouteInitialization) { /** - * @apiGroup Inference + * @apiGroup TrainedModels * * @api {get} /api/ml/trained_models/:modelId Get info of a trained inference model - * @apiName GetInferenceModel - * @apiDescription Retrieves configuration information for a trained inference model. + * @apiName GetTrainedModel + * @apiDescription Retrieves configuration information for a trained model. */ router.get( { @@ -68,11 +68,11 @@ export function trainedModelsRoutes({ router, routeGuard }: RouteInitialization) ); /** - * @apiGroup Inference + * @apiGroup TrainedModels * - * @api {get} /api/ml/trained_models/:modelId/_stats Get stats of a trained inference model - * @apiName GetInferenceModelStats - * @apiDescription Retrieves usage information for trained inference models. + * @api {get} /api/ml/trained_models/:modelId/_stats Get stats of a trained model + * @apiName GetTrainedModelStats + * @apiDescription Retrieves usage information for trained models. */ router.get( { @@ -100,11 +100,11 @@ export function trainedModelsRoutes({ router, routeGuard }: RouteInitialization) ); /** - * @apiGroup Inference + * @apiGroup TrainedModels * - * @api {get} /api/ml/trained_models/:modelId/pipelines Get model pipelines - * @apiName GetModelPipelines - * @apiDescription Retrieves pipelines associated with a model + * @api {get} /api/ml/trained_models/:modelId/pipelines Get trained model pipelines + * @apiName GetTrainedModelPipelines + * @apiDescription Retrieves pipelines associated with a trained model */ router.get( { @@ -130,11 +130,11 @@ export function trainedModelsRoutes({ router, routeGuard }: RouteInitialization) ); /** - * @apiGroup Inference + * @apiGroup TrainedModels * - * @api {delete} /api/ml/trained_models/:modelId Get stats of a trained inference model - * @apiName DeleteInferenceModel - * @apiDescription Deletes an existing trained inference model that is currently not referenced by an ingest pipeline. + * @api {delete} /api/ml/trained_models/:modelId Delete a trained model + * @apiName DeleteTrainedModel + * @apiDescription Deletes an existing trained model that is currently not referenced by an ingest pipeline. */ router.delete( {