Skip to content

Commit 3a7a52a

Browse files
authored
Validate indices.put_index_template (#388)
1 parent 3919a18 commit 3a7a52a

File tree

5 files changed

+298
-4
lines changed

5 files changed

+298
-4
lines changed

output/schema/schema.json

Lines changed: 193 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4752,10 +4752,17 @@
47524752
"description": "Creates or updates an index template.",
47534753
"docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-templates.html",
47544754
"name": "indices.put_index_template",
4755-
"request": null,
4755+
"request": {
4756+
"name": "Request",
4757+
"namespace": "indices.put_index_template"
4758+
},
47564759
"requestBodyRequired": true,
4757-
"response": null,
4758-
"stability": "stable",
4760+
"response": {
4761+
"name": "Response",
4762+
"namespace": "indices.put_index_template"
4763+
},
4764+
"since": "7.9.0",
4765+
"stability": "TODO",
47594766
"urls": [
47604767
{
47614768
"methods": [
@@ -87366,6 +87373,189 @@
8736687373
},
8736787374
"properties": []
8736887375
},
87376+
{
87377+
"kind": "interface",
87378+
"name": {
87379+
"name": "IndexTemplateMapping",
87380+
"namespace": "indices.put_index_template"
87381+
},
87382+
"properties": [
87383+
{
87384+
"name": "aliases",
87385+
"required": false,
87386+
"type": {
87387+
"key": {
87388+
"kind": "instance_of",
87389+
"type": {
87390+
"name": "IndexName",
87391+
"namespace": "_types"
87392+
}
87393+
},
87394+
"kind": "dictionary_of",
87395+
"singleKey": false,
87396+
"value": {
87397+
"kind": "instance_of",
87398+
"type": {
87399+
"name": "Alias",
87400+
"namespace": "indices._types"
87401+
}
87402+
}
87403+
}
87404+
},
87405+
{
87406+
"name": "mappings",
87407+
"required": false,
87408+
"type": {
87409+
"kind": "instance_of",
87410+
"type": {
87411+
"name": "TypeMapping",
87412+
"namespace": "_types.mapping"
87413+
}
87414+
}
87415+
},
87416+
{
87417+
"name": "settings",
87418+
"required": false,
87419+
"type": {
87420+
"kind": "instance_of",
87421+
"type": {
87422+
"name": "IndexSettings",
87423+
"namespace": "_types.index"
87424+
}
87425+
}
87426+
}
87427+
]
87428+
},
87429+
{
87430+
"attachedBehaviors": [
87431+
"CommonQueryParameters"
87432+
],
87433+
"body": {
87434+
"kind": "properties",
87435+
"properties": [
87436+
{
87437+
"name": "index_patterns",
87438+
"required": false,
87439+
"type": {
87440+
"kind": "instance_of",
87441+
"type": {
87442+
"name": "Indices",
87443+
"namespace": "_types"
87444+
}
87445+
}
87446+
},
87447+
{
87448+
"name": "composed_of",
87449+
"required": false,
87450+
"type": {
87451+
"kind": "array_of",
87452+
"value": {
87453+
"kind": "instance_of",
87454+
"type": {
87455+
"name": "Name",
87456+
"namespace": "_types"
87457+
}
87458+
}
87459+
}
87460+
},
87461+
{
87462+
"name": "template",
87463+
"required": false,
87464+
"type": {
87465+
"kind": "instance_of",
87466+
"type": {
87467+
"name": "IndexTemplateMapping",
87468+
"namespace": "indices.put_index_template"
87469+
}
87470+
}
87471+
},
87472+
{
87473+
"name": "data_stream",
87474+
"required": false,
87475+
"type": {
87476+
"kind": "instance_of",
87477+
"type": {
87478+
"name": "EmptyObject",
87479+
"namespace": "_types"
87480+
}
87481+
}
87482+
},
87483+
{
87484+
"name": "priority",
87485+
"required": false,
87486+
"type": {
87487+
"kind": "instance_of",
87488+
"type": {
87489+
"name": "integer",
87490+
"namespace": "_types"
87491+
}
87492+
}
87493+
},
87494+
{
87495+
"name": "version",
87496+
"required": false,
87497+
"type": {
87498+
"kind": "instance_of",
87499+
"type": {
87500+
"name": "VersionNumber",
87501+
"namespace": "_types"
87502+
}
87503+
}
87504+
},
87505+
{
87506+
"name": "_meta",
87507+
"required": false,
87508+
"type": {
87509+
"kind": "instance_of",
87510+
"type": {
87511+
"name": "IndexMetaData",
87512+
"namespace": "_types"
87513+
}
87514+
}
87515+
}
87516+
]
87517+
},
87518+
"inherits": {
87519+
"type": {
87520+
"name": "RequestBase",
87521+
"namespace": "_types"
87522+
}
87523+
},
87524+
"kind": "request",
87525+
"name": {
87526+
"name": "Request",
87527+
"namespace": "indices.put_index_template"
87528+
},
87529+
"path": [
87530+
{
87531+
"description": "Index or template name",
87532+
"name": "name",
87533+
"required": true,
87534+
"type": {
87535+
"kind": "instance_of",
87536+
"type": {
87537+
"name": "Name",
87538+
"namespace": "_types"
87539+
}
87540+
}
87541+
}
87542+
],
87543+
"query": []
87544+
},
87545+
{
87546+
"inherits": {
87547+
"type": {
87548+
"name": "AcknowledgedResponseBase",
87549+
"namespace": "_types"
87550+
}
87551+
},
87552+
"kind": "interface",
87553+
"name": {
87554+
"name": "Response",
87555+
"namespace": "indices.put_index_template"
87556+
},
87557+
"properties": []
87558+
},
8736987559
{
8737087560
"attachedBehaviors": [
8737187561
"CommonQueryParameters"

output/schema/validation-errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@
440440
},
441441
"indices.put_index_template": {
442442
"request": [
443-
"Missing request & response"
443+
"Endpoint has \"@stability: TODO"
444444
],
445445
"response": []
446446
},

output/typescript/types.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8710,6 +8710,28 @@ export interface IndicesPutAliasRequest extends RequestBase {
87108710
export interface IndicesPutAliasResponse extends ResponseBase {
87118711
}
87128712

8713+
export interface IndicesPutIndexTemplateIndexTemplateMapping {
8714+
aliases?: Record<IndexName, IndicesAlias>
8715+
mappings?: MappingTypeMapping
8716+
settings?: IndexIndexSettings
8717+
}
8718+
8719+
export interface IndicesPutIndexTemplateRequest extends RequestBase {
8720+
name: Name
8721+
body?: {
8722+
index_patterns?: Indices
8723+
composed_of?: Name[]
8724+
template?: IndicesPutIndexTemplateIndexTemplateMapping
8725+
data_stream?: EmptyObject
8726+
priority?: integer
8727+
version?: VersionNumber
8728+
_meta?: IndexMetaData
8729+
}
8730+
}
8731+
8732+
export interface IndicesPutIndexTemplateResponse extends AcknowledgedResponseBase {
8733+
}
8734+
87138735
export interface IndicesPutMappingRequest extends RequestBase {
87148736
index?: Indices
87158737
type?: Type
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Alias } from '@indices/_types/Alias'
21+
import { Dictionary } from '@spec_utils/Dictionary'
22+
import { RequestBase } from '@_types/Base'
23+
import {
24+
EmptyObject,
25+
IndexMetaData,
26+
IndexName,
27+
Indices,
28+
Name,
29+
VersionNumber
30+
} from '@_types/common'
31+
import { IndexSettings } from '@_types/index/IndexSettings'
32+
import { TypeMapping } from '@_types/mapping/TypeMapping'
33+
import { integer } from '@_types/Numeric'
34+
35+
/**
36+
* @rest_spec_name indices.put_index_template
37+
* @since 7.9.0
38+
* @stability TODO
39+
*/
40+
export interface Request extends RequestBase {
41+
path_parts: {
42+
/** Index or template name */
43+
name: Name
44+
}
45+
body?: {
46+
index_patterns?: Indices
47+
composed_of?: Name[]
48+
template?: IndexTemplateMapping
49+
data_stream?: EmptyObject
50+
priority?: integer
51+
version?: VersionNumber
52+
_meta?: IndexMetaData
53+
}
54+
}
55+
56+
export class IndexTemplateMapping {
57+
aliases?: Dictionary<IndexName, Alias>
58+
mappings?: TypeMapping
59+
settings?: IndexSettings
60+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { AcknowledgedResponseBase } from '@_types/Base'
21+
22+
export class Response extends AcknowledgedResponseBase {}

0 commit comments

Comments
 (0)