From 9889e76136f50228fd2887cd90e1e55f407be1ad Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 10 Oct 2025 16:36:04 +0400 Subject: [PATCH 1/2] rest-api-spec: Add missing options to enum types --- .../resources/rest-api-spec/api/cat.segments.json | 8 +++++++- .../rest-api-spec/api/connector.sync_job_list.json | 13 +++++++++++-- .../rest-api-spec/api/esql.async_query.json | 14 ++++++++++++-- .../rest-api-spec/api/esql.async_query_get.json | 14 ++++++++++++-- .../resources/rest-api-spec/api/esql.query.json | 14 ++++++++++++-- .../rest-api-spec/api/ml.get_trained_models.json | 11 +++++++++-- .../api/ml.start_trained_model_deployment.json | 13 ++++++++----- .../rest-api-spec/api/simulate.ingest.json | 8 ++++++-- .../resources/rest-api-spec/api/sql.query.json | 13 +++++++++++-- .../api/text_structure.find_field_structure.json | 10 +++++++--- .../api/text_structure.find_message_structure.json | 10 +++++++--- 11 files changed, 102 insertions(+), 26 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json index 719388791b580..7739cb3167e15 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json @@ -108,7 +108,13 @@ }, "expand_wildcards": { "type": "enum", - "options": ["open", "closed", "hidden", "none", "all"], + "options": [ + "open", + "closed", + "hidden", + "none", + "all" + ], "default": "open", "description": "Whether to expand wildcard expression to concrete indices that are open, closed or both." }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json b/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json index c4e958e197811..5661ab110243c 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json @@ -33,8 +33,17 @@ "description": "specifies a max number of results to get (default: 100)" }, "status": { - "type": "string", - "description": "Sync job status, which sync jobs are fetched for" + "type": "enum", + "description": "A sync job status to fetch connector sync jobs for", + "options": [ + "canceling", + "canceled", + "completed", + "error", + "in_progress", + "pending", + "suspended" + ] }, "connector_id": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json index 1f3dcbe2e70f8..6e23fddea26aa 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json @@ -26,8 +26,18 @@ }, "params": { "format": { - "type": "string", - "description": "a short version of the Accept header, e.g. json, yaml" + "type": "enum", + "description": "A short version of the Accept header, e.g. json, yaml.\n\n`csv`, `tsv`, and `txt` formats will return results in a tabular format, excluding other metadata fields from the response.\n\nFor async requests, nothing will be returned if the async query doesn't finish within the timeout.\nThe query ID and running status are available in the `X-Elasticsearch-Async-Id` and `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.", + "options": [ + "csv", + "json", + "tsv", + "txt", + "yaml", + "cbor", + "smile", + "arrow" + ] }, "delimiter": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json index fe7ad1d6cd115..d07506944ee27 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json @@ -29,8 +29,18 @@ }, "params": { "format": { - "type": "string", - "description": "a short version of the Accept header, e.g. json, yaml" + "type": "enum", + "description": "A short version of the Accept header, for example `json` or `yaml`.", + "options": [ + "csv", + "json", + "tsv", + "txt", + "yaml", + "cbor", + "smile", + "arrow" + ] }, "wait_for_completion_timeout": { "type": "time", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json index c8f63550ef185..9e0c8ad5f0af7 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json @@ -26,8 +26,18 @@ }, "params": { "format": { - "type": "string", - "description": "a short version of the Accept header, e.g. json, yaml" + "type": "enum", + "description": "A short version of the Accept header, e.g. json, yaml.\n\n`csv`, `tsv`, and `txt` formats will return results in a tabular format, excluding other metadata fields from the response.", + "options": [ + "csv", + "json", + "tsv", + "txt", + "yaml", + "cbor", + "smile", + "arrow" + ] }, "delimiter": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/ml.get_trained_models.json b/rest-api-spec/src/main/resources/rest-api-spec/api/ml.get_trained_models.json index 400b64ccbb855..fa928cee1ecac 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/ml.get_trained_models.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/ml.get_trained_models.json @@ -40,8 +40,15 @@ "default": true }, "include": { - "type": "string", - "description": "A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none." + "type": "enum", + "description": "A comma delimited string of optional fields to include in the response\nbody.", + "options": [ + "definition", + "feature_importance_baseline", + "hyperparameters", + "total_feature_importance", + "definition_status" + ] }, "decompress_definition": { "type": "boolean", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/ml.start_trained_model_deployment.json b/rest-api-spec/src/main/resources/rest-api-spec/api/ml.start_trained_model_deployment.json index 81faf2cfba3d4..da94038e7c228 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/ml.start_trained_model_deployment.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/ml.start_trained_model_deployment.json @@ -51,9 +51,12 @@ "default": 1 }, "priority": { - "type": "string", + "type": "enum", "description": "The deployment priority.", - "default": "normal" + "options": [ + "normal", + "low" + ] }, "queue_capacity": { "type": "int", @@ -66,11 +69,11 @@ "default": "20s" }, "wait_for": { - "type": "string", - "description": "The allocation status for which to wait", + "type": "enum", + "description": "Specifies the allocation status to wait for before returning.", "options": [ - "starting", "started", + "starting", "fully_allocated" ], "default": "started" diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json b/rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json index 8a556ce996438..db612016a5b86 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json @@ -44,8 +44,12 @@ "description": "The pipeline id to preprocess incoming documents with if no pipeline is given for a particular document" }, "merge_type": { - "type": "string", - "description": "The mapping merge type if mapping overrides are being provided in mapping_addition. The allowed values are one of index or template. The index option merges mappings the way they would be merged into an existing index. The template option merges mappings the way they would be merged into a template.", + "type": "enum", + "description": "The mapping merge type if mapping overrides are being provided in mapping_addition.\nThe allowed values are one of index or template.\nThe index option merges mappings the way they would be merged into an existing index.\nThe template option merges mappings the way they would be merged into a template.", + "options": [ + "index", + "template" + ], "default": "index" } }, diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/sql.query.json b/rest-api-spec/src/main/resources/rest-api-spec/api/sql.query.json index 1a5b5eba6ca39..f444fa5d117c8 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/sql.query.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/sql.query.json @@ -27,8 +27,17 @@ }, "params": { "format": { - "type": "string", - "description": "a short version of the Accept header, e.g. json, yaml" + "type": "enum", + "description": "The format for the response.\nYou can also specify a format using the `Accept` HTTP header.\nIf you specify both this parameter and the `Accept` HTTP header, this parameter takes precedence.", + "options": [ + "csv", + "json", + "tsv", + "txt", + "yaml", + "cbor", + "smile" + ] }, "project_routing": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json b/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json index 1e7e1a33a831d..c9415df9e1458 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json @@ -73,9 +73,13 @@ "description": "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file" }, "ecs_compatibility": { - "type": "string", - "default": "disabled", - "description": "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'" + "type": "enum", + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of the meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output.\nThe intention in that situation is that a user who knows the meanings will rename the fields before using them.", + "options": [ + "disabled", + "v1" + ], + "default": "disabled" }, "timestamp_field": { "type": "string", diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json b/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json index 8f1527341fc5f..c59a0551ff7f2 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json @@ -62,9 +62,13 @@ "description": "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file" }, "ecs_compatibility": { - "type": "string", - "default": "disabled", - "description": "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'" + "type": "enum", + "description": "The mode of compatibility with ECS compliant Grok patterns.\nUse this parameter to specify whether to use ECS Grok patterns instead of legacy ones when the structure finder creates a Grok pattern.\nThis setting primarily has an impact when a whole message Grok pattern such as `%{CATALINALOG}` matches the input.\nIf the structure finder identifies a common structure but has no idea of meaning then generic field names such as `path`, `ipaddress`, `field1`, and `field2` are used in the `grok_pattern` output, with the intention that a user who knows the meanings rename these fields before using it.", + "options": [ + "disabled", + "v1" + ], + "default": "disabled" }, "timestamp_field": { "type": "string", From f45dedfc72631cdd45cdcc5b4f3e29915c2e928c Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 24 Oct 2025 18:08:53 +0400 Subject: [PATCH 2/2] Allow 0-9 in enum options --- rest-api-spec/src/main/resources/schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest-api-spec/src/main/resources/schema.json b/rest-api-spec/src/main/resources/schema.json index c17219c1b96c0..569f64931281c 100644 --- a/rest-api-spec/src/main/resources/schema.json +++ b/rest-api-spec/src/main/resources/schema.json @@ -256,7 +256,7 @@ "type": "array", "items": { "type": "string", - "pattern": "^[a-zA-Z_]+$" + "pattern": "^[_a-zA-Z][_a-zA-Z0-9]*$" }, "title": "Valid options when type is an enum" },