[OAS] Data views update fields meta spec files. (#164547)

Co-authored-by: James Rodewig <james.rodewig@elastic.co>
This commit is contained in:
amyjtechwriter 2023-08-24 16:57:25 +01:00 committed by GitHub
parent e83cfabb92
commit ec1b885082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 522 additions and 180 deletions

View file

@ -84,6 +84,16 @@
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
}
},
@ -293,6 +303,85 @@
}
]
},
"/api/data_views/data_view/{viewId}/fields": {
"post": {
"summary": "Update fields presentation metadata such as count, customLabel and format.",
"operationId": "updateFieldsMetadata",
"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. You can update multiple fields in one request. Updates are merged with persisted metadata. To remove existing metadata, specify null as the value.\n",
"tags": [
"data views"
],
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
},
{
"$ref": "#/components/parameters/view_id"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"fields"
],
"properties": {
"fields": {
"description": "The field object.",
"type": "object"
}
}
},
"examples": {
"updateFieldsMetadataRequest": {
"$ref": "#/components/examples/update_field_metadata_request"
}
}
}
}
},
"responses": {
"200": {
"description": "Indicates a successful call.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"acknowledged": {
"type": "boolean"
}
}
}
}
}
},
"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": {
"post": {
"summary": "Creates a runtime field.",
@ -304,6 +393,9 @@
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
},
{
"$ref": "#/components/parameters/view_id"
}
],
"requestBody": {
@ -312,16 +404,18 @@
"application/json": {
"schema": {
"type": "object",
"required": [
"name",
"runtimeField"
],
"properties": {
"data_view_id": {
"description": "The ID of the data view.",
"name": {
"type": "string",
"required": true
"description": "The name for a runtime field.\n"
},
"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
"runtimeField": {
"type": "object",
"description": "The runtime field definition object.\n"
}
}
},
@ -336,7 +430,7 @@
},
"put": {
"summary": "Create or update an existing runtime field.",
"operationId": "updateRuntimeField",
"operationId": "createUpdateRuntimeField",
"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"
@ -344,6 +438,15 @@
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
},
{
"name": "viewId",
"in": "path",
"description": "The ID of the data view fields you want to update.\n",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
@ -352,16 +455,18 @@
"application/json": {
"schema": {
"type": "object",
"required": [
"name",
"runtimeField"
],
"properties": {
"data_view_id": {
"description": "The ID of the data view.",
"name": {
"type": "string",
"required": true
"description": "The name for a runtime field.\n"
},
"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
"runtimeField": {
"type": "object",
"description": "The runtime field definition object.\n"
}
}
},
@ -379,7 +484,20 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/create_runtime_field_response"
"type": "object",
"properties": {
"data_view": {
"type": "object"
},
"fields": {
"type": "array"
}
}
},
"examples": {
"createRuntimeFieldResponse": {
"$ref": "#/components/examples/create_runtime_field_response"
}
}
}
}
@ -514,15 +632,13 @@
"application/json": {
"schema": {
"type": "object",
"required": [
"runtimeField"
],
"properties": {
"data_view": {
"type": "object"
},
"fields": {
"type": "array",
"items": {
"type": "object"
}
"runtimeField": {
"type": "object",
"description": "The runtime field definition object.\n\nYou can update following fields:\n\n- `type`\n- `script`\n"
}
}
},
@ -589,6 +705,16 @@
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
}
},
@ -651,6 +777,16 @@
}
}
}
},
"400": {
"description": "Bad request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/400_response"
}
}
}
}
},
"servers": [
@ -1897,6 +2033,16 @@
"refresh_fields": true
}
},
"update_field_metadata_request": {
"summary": "Set popularity count for field foo.",
"value": {
"fields": {
"foo": {
"count": 123
}
}
}
},
"create_runtime_field_request": {
"summary": "Create a runtime field.",
"value": {
@ -1909,6 +2055,17 @@
}
}
},
"create_runtime_field_response": {
"summary": "The API returns created runtime field object array and updated data view object.",
"value": {
"data_view": {
"...": null
},
"fields": [
"..."
]
}
},
"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": {
@ -2551,38 +2708,29 @@
}
}
},
"parameters": {
"kbn_xsrf": {
"schema": {
"type": "string"
},
"in": "header",
"name": "kbn-xsrf",
"description": "Cross-site request forgery protection",
"required": true
},
"view_id": {
"in": "path",
"name": "viewId",
"description": "An identifier for the data view.",
"required": true,
"schema": {
"type": "string",
"example": "ff959d40-b880-11e8-a6d9-e546fe2bba5f"
}
},
"field_name": {
"in": "path",
"name": "fieldName",
"description": "The name of the runtime field.",
"required": true,
"schema": {
"type": "string",
"example": "hour_of_day"
}
}
},
"schemas": {
"400_response": {
"title": "Bad request",
"type": "object",
"required": [
"statusCode",
"error",
"message"
],
"properties": {
"statusCode": {
"type": "number",
"example": 400
},
"error": {
"type": "string",
"example": "Bad Request"
},
"message": {
"type": "string"
}
}
},
"allownoindex": {
"type": "boolean",
"description": "Allows the data view saved object to exist before the data is available."
@ -2746,28 +2894,6 @@
}
}
},
"400_response": {
"title": "Bad request",
"type": "object",
"required": [
"statusCode",
"error",
"message"
],
"properties": {
"statusCode": {
"type": "number",
"example": 400
},
"error": {
"type": "string",
"example": "Bad Request"
},
"message": {
"type": "string"
}
}
},
"404_response": {
"type": "object",
"properties": {
@ -2840,16 +2966,36 @@
"default": false
}
}
}
},
"parameters": {
"kbn_xsrf": {
"schema": {
"type": "string"
},
"in": "header",
"name": "kbn-xsrf",
"description": "Cross-site request forgery protection",
"required": true
},
"create_runtime_field_response": {
"summary": "The API returns created runtime field object array and updated data view object.",
"value": {
"data_view": {
"...": null
},
"fields": [
"..."
]
"view_id": {
"in": "path",
"name": "viewId",
"description": "An identifier for the data view.",
"required": true,
"schema": {
"type": "string",
"example": "ff959d40-b880-11e8-a6d9-e546fe2bba5f"
}
},
"field_name": {
"in": "path",
"name": "fieldName",
"description": "The name of the runtime field.",
"required": true,
"schema": {
"type": "string",
"example": "hour_of_day"
}
}
}

View file

@ -54,6 +54,12 @@ paths:
examples:
getAllDataViewsResponse:
$ref: '#/components/examples/get_data_views_response'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
servers:
- url: https://localhost:5601
/api/data_views/data_view:
@ -174,6 +180,52 @@ paths:
- url: https://localhost:5601
servers:
- url: https://localhost:5601
/api/data_views/data_view/{viewId}/fields:
post:
summary: Update fields presentation metadata such as count, customLabel and format.
operationId: updateFieldsMetadata
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. You can update multiple fields in one request. Updates are merged with persisted metadata. To remove existing metadata, specify null as the value.
tags:
- data views
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- $ref: '#/components/parameters/view_id'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- fields
properties:
fields:
description: The field object.
type: object
examples:
updateFieldsMetadataRequest:
$ref: '#/components/examples/update_field_metadata_request'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
'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:
post:
summary: Creates a runtime field.
@ -184,48 +236,62 @@ paths:
- data views
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
- $ref: '#/components/parameters/view_id'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- runtimeField
properties:
data_view_id:
description: The ID of the data view.
name:
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
description: |
The name for a runtime field.
runtimeField:
type: object
description: |
The runtime field definition object.
examples:
createRuntimeFieldRequest:
$ref: '#/components/examples/create_runtime_field_request'
put:
summary: Create or update an existing runtime field.
operationId: updateRuntimeField
operationId: createUpdateRuntimeField
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'
- name: viewId
in: path
description: |
The ID of the data view fields you want to update.
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- runtimeField
properties:
data_view_id:
description: The ID of the data view.
name:
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
description: |
The name for a runtime field.
runtimeField:
type: object
description: |
The runtime field definition object.
examples:
updateRuntimeFieldRequest:
$ref: '#/components/examples/create_runtime_field_request'
@ -235,7 +301,15 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/create_runtime_field_response'
type: object
properties:
data_view:
type: object
fields:
type: array
examples:
createRuntimeFieldResponse:
$ref: '#/components/examples/create_runtime_field_response'
'400':
description: Bad request
content:
@ -315,13 +389,18 @@ paths:
application/json:
schema:
type: object
required:
- runtimeField
properties:
data_view:
runtimeField:
type: object
fields:
type: array
items:
type: object
description: |
The runtime field definition object.
You can update following fields:
- `type`
- `script`
examples:
updateRuntimeFieldRequest:
$ref: '#/components/examples/update_runtime_field_request'
@ -359,6 +438,12 @@ paths:
examples:
getDefaultDataViewResponse:
$ref: '#/components/examples/get_default_data_view_response'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
post:
summary: Sets the default data view identifier.
operationId: setDefaultDatailView
@ -400,6 +485,12 @@ paths:
properties:
acknowledged:
type: boolean
'400':
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/400_response'
servers:
- url: https://localhost:5601
servers:
@ -1381,6 +1472,12 @@ components:
allowNoIndex: false
name: Kibana Sample Data eCommerce
refresh_fields: true
update_field_metadata_request:
summary: Set popularity count for field foo.
value:
fields:
foo:
count: 123
create_runtime_field_request:
summary: Create a runtime field.
value:
@ -1389,6 +1486,13 @@ components:
type: long
script:
source: emit(doc["foo"].value)
create_runtime_field_response:
summary: The API returns created runtime field object array and updated data view object.
value:
data_view:
...: null
fields:
- ...
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:
@ -1903,31 +2007,23 @@ components:
value:
data_view_id: ff959d40-b880-11e8-a6d9-e546fe2bba5f
force: true
parameters:
kbn_xsrf:
schema:
type: string
in: header
name: kbn-xsrf
description: Cross-site request forgery protection
required: true
view_id:
in: path
name: viewId
description: An identifier for the data view.
required: true
schema:
type: string
example: ff959d40-b880-11e8-a6d9-e546fe2bba5f
field_name:
in: path
name: fieldName
description: The name of the runtime field.
required: true
schema:
type: string
example: hour_of_day
schemas:
400_response:
title: Bad request
type: object
required:
- statusCode
- error
- message
properties:
statusCode:
type: number
example: 400
error:
type: string
example: Bad Request
message:
type: string
allownoindex:
type: boolean
description: Allows the data view saved object to exist before the data is available.
@ -2042,22 +2138,6 @@ components:
version:
type: string
example: WzQ2LDJd
400_response:
title: Bad request
type: object
required:
- statusCode
- error
- message
properties:
statusCode:
type: number
example: 400
error:
type: string
example: Bad Request
message:
type: string
404_response:
type: object
properties:
@ -2109,10 +2189,27 @@ 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:
- ...
parameters:
kbn_xsrf:
schema:
type: string
in: header
name: kbn-xsrf
description: Cross-site request forgery protection
required: true
view_id:
in: path
name: viewId
description: An identifier for the data view.
required: true
schema:
type: string
example: ff959d40-b880-11e8-a6d9-e546fe2bba5f
field_name:
in: path
name: fieldName
description: The name of the runtime field.
required: true
schema:
type: string
example: hour_of_day

View file

@ -1,6 +1,6 @@
summary: The API returns created runtime field object array and updated data view object.
value:
{
{
"data_view": {...},
"fields": [...]
}
}

View file

@ -0,0 +1,9 @@
summary: Set popularity count for field foo.
value:
{
"fields": {
"foo": {
"count": 123
}
}
}

View file

@ -22,8 +22,8 @@ paths:
$ref: 'paths/api@data_views@data_view.yaml'
'/api/data_views/data_view/{viewId}':
$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}/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/{fieldName}':

View file

@ -33,5 +33,11 @@ get:
examples:
getAllDataViewsResponse:
$ref: '../components/examples/get_data_views_response.yaml'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
servers:
- url: https://localhost:5601

View file

@ -0,0 +1,46 @@
post:
summary: Update fields presentation metadata such as count, customLabel and format.
operationId: updateFieldsMetadata
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. You can update multiple fields in one request. Updates are merged with persisted metadata. To remove existing metadata, specify null as the value.
tags:
- data views
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
- $ref: '../components/parameters/view_id.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- fields
properties:
fields:
description: The field object.
type: object
examples:
updateFieldsMetadataRequest:
$ref: '../components/examples/update_field_metadata_request.yaml'
responses:
'200':
description: Indicates a successful call.
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
servers:
- url: https://localhost:5601
servers:
- url: https://localhost:5601

View file

@ -7,49 +7,63 @@ post:
- data views
parameters:
- $ref: '../components/headers/kbn_xsrf.yaml'
- $ref: '../components/parameters/view_id.yaml'
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- runtimeField
properties:
data_view_id:
description: The ID of the data view.
name:
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
description: |
The name for a runtime field.
runtimeField:
type: object
description: |
The runtime field definition object.
examples:
createRuntimeFieldRequest:
$ref: '../components/examples/create_runtime_field_request.yaml'
put:
summary: Create or update an existing runtime field.
operationId: updateRuntimeField
operationId: createUpdateRuntimeField
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'
- name: viewId
in: path
description: |
The ID of the data view fields you want to update.
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- name
- runtimeField
properties:
data_view_id:
description: The ID of the data view.
name:
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
description: |
The name for a runtime field.
runtimeField:
type: object
description: |
The runtime field definition object.
examples:
updateRuntimeFieldRequest:
$ref: '../components/examples/create_runtime_field_request.yaml'
@ -59,7 +73,15 @@ put:
content:
application/json:
schema:
$ref: '../components/examples/create_runtime_field_response.yaml'
type: object
properties:
data_view:
type: object
fields:
type: array
examples:
createRuntimeFieldResponse:
$ref: '../components/examples/create_runtime_field_response.yaml'
'400':
description: Bad request
content:

View file

@ -68,13 +68,18 @@ post:
application/json:
schema:
type: object
required:
- runtimeField
properties:
data_view:
runtimeField:
type: object
fields:
type: array
items:
type: object
description: |
The runtime field definition object.
You can update following fields:
- `type`
- `script`
examples:
updateRuntimeFieldRequest:
$ref: '../components/examples/update_runtime_field_request.yaml'

View file

@ -18,7 +18,12 @@ get:
examples:
getDefaultDataViewResponse:
$ref: '../components/examples/get_default_data_view_response.yaml'
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
post:
summary: Sets the default data view identifier.
operationId: setDefaultDatailView
@ -60,6 +65,12 @@ post:
properties:
acknowledged:
type: boolean
'400':
description: Bad request
content:
application/json:
schema:
$ref: '../components/schemas/400_response.yaml'
servers:
- url: https://localhost:5601