Skip to content

Commit

Permalink
[OAS][ML] Add sync API tags and description, minor OpenAPI fixes (ela…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl committed Jul 26, 2024
1 parent 6c093b6 commit 841e95c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 127 deletions.
6 changes: 0 additions & 6 deletions oas_docs/output/kibana.serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Machine_learning_APIs_mlSync4xxResponse'
security:
- Machine_learning_APIs_apiKeyAuth: []
/api/saved_objects/_export:
post:
summary: Export saved objects in the default space
Expand Down Expand Up @@ -9063,10 +9061,6 @@ components:
enum:
- 404
securitySchemes:
Machine_learning_APIs_apiKeyAuth:
type: apiKey
in: header
name: ApiKey
Serverless_saved_objects_apiKeyAuth:
type: apiKey
in: header
Expand Down
53 changes: 0 additions & 53 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1401,43 +1401,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Machine_learning_APIs_mlSync4xxResponse'
security:
- Machine_learning_APIs_basicAuth: []
- Machine_learning_APIs_apiKeyAuth: []
/s/{spaceId}/api/ml/saved_objects/sync:
get:
summary: Sync saved objects
description: >
Synchronizes Kibana saved objects for machine learning jobs and trained
models. You must have `all` privileges for the **Machine Learning**
feature in the **Analytics** section of the Kibana feature privileges.
This API runs automatically when you start Kibana and periodically
thereafter.
operationId: mlSyncWithSpaceId
tags:
- ml
parameters:
- $ref: '#/components/parameters/Machine_learning_APIs_spaceParam'
- $ref: '#/components/parameters/Machine_learning_APIs_simulateParam'
responses:
'200':
description: Indicates a successful call
content:
application/json:
schema:
$ref: '#/components/schemas/Machine_learning_APIs_mlSync200Response'
examples:
syncExample:
$ref: '#/components/examples/Machine_learning_APIs_mlSyncExample'
'401':
description: Authorization information is missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Machine_learning_APIs_mlSync4xxResponse'
security:
- Machine_learning_APIs_basicAuth: []
- Machine_learning_APIs_apiKeyAuth: []
/api/encrypted_saved_objects/_rotate_key:
post:
summary: Rotate a key for encrypted saved objects
Expand Down Expand Up @@ -3127,15 +3090,6 @@ components:
schema:
type: string
example: hour_of_day
Machine_learning_APIs_spaceParam:
in: path
name: spaceId
description: >-
An identifier for the space. If `/s/` and the identifier are omitted
from the path, the default space is used.
required: true
schema:
type: string
Machine_learning_APIs_simulateParam:
in: query
name: simulate
Expand Down Expand Up @@ -11340,13 +11294,6 @@ components:
schema:
$ref: '#/components/schemas/Connectors_action_response_properties'
securitySchemes:
Machine_learning_APIs_basicAuth:
type: http
scheme: basic
Machine_learning_APIs_apiKeyAuth:
type: apiKey
in: header
name: ApiKey
Saved_objects_basicAuth:
type: http
scheme: basic
Expand Down
15 changes: 1 addition & 14 deletions x-pack/plugins/ml/common/openapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,4 @@ The current self-contained spec file can be used for online tools like those fou

A guide about the openApi specification can be found at [https://swagger.io/docs/specification/about/](https://swagger.io/docs/specification/about/).

The `ml_apis_v3.yaml` file uses OpenAPI Specification Version 3.0.1.

## Tools

It is possible to validate the docs before bundling them by running these
commands in the `x-pack/plugins/ml/common/openapi/` folder:

```
npx swagger-cli validate ml_apis.yaml
npx @redocly/cli lint ml_apis.yaml
npx swagger-cli validate ml_apis_serverless.yaml
npx @redocly/cli lint ml_apis_serverless.yaml
```
These files are joined with the rest of the Kibana APIs per `oas_docs/README.md`
83 changes: 36 additions & 47 deletions x-pack/plugins/ml/common/openapi/ml_apis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,44 @@ paths:
schema:
$ref: '#/components/schemas/mlSync4xxResponse'

/s/{spaceId}/api/ml/saved_objects/sync:
get:
summary: Sync saved objects
description: >
Synchronizes Kibana saved objects for machine learning jobs and trained models.
You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges.
This API runs automatically when you start Kibana and periodically thereafter.
operationId: mlSyncWithSpaceId
tags:
- ml
parameters:
- $ref: '#/components/parameters/spaceParam'
- $ref: '#/components/parameters/simulateParam'
responses:
'200':
description: Indicates a successful call
content:
application/json:
schema:
$ref: '#/components/schemas/mlSync200Response'
examples:
syncExample:
$ref: '#/components/examples/mlSyncExample'
'401':
description: Authorization information is missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/mlSync4xxResponse'
# /s/{spaceId}/api/ml/saved_objects/sync:
# get:
# summary: Sync saved objects
# description: >
# Synchronizes Kibana saved objects for machine learning jobs and trained models.
# You must have `all` privileges for the **Machine Learning** feature in the **Analytics** section of the Kibana feature privileges.
# This API runs automatically when you start Kibana and periodically thereafter.
# operationId: mlSyncWithSpaceId
# tags:
# - ml
# parameters:
# - $ref: '#/components/parameters/spaceParam'
# - $ref: '#/components/parameters/simulateParam'
# responses:
# '200':
# description: Indicates a successful call
# content:
# application/json:
# schema:
# $ref: '#/components/schemas/mlSync200Response'
# examples:
# syncExample:
# $ref: '#/components/examples/mlSyncExample'
# '401':
# description: Authorization information is missing or invalid.
# content:
# application/json:
# schema:
# $ref: '#/components/schemas/mlSync4xxResponse'
components:
parameters:
spaceParam:
in: path
name: spaceId
description: An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used.
required: true
schema:
type: string
# spaceParam:
# in: path
# name: spaceId
# description: An identifier for the space. If `/s/` and the identifier are omitted from the path, the default space is used.
# required: true
# schema:
# type: string
simulateParam:
in: query
name: simulate
Expand All @@ -87,14 +87,6 @@ components:
schema:
type: boolean
example: 'true'
securitySchemes:
basicAuth:
type: http
scheme: basic
apiKeyAuth:
type: apiKey
in: header
name: ApiKey
schemas:
mlSyncResponseSuccess:
type: boolean
Expand Down Expand Up @@ -212,6 +204,3 @@ components:
"datafeedsAdded": {},
"datafeedsRemoved": {}
}
security:
- basicAuth: [ ]
- apiKeyAuth: [ ]
7 changes: 0 additions & 7 deletions x-pack/plugins/ml/common/openapi/ml_apis_serverless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ components:
schema:
type: boolean
example: 'true'
securitySchemes:
apiKeyAuth:
type: apiKey
in: header
name: ApiKey
schemas:
mlSyncResponseSuccess:
type: boolean
Expand Down Expand Up @@ -171,5 +166,3 @@ components:
"datafeedsAdded": {},
"datafeedsRemoved": {}
}
security:
- apiKeyAuth: [ ]
3 changes: 3 additions & 0 deletions x-pack/plugins/ml/server/routes/saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ export function savedObjectsRoutes(
'access:ml:canCreateJob',
'access:ml:canCreateDataFrameAnalytics',
'access:ml:canCreateTrainedModels',
'oas-tag:machine learning',
],
},
description:
'Synchronizes Kibana saved objects for machine learning jobs and trained models. This API runs automatically when you start Kibana and periodically thereafter.',
})
.addVersion(
{
Expand Down

0 comments on commit 841e95c

Please sign in to comment.