From 17daaa61c7ab5e6519a6cf1362d5fbe6dc867edd Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Fri, 25 Aug 2023 17:02:41 +0200 Subject: [PATCH] Change TaskStatus to UserDefinedValue --- output/schema/schema.json | 242 +-------------------- output/typescript/types.ts | 24 +- specification/tasks/_types/TaskInfo.ts | 5 +- specification/tasks/_types/TaskStatus.ts | 42 ---- specification/tasks/get/GetTaskResponse.ts | 4 +- 5 files changed, 11 insertions(+), 306 deletions(-) delete mode 100644 specification/tasks/_types/TaskStatus.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 537a826efa..ab0c54cd4b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -184086,14 +184086,11 @@ } }, { + "description": "Task status information can vary wildly from task to task.", "name": "status", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TaskStatus", - "namespace": "tasks._types" - } + "kind": "user_defined_value" } }, { @@ -184119,7 +184116,7 @@ } } ], - "specLocation": "tasks/_types/TaskInfo.ts#L32-L46" + "specLocation": "tasks/_types/TaskInfo.ts#L32-L47" }, { "codegenNames": [ @@ -184239,233 +184236,6 @@ ], "specLocation": "tasks/_types/TaskListResponseBase.ts#L26-L38" }, - { - "kind": "interface", - "name": { - "name": "TaskStatus", - "namespace": "tasks._types" - }, - "properties": [ - { - "name": "batches", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "canceled", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - }, - { - "name": "created", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "deleted", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "noops", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "failures", - "required": false, - "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "_builtins" - } - } - } - }, - { - "name": "requests_per_second", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "float", - "namespace": "_types" - } - } - }, - { - "name": "retries", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Retries", - "namespace": "_types" - } - } - }, - { - "name": "throttled", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } - } - }, - { - "name": "throttled_millis", - "required": true, - "type": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "UnitMillis", - "namespace": "_types" - } - } - ], - "kind": "instance_of", - "type": { - "name": "DurationValue", - "namespace": "_types" - } - } - }, - { - "name": "throttled_until", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Duration", - "namespace": "_types" - } - } - }, - { - "name": "throttled_until_millis", - "required": true, - "type": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "UnitMillis", - "namespace": "_types" - } - } - ], - "kind": "instance_of", - "type": { - "name": "DurationValue", - "namespace": "_types" - } - } - }, - { - "name": "timed_out", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "_builtins" - } - } - }, - { - "name": "took", - "required": false, - "type": { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "UnitMillis", - "namespace": "_types" - } - } - ], - "kind": "instance_of", - "type": { - "name": "DurationValue", - "namespace": "_types" - } - } - }, - { - "name": "total", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "updated", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - }, - { - "name": "version_conflicts", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - } - } - ], - "specLocation": "tasks/_types/TaskStatus.ts#L24-L42" - }, { "attachedBehaviors": [ "CommonQueryParameters" @@ -184678,11 +184448,7 @@ "name": "response", "required": false, "type": { - "kind": "instance_of", - "type": { - "name": "TaskStatus", - "namespace": "tasks._types" - } + "kind": "user_defined_value" } }, { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index fc6283c705..41f3dcfe54 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -17534,7 +17534,7 @@ export interface TasksTaskInfo { running_time?: Duration running_time_in_nanos: DurationValue start_time_in_millis: EpochTime - status?: TasksTaskStatus + status?: any type: string parent_task_id?: TaskId } @@ -17548,26 +17548,6 @@ export interface TasksTaskListResponseBase { tasks?: TasksTaskInfos } -export interface TasksTaskStatus { - batches: long - canceled?: string - created: long - deleted: long - noops: long - failures?: string[] - requests_per_second: float - retries: Retries - throttled?: Duration - throttled_millis: DurationValue - throttled_until?: Duration - throttled_until_millis: DurationValue - timed_out?: boolean - took?: DurationValue - total: long - updated: long - version_conflicts: long -} - export interface TasksCancelRequest extends RequestBase { task_id?: TaskId actions?: string | string[] @@ -17587,7 +17567,7 @@ export interface TasksGetRequest extends RequestBase { export interface TasksGetResponse { completed: boolean task: TasksTaskInfo - response?: TasksTaskStatus + response?: any error?: ErrorCause } diff --git a/specification/tasks/_types/TaskInfo.ts b/specification/tasks/_types/TaskInfo.ts index d31bc8186a..bdeddff2dd 100644 --- a/specification/tasks/_types/TaskInfo.ts +++ b/specification/tasks/_types/TaskInfo.ts @@ -17,7 +17,6 @@ * under the License. */ -import { TaskStatus } from '@tasks/_types/TaskStatus' import { NodeId, TaskId } from '@_types/common' import { long } from '@_types/Numeric' import { Dictionary } from '@spec_utils/Dictionary' @@ -28,6 +27,7 @@ import { UnitMillis, UnitNanos } from '@_types/Time' +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' export class TaskInfo { action: string @@ -40,7 +40,8 @@ export class TaskInfo { running_time?: Duration running_time_in_nanos: DurationValue start_time_in_millis: EpochTime - status?: TaskStatus + /** Task status information can vary wildly from task to task. */ + status?: UserDefinedValue type: string parent_task_id?: TaskId } diff --git a/specification/tasks/_types/TaskStatus.ts b/specification/tasks/_types/TaskStatus.ts deleted file mode 100644 index 26190d0d04..0000000000 --- a/specification/tasks/_types/TaskStatus.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { float, long } from '@_types/Numeric' -import { Retries } from '@_types/Retries' -import { Duration, DurationValue, UnitMillis } from '@_types/Time' - -export class TaskStatus { - batches: long - canceled?: string - created: long - deleted: long - noops: long - failures?: string[] - requests_per_second: float - retries: Retries - throttled?: Duration - throttled_millis: DurationValue - throttled_until?: Duration - throttled_until_millis: DurationValue - timed_out?: boolean - took?: DurationValue - total: long - updated: long - version_conflicts: long -} diff --git a/specification/tasks/get/GetTaskResponse.ts b/specification/tasks/get/GetTaskResponse.ts index 01742d02aa..49000d9b00 100644 --- a/specification/tasks/get/GetTaskResponse.ts +++ b/specification/tasks/get/GetTaskResponse.ts @@ -17,15 +17,15 @@ * under the License. */ -import { TaskStatus } from '@tasks/_types/TaskStatus' import { ErrorCause } from '@_types/Errors' import { TaskInfo } from '../_types/TaskInfo' +import { UserDefinedValue } from '@spec_utils/UserDefinedValue' export class Response { body: { completed: boolean task: TaskInfo - response?: TaskStatus + response?: UserDefinedValue error?: ErrorCause } }