Skip to content

Commit 6a04519

Browse files
authored
rest-api-spec: Add missing options to enum types (elastic#136640) (elastic#137356)
* rest-api-spec: Add missing options to enum types * Allow 0-9 in enum options (cherry picked from commit 2a77e79) # Conflicts: # rest-api-spec/src/main/resources/rest-api-spec/api/simulate.ingest.json # rest-api-spec/src/main/resources/rest-api-spec/api/sql.query.json
1 parent 7501b04 commit 6a04519

10 files changed

+86
-23
lines changed

rest-api-spec/src/main/resources/rest-api-spec/api/cat.segments.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@
108108
},
109109
"expand_wildcards": {
110110
"type": "enum",
111-
"options": ["open", "closed", "hidden", "none", "all"],
111+
"options": [
112+
"open",
113+
"closed",
114+
"hidden",
115+
"none",
116+
"all"
117+
],
112118
"default": "open",
113119
"description": "Whether to expand wildcard expression to concrete indices that are open, closed or both."
114120
},

rest-api-spec/src/main/resources/rest-api-spec/api/connector.sync_job_list.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,17 @@
3333
"description": "specifies a max number of results to get (default: 100)"
3434
},
3535
"status": {
36-
"type": "string",
37-
"description": "Sync job status, which sync jobs are fetched for"
36+
"type": "enum",
37+
"description": "A sync job status to fetch connector sync jobs for",
38+
"options": [
39+
"canceling",
40+
"canceled",
41+
"completed",
42+
"error",
43+
"in_progress",
44+
"pending",
45+
"suspended"
46+
]
3847
},
3948
"connector_id": {
4049
"type": "string",

rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@
2626
},
2727
"params": {
2828
"format": {
29-
"type": "string",
30-
"description": "a short version of the Accept header, e.g. json, yaml"
29+
"type": "enum",
30+
"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.",
31+
"options": [
32+
"csv",
33+
"json",
34+
"tsv",
35+
"txt",
36+
"yaml",
37+
"cbor",
38+
"smile",
39+
"arrow"
40+
]
3141
},
3242
"delimiter": {
3343
"type": "string",

rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@
2929
},
3030
"params": {
3131
"format": {
32-
"type": "string",
33-
"description": "a short version of the Accept header, e.g. json, yaml"
32+
"type": "enum",
33+
"description": "A short version of the Accept header, for example `json` or `yaml`.",
34+
"options": [
35+
"csv",
36+
"json",
37+
"tsv",
38+
"txt",
39+
"yaml",
40+
"cbor",
41+
"smile",
42+
"arrow"
43+
]
3444
},
3545
"wait_for_completion_timeout": {
3646
"type": "time",

rest-api-spec/src/main/resources/rest-api-spec/api/esql.query.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@
2626
},
2727
"params": {
2828
"format": {
29-
"type": "string",
30-
"description": "a short version of the Accept header, e.g. json, yaml"
29+
"type": "enum",
30+
"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.",
31+
"options": [
32+
"csv",
33+
"json",
34+
"tsv",
35+
"txt",
36+
"yaml",
37+
"cbor",
38+
"smile",
39+
"arrow"
40+
]
3141
},
3242
"delimiter": {
3343
"type": "string",

rest-api-spec/src/main/resources/rest-api-spec/api/ml.get_trained_models.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,15 @@
4040
"default": true
4141
},
4242
"include": {
43-
"type": "string",
44-
"description": "A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none."
43+
"type": "enum",
44+
"description": "A comma delimited string of optional fields to include in the response\nbody.",
45+
"options": [
46+
"definition",
47+
"feature_importance_baseline",
48+
"hyperparameters",
49+
"total_feature_importance",
50+
"definition_status"
51+
]
4552
},
4653
"include_model_definition": {
4754
"type": "boolean",

rest-api-spec/src/main/resources/rest-api-spec/api/ml.start_trained_model_deployment.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@
5151
"default": 1
5252
},
5353
"priority": {
54-
"type": "string",
54+
"type": "enum",
5555
"description": "The deployment priority.",
56-
"default": "normal"
56+
"options": [
57+
"normal",
58+
"low"
59+
]
5760
},
5861
"queue_capacity": {
5962
"type": "int",
@@ -66,11 +69,11 @@
6669
"default": "20s"
6770
},
6871
"wait_for": {
69-
"type": "string",
70-
"description": "The allocation status for which to wait",
72+
"type": "enum",
73+
"description": "Specifies the allocation status to wait for before returning.",
7174
"options": [
72-
"starting",
7375
"started",
76+
"starting",
7477
"fully_allocated"
7578
],
7679
"default": "started"

rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_field_structure.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,13 @@
7373
"description": "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"
7474
},
7575
"ecs_compatibility": {
76-
"type": "string",
77-
"default": "disabled",
78-
"description": "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"
76+
"type": "enum",
77+
"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.",
78+
"options": [
79+
"disabled",
80+
"v1"
81+
],
82+
"default": "disabled"
7983
},
8084
"timestamp_field": {
8185
"type": "string",

rest-api-spec/src/main/resources/rest-api-spec/api/text_structure.find_message_structure.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@
6262
"description": "Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file"
6363
},
6464
"ecs_compatibility": {
65-
"type": "string",
66-
"default": "disabled",
67-
"description": "Optional parameter to specify the compatibility mode with ECS Grok patterns - may be either 'v1' or 'disabled'"
65+
"type": "enum",
66+
"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.",
67+
"options": [
68+
"disabled",
69+
"v1"
70+
],
71+
"default": "disabled"
6872
},
6973
"timestamp_field": {
7074
"type": "string",

rest-api-spec/src/main/resources/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
"type": "array",
257257
"items": {
258258
"type": "string",
259-
"pattern": "^[a-zA-Z_]+$"
259+
"pattern": "^[_a-zA-Z][_a-zA-Z0-9]*$"
260260
},
261261
"title": "Valid options when type is an enum"
262262
},

0 commit comments

Comments
 (0)