Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OAS] Create runtime field API #163776

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions src/plugins/data_views/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,120 @@
}
]
},
"/api/data_views/data_view/{viewId}/runtime_field": {
"post": {
"summary": "Creates a runtime field.",
"operationId": "createRuntimeField",
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.\n",
"tags": [
"data views"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data_view_id": {
"description": "The ID of the data view.",
"type": "string",
"required": true
},
"space_id": {
"description": "An identifier for the space. If space_id is not provided in the URL, the default space is used.",
"type": "string",
"required": false
}
}
},
"examples": {
"createRuntimeFieldRequest": {
"$ref": "#/components/examples/create_runtime_field_request"
}
}
}
}
}
},
"put": {
"summary": "Create or update an existing runtime field.",
"operationId": "updateRuntimeField",
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.\n",
"tags": [
"data views"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data_view_id": {
"description": "The ID of the data view.",
"type": "string",
"required": true
},
"space_id": {
"description": "An identifier for the space. If space_id is not provided in the URL, the default space is used.",
"type": "string",
"required": false
}
}
},
"examples": {
"updateRuntimeFieldRequest": {
"$ref": "#/components/examples/create_runtime_field_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/create_runtime_field_response"
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"servers": [
{
"url": "https://localhost:5601"
}
]
},
"/api/data_views/data_view/{viewId}/runtime_field/{fieldName}": {
"get": {
"summary": "Retrieves a runtime field.",
Expand Down Expand Up @@ -1690,6 +1804,18 @@
"refresh_fields": true
}
},
"create_runtime_field_request": {
"summary": "Create a runtime field.",
"value": {
"name": "runtimeFoo",
"runtimeField": {
"type": "long",
"script": {
"source": "emit(doc[\"foo\"].value)"
}
}
}
},
"get_runtime_field_response": {
"summary": "The get runtime field API returns a JSON object that contains information about the runtime field (`hour_of_day`) and the data view (`d3d7af60-4c81-11e8-b3d7-01146121b73d`).",
"value": {
Expand Down Expand Up @@ -2611,6 +2737,17 @@
"default": false
}
}
},
"create_runtime_field_response": {
"summary": "The API returns created runtime field object array and updated data view object.",
"value": {
"data_view": {
"...": null
},
"fields": [
"..."
]
}
}
}
}
Expand Down
87 changes: 87 additions & 0 deletions src/plugins/data_views/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,78 @@ paths:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/data_views/data_view/{viewId}/runtime_field:
post:
summary: Creates a runtime field.
operationId: createRuntimeField
description: |
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
createRuntimeFieldRequest:
$ref: '#/components/examples/create_runtime_field_request'
put:
summary: Create or update an existing runtime field.
operationId: updateRuntimeField
description: |
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
updateRuntimeFieldRequest:
$ref: '#/components/examples/create_runtime_field_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '#/components/schemas/create_runtime_field_response'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/data_views/data_view/{viewId}/runtime_field/{fieldName}:
get:
summary: Retrieves a runtime field.
Expand Down Expand Up @@ -1253,6 +1325,14 @@ components:
allowNoIndex: false
name: Kibana Sample Data eCommerce
refresh_fields: true
create_runtime_field_request:
summary: Create a runtime field.
value:
name: runtimeFoo
runtimeField:
type: long
script:
source: emit(doc["foo"].value)
get_runtime_field_response:
summary: The get runtime field API returns a JSON object that contains information about the runtime field (`hour_of_day`) and the data view (`d3d7af60-4c81-11e8-b3d7-01146121b73d`).
value:
Expand Down Expand Up @@ -1967,3 +2047,10 @@ components:
type: boolean
description: Reloads the data view fields after the data view is updated.
default: false
create_runtime_field_response:
summary: The API returns created runtime field object array and updated data view object.
value:
data_view:
...: null
fields:
- ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Create a runtime field.
value:
{
"name": "runtimeFoo",
"runtimeField": {
"type": "long",
"script": {
"source": 'emit(doc["foo"].value)'
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: The API returns created runtime field object array and updated data view object.
value:
{
"data_view": {...},
"fields": [...]
}
4 changes: 2 additions & 2 deletions src/plugins/data_views/docs/openapi/entrypoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ paths:
$ref: 'paths/api@data_views@data_view@{viewid}.yaml'
# '/api/data_views/data_view/{viewId}/fields':
# $ref: 'paths/api@data_views@data_view@{viewid}@fields.yaml'
# '/api/data_views/data_view/{viewId}/runtime_field':
# $ref: 'paths/api@data_views@data_view@{viewid}@runtime_field.yaml'
'/api/data_views/data_view/{viewId}/runtime_field':
$ref: 'paths/api@data_views@data_view@{viewid}@runtime_field.yaml'
'/api/data_views/data_view/{viewId}/runtime_field/{fieldName}':
$ref: 'paths/api@data_views@data_view@{viewid}@runtime_field@{fieldname}.yaml'
'/api/data_views/default':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
post:
summary: Creates a runtime field.
operationId: createRuntimeField
description: >
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
createRuntimeFieldRequest:
$ref: '../components/examples/create_runtime_field_request.yaml'

put:
summary: Create or update an existing runtime field.
operationId: updateRuntimeField
description: >
This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
tags:
- data views
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
data_view_id:
description: The ID of the data view.
type: string
required: true
space_id:
description: An identifier for the space. If space_id is not provided in the URL, the default space is used.
type: string
required: false
examples:
updateRuntimeFieldRequest:
$ref: '../components/examples/create_runtime_field_request.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
$ref: '../components/examples/create_runtime_field_response.yaml'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
servers:
- url: https://localhost:5601

servers:
- url: https://localhost:5601
Loading