Skip to content

Commit

Permalink
Add OpenAPI specification for bulk create and bulk update saved objec…
Browse files Browse the repository at this point in the history
…t APIs (#6859)

* ad doc for bulk create and bulk update

Signed-off-by: Lu Yu <nluyu@amazon.com>

* Changeset file for PR #6859 created/updated

---------

Signed-off-by: Lu Yu <nluyu@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit cf4e496)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent e26844e commit e023f9e
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/6859.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
doc:
- Add OpenAPI specification for bulk create and bulk update saved object APIs ([#6859](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6859))
149 changes: 149 additions & 0 deletions docs/openapi/saved_objects/saved_objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,155 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/400_bad_request'
/api/saved_objects/_bulk_create:
post:
tags:
- saved objects
summary: Bulk create saved objects
parameters:
- name: overwrite
in: query
schema:
type: boolean
description: If set to true, will overwrite the existing saved object with same type and id.
- name: workspaces
in: query
schema:
type: array
items:
type: string
description: Workspaces that the saved objects exist in.
requestBody:
required: true
description: Array of saved objects to create
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: string
description: Unique id of the saved object.
type:
type: string
required: true
description: The type of saved object.
attributes:
type: object
required: true
description: The metadata of the saved object to be created, and the object is not validated.
version:
type: string
migrationVersion:
type: object
description: The information about the migrations that have been applied to this saved object to be created.
references:
description: List of objects that describe other saved objects the created object references.
type: array
items:
type: object
properties:
id:
type: string
type:
type: string
name:
type: string
initialNamespaces:
description: Namespaces that this saved object exists in. This attribute is only used for multi-namespace saved object types.
type: array
items:
type: string
example:
- id: 67a9021c-c97e-4499-8150-9722ab44edd4
type: visualization
attributes:
title: 'vega-visualization'
fieldFormatMap: '{"hour_of_day":{}}'
fields: '[{"name":"@timestamp","type":"date","esTypes":["date"],"count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]'
version: '1'
migrationVersion: {}
references:
- id: ef71d6c1-8e6b-418d-9f7c-e5d9bbde9cf7
type: data-source
name: dataSource
initialNamespaces:
- default
responses:
'200':
description: The bulk creation request is successful.
content:
application/json:
schema:
type: object
/api/saved_objects/_bulk_update:
post:
tags:
- saved objects
summary: Bulk update saved objects
requestBody:
required: true
description: Array of saved objects to update
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: string
description: Unique id of the saved object.
type:
type: string
required: true
description: The type of saved object.
attributes:
type: object
required: true
description: The metadata of the saved object to be created, and the object is not validated.
version:
type: string
references:
description: List of objects that describe other saved objects the created object references.
type: array
items:
type: object
properties:
id:
type: string
type:
type: string
name:
type: string
namespaces:
description: Namespaces that this saved object exists in. This attribute is only used for multi-namespace saved object types.
type: array
items:
type: string
example:
- id: 67a9021c-c97e-4499-8150-9722ab44edd4
type: visualization
attributes:
title: vega-visualization
fieldFormatMap: '{"hour_of_day":{}}'
fields: '[{"name":"@timestamp","type":"date","esTypes":["date"],"count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]'
version: '1'
migrationVersion: {}
references:
- id: ef71d6c1-8e6b-418d-9f7c-e5d9bbde9cf7
type: data-source
name: dataSource
namespace: default
responses:
'200':
description: The bulk update request is successful.
content:
application/json:
schema:
type: object
components:
parameters:
type:
Expand Down

0 comments on commit e023f9e

Please sign in to comment.