diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 1022cded5e..2601a7ad5d 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -66194,7 +66194,7 @@ "description": "Sum of index write load forecasts", "oneOf": [ { - "type": "number" + "$ref": "#/components/schemas/_spec_utils:Stringifieddouble" }, { "nullable": true, @@ -66314,21 +66314,17 @@ } ] } - }, - "required": [ - "shards", - "shards.undesired", - "write_load.forecast", - "disk.indices.forecast", - "disk.indices", - "disk.used", - "disk.avail", - "disk.total", - "disk.percent", - "host", - "ip", - "node", - "node.role" + } + }, + "_spec_utils:Stringifieddouble": { + "description": "Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior\nis used to capture this behavior while keeping the semantics of the field type.\n\nDepending on the target language, code generators can keep the union or remove it and leniently parse\nstrings to the target type.", + "oneOf": [ + { + "type": "number" + }, + { + "type": "string" + } ] }, "_types:ByteSize": { diff --git a/output/schema/schema.json b/output/schema/schema.json index aa675a7dbf..a42b1b808a 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -88280,7 +88280,7 @@ ], "description": "Number of primary and replica shards assigned to the node.", "name": "shards", - "required": true, + "required": false, "type": { "kind": "instance_of", "type": { @@ -88292,7 +88292,7 @@ { "description": "Amount of shards that are scheduled to be moved elsewhere in the cluster or -1 other than desired balance allocator is used", "name": "shards.undesired", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88320,15 +88320,24 @@ ], "description": "Sum of index write load forecasts", "name": "write_load.forecast", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ { "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + ], "type": { - "name": "double", - "namespace": "_types" + "name": "Stringified", + "namespace": "_spec_utils" } }, { @@ -88348,7 +88357,7 @@ ], "description": "Sum of shard size forecasts", "name": "disk.indices.forecast", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88376,7 +88385,7 @@ ], "description": "Disk space used by the node’s shards. Does not include disk space for the translog or unassigned shards.\nIMPORTANT: This metric double-counts disk space for hard-linked files, such as those created when shrinking, splitting, or cloning an index.", "name": "disk.indices", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88404,7 +88413,7 @@ ], "description": "Total disk space in use.\nElasticsearch retrieves this metric from the node’s operating system (OS).\nThe metric includes disk space for: Elasticsearch, including the translog and unassigned shards; the node’s operating system; any other applications or files on the node.\nUnlike `disk.indices`, this metric does not double-count disk space for hard-linked files.", "name": "disk.used", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88432,7 +88441,7 @@ ], "description": "Free disk space available to Elasticsearch.\nElasticsearch retrieves this metric from the node’s operating system.\nDisk-based shard allocation uses this metric to assign shards to nodes based on available disk space.", "name": "disk.avail", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88460,7 +88469,7 @@ ], "description": "Total disk space for the node, including in-use and available space.", "name": "disk.total", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88488,7 +88497,7 @@ ], "description": "Total percentage of disk space in use. Calculated as `disk.used / disk.total`.", "name": "disk.percent", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88515,7 +88524,7 @@ ], "description": "Network host for the node. Set using the `network.host` setting.", "name": "host", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88539,7 +88548,7 @@ { "description": "IP address and port for the node.", "name": "ip", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88566,7 +88575,7 @@ ], "description": "Name for the node. Set using the `node.name` setting.", "name": "node", - "required": true, + "required": false, "type": { "kind": "instance_of", "type": { @@ -88583,7 +88592,7 @@ ], "description": "Node roles", "name": "node.role", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -88605,7 +88614,7 @@ } } ], - "specLocation": "cat/allocation/types.ts#L24-L98" + "specLocation": "cat/allocation/types.ts#L25-L99" }, { "kind": "request", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index eaf1fd8593..081c20aa7b 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -130,7 +130,9 @@ "Request: missing json spec query parameter 'v'", "request definition cat.allocation:Request / body - A request with inherited properties must have a PropertyBody" ], - "response": [] + "response": [ + "type_alias definition _spec_utils:Stringified / union_of / instance_of - No type definition for '_spec_utils.Stringified:T'" + ] }, "cat.component_templates": { "request": [ @@ -154,9 +156,7 @@ "Request: missing json spec query parameter 'v'", "request definition cat.count:Request / body - A request with inherited properties must have a PropertyBody" ], - "response": [ - "type_alias definition _spec_utils:Stringified / union_of / instance_of - No type definition for '_spec_utils.Stringified:T'" - ] + "response": [] }, "cat.fielddata": { "request": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 3939611dd0..3ed53d7b75 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -6780,39 +6780,39 @@ export interface CatAliasesRequest extends CatCatRequestBase { export type CatAliasesResponse = CatAliasesAliasesRecord[] export interface CatAllocationAllocationRecord { - shards: string - s: string - 'shards.undesired': string | null - 'write_load.forecast': double | null - wlf: double | null - writeLoadForecast: double | null - 'disk.indices.forecast': ByteSize | null - dif: ByteSize | null - diskIndicesForecast: ByteSize | null - 'disk.indices': ByteSize | null - di: ByteSize | null - diskIndices: ByteSize | null - 'disk.used': ByteSize | null - du: ByteSize | null - diskUsed: ByteSize | null - 'disk.avail': ByteSize | null - da: ByteSize | null - diskAvail: ByteSize | null - 'disk.total': ByteSize | null - dt: ByteSize | null - diskTotal: ByteSize | null - 'disk.percent': Percentage | null - dp: Percentage | null - diskPercent: Percentage | null - host: Host | null - h: Host | null - ip: Ip | null - node: string - n: string - 'node.role': string | null - r: string | null - role: string | null - nodeRole: string | null + shards?: string + s?: string + 'shards.undesired'?: string | null + 'write_load.forecast'?: SpecUtilsStringified | null + wlf?: SpecUtilsStringified | null + writeLoadForecast?: SpecUtilsStringified | null + 'disk.indices.forecast'?: ByteSize | null + dif?: ByteSize | null + diskIndicesForecast?: ByteSize | null + 'disk.indices'?: ByteSize | null + di?: ByteSize | null + diskIndices?: ByteSize | null + 'disk.used'?: ByteSize | null + du?: ByteSize | null + diskUsed?: ByteSize | null + 'disk.avail'?: ByteSize | null + da?: ByteSize | null + diskAvail?: ByteSize | null + 'disk.total'?: ByteSize | null + dt?: ByteSize | null + diskTotal?: ByteSize | null + 'disk.percent'?: Percentage | null + dp?: Percentage | null + diskPercent?: Percentage | null + host?: Host | null + h?: Host | null + ip?: Ip | null + node?: string + n?: string + 'node.role'?: string | null + r?: string | null + role?: string | null + nodeRole?: string | null } export interface CatAllocationRequest extends CatCatRequestBase { diff --git a/specification/cat/allocation/types.ts b/specification/cat/allocation/types.ts index 067cb58b74..3d04cc3d3e 100644 --- a/specification/cat/allocation/types.ts +++ b/specification/cat/allocation/types.ts @@ -17,6 +17,7 @@ * under the License. */ +import { Stringified } from '@spec_utils/Stringified' import { ByteSize } from '@_types/common' import { Host, Ip } from '@_types/Networking' import { double, Percentage } from '@_types/Numeric' @@ -26,30 +27,30 @@ export class AllocationRecord { * Number of primary and replica shards assigned to the node. * @aliases s */ - shards: string + shards?: string /** * Amount of shards that are scheduled to be moved elsewhere in the cluster or -1 other than desired balance allocator is used */ - 'shards.undesired': string | null + 'shards.undesired'?: string | null /** * Sum of index write load forecasts * @aliases wlf,writeLoadForecast */ - 'write_load.forecast': double | null + 'write_load.forecast'?: Stringified | null /** * Sum of shard size forecasts * @aliases dif,diskIndicesForecast */ - 'disk.indices.forecast': ByteSize | null + 'disk.indices.forecast'?: ByteSize | null /** * Disk space used by the node’s shards. Does not include disk space for the translog or unassigned shards. * IMPORTANT: This metric double-counts disk space for hard-linked files, such as those created when shrinking, splitting, or cloning an index. * @aliases di,diskIndices */ - 'disk.indices': ByteSize | null + 'disk.indices'?: ByteSize | null /** * Total disk space in use. * Elasticsearch retrieves this metric from the node’s operating system (OS). @@ -57,42 +58,42 @@ export class AllocationRecord { * Unlike `disk.indices`, this metric does not double-count disk space for hard-linked files. * @aliases du,diskUsed */ - 'disk.used': ByteSize | null + 'disk.used'?: ByteSize | null /** * Free disk space available to Elasticsearch. * Elasticsearch retrieves this metric from the node’s operating system. * Disk-based shard allocation uses this metric to assign shards to nodes based on available disk space. * @aliases da,diskAvail */ - 'disk.avail': ByteSize | null + 'disk.avail'?: ByteSize | null /** * Total disk space for the node, including in-use and available space. * @aliases dt,diskTotal */ - 'disk.total': ByteSize | null + 'disk.total'?: ByteSize | null /** * Total percentage of disk space in use. Calculated as `disk.used / disk.total`. * @aliases dp,diskPercent */ - 'disk.percent': Percentage | null + 'disk.percent'?: Percentage | null /** * Network host for the node. Set using the `network.host` setting. * @aliases h */ - host: Host | null + host?: Host | null /** * IP address and port for the node. */ - ip: Ip | null + ip?: Ip | null /** * Name for the node. Set using the `node.name` setting. * @aliases n */ - node: string + node?: string /** * Node roles * @aliases r,role,nodeRole */ - 'node.role': string | null + 'node.role'?: string | null }