Skip to content

Commit 316e2a6

Browse files
authored
fixes from api-spec pr 2440 (#757)
1 parent 57f91c7 commit 316e2a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5187
-507
lines changed
Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
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+
package co.elastic.clients.elasticsearch._types;
21+
22+
import co.elastic.clients.json.JsonpDeserializable;
23+
import co.elastic.clients.json.JsonpDeserializer;
24+
import co.elastic.clients.json.JsonpMapper;
25+
import co.elastic.clients.json.JsonpSerializable;
26+
import co.elastic.clients.json.JsonpUtils;
27+
import co.elastic.clients.json.ObjectBuilderDeserializer;
28+
import co.elastic.clients.json.ObjectDeserializer;
29+
import co.elastic.clients.util.ApiTypeHelper;
30+
import co.elastic.clients.util.ObjectBuilder;
31+
import co.elastic.clients.util.WithJsonObjectBuilderBase;
32+
import jakarta.json.stream.JsonGenerator;
33+
import java.lang.String;
34+
import java.util.Objects;
35+
import java.util.function.Function;
36+
import javax.annotation.Nullable;
37+
38+
//----------------------------------------------------------------
39+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
40+
//----------------------------------------------------------------
41+
//
42+
// This code is generated from the Elasticsearch API specification
43+
// at https://github.com/elastic/elasticsearch-specification
44+
//
45+
// Manual updates to this file will be lost when the code is
46+
// re-generated.
47+
//
48+
// If you find a property that is missing or wrongly typed, please
49+
// open an issue or a PR on the API specification repository.
50+
//
51+
//----------------------------------------------------------------
52+
53+
// typedef: _types.ElasticsearchVersionMinInfo
54+
55+
/**
56+
* Reduced (minimal) info ElasticsearchVersion
57+
*
58+
* @see <a href=
59+
* "../doc-files/api-spec.html#_types.ElasticsearchVersionMinInfo">API
60+
* specification</a>
61+
*/
62+
@JsonpDeserializable
63+
public class ElasticsearchVersionMinInfo implements JsonpSerializable {
64+
private final String buildFlavor;
65+
66+
private final String minimumIndexCompatibilityVersion;
67+
68+
private final String minimumWireCompatibilityVersion;
69+
70+
private final String number;
71+
72+
// ---------------------------------------------------------------------------------------------
73+
74+
private ElasticsearchVersionMinInfo(Builder builder) {
75+
76+
this.buildFlavor = ApiTypeHelper.requireNonNull(builder.buildFlavor, this, "buildFlavor");
77+
this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumIndexCompatibilityVersion,
78+
this, "minimumIndexCompatibilityVersion");
79+
this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumWireCompatibilityVersion,
80+
this, "minimumWireCompatibilityVersion");
81+
this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number");
82+
83+
}
84+
85+
public static ElasticsearchVersionMinInfo of(Function<Builder, ObjectBuilder<ElasticsearchVersionMinInfo>> fn) {
86+
return fn.apply(new Builder()).build();
87+
}
88+
89+
/**
90+
* Required - API name: {@code build_flavor}
91+
*/
92+
public final String buildFlavor() {
93+
return this.buildFlavor;
94+
}
95+
96+
/**
97+
* Required - API name: {@code minimum_index_compatibility_version}
98+
*/
99+
public final String minimumIndexCompatibilityVersion() {
100+
return this.minimumIndexCompatibilityVersion;
101+
}
102+
103+
/**
104+
* Required - API name: {@code minimum_wire_compatibility_version}
105+
*/
106+
public final String minimumWireCompatibilityVersion() {
107+
return this.minimumWireCompatibilityVersion;
108+
}
109+
110+
/**
111+
* Required - API name: {@code number}
112+
*/
113+
public final String number() {
114+
return this.number;
115+
}
116+
117+
/**
118+
* Serialize this object to JSON.
119+
*/
120+
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
121+
generator.writeStartObject();
122+
serializeInternal(generator, mapper);
123+
generator.writeEnd();
124+
}
125+
126+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
127+
128+
generator.writeKey("build_flavor");
129+
generator.write(this.buildFlavor);
130+
131+
generator.writeKey("minimum_index_compatibility_version");
132+
generator.write(this.minimumIndexCompatibilityVersion);
133+
134+
generator.writeKey("minimum_wire_compatibility_version");
135+
generator.write(this.minimumWireCompatibilityVersion);
136+
137+
generator.writeKey("number");
138+
generator.write(this.number);
139+
140+
}
141+
142+
@Override
143+
public String toString() {
144+
return JsonpUtils.toString(this);
145+
}
146+
147+
// ---------------------------------------------------------------------------------------------
148+
149+
/**
150+
* Builder for {@link ElasticsearchVersionMinInfo}.
151+
*/
152+
153+
public static class Builder extends WithJsonObjectBuilderBase<Builder>
154+
implements
155+
ObjectBuilder<ElasticsearchVersionMinInfo> {
156+
private String buildFlavor;
157+
158+
private String minimumIndexCompatibilityVersion;
159+
160+
private String minimumWireCompatibilityVersion;
161+
162+
private String number;
163+
164+
/**
165+
* Required - API name: {@code build_flavor}
166+
*/
167+
public final Builder buildFlavor(String value) {
168+
this.buildFlavor = value;
169+
return this;
170+
}
171+
172+
/**
173+
* Required - API name: {@code minimum_index_compatibility_version}
174+
*/
175+
public final Builder minimumIndexCompatibilityVersion(String value) {
176+
this.minimumIndexCompatibilityVersion = value;
177+
return this;
178+
}
179+
180+
/**
181+
* Required - API name: {@code minimum_wire_compatibility_version}
182+
*/
183+
public final Builder minimumWireCompatibilityVersion(String value) {
184+
this.minimumWireCompatibilityVersion = value;
185+
return this;
186+
}
187+
188+
/**
189+
* Required - API name: {@code number}
190+
*/
191+
public final Builder number(String value) {
192+
this.number = value;
193+
return this;
194+
}
195+
196+
@Override
197+
protected Builder self() {
198+
return this;
199+
}
200+
201+
/**
202+
* Builds a {@link ElasticsearchVersionMinInfo}.
203+
*
204+
* @throws NullPointerException
205+
* if some of the required fields are null.
206+
*/
207+
public ElasticsearchVersionMinInfo build() {
208+
_checkSingleUse();
209+
210+
return new ElasticsearchVersionMinInfo(this);
211+
}
212+
}
213+
214+
// ---------------------------------------------------------------------------------------------
215+
216+
/**
217+
* Json deserializer for {@link ElasticsearchVersionMinInfo}
218+
*/
219+
public static final JsonpDeserializer<ElasticsearchVersionMinInfo> _DESERIALIZER = ObjectBuilderDeserializer
220+
.lazy(Builder::new, ElasticsearchVersionMinInfo::setupElasticsearchVersionMinInfoDeserializer);
221+
222+
protected static void setupElasticsearchVersionMinInfoDeserializer(
223+
ObjectDeserializer<ElasticsearchVersionMinInfo.Builder> op) {
224+
225+
op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor");
226+
op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(),
227+
"minimum_index_compatibility_version");
228+
op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(),
229+
"minimum_wire_compatibility_version");
230+
op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number");
231+
232+
}
233+
234+
}

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public class InlineGet<TDocument> implements JsonpSerializable {
8282
@Nullable
8383
private final String routing;
8484

85+
@Nullable
8586
private final TDocument source;
8687

8788
@Nullable
@@ -98,7 +99,7 @@ private InlineGet(Builder<TDocument> builder) {
9899
this.seqNo = builder.seqNo;
99100
this.primaryTerm = builder.primaryTerm;
100101
this.routing = builder.routing;
101-
this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source");
102+
this.source = builder.source;
102103
this.tDocumentSerializer = builder.tDocumentSerializer;
103104

104105
}
@@ -154,8 +155,9 @@ public final String routing() {
154155
}
155156

156157
/**
157-
* Required - API name: {@code _source}
158+
* API name: {@code _source}
158159
*/
160+
@Nullable
159161
public final TDocument source() {
160162
return this.source;
161163
}
@@ -206,8 +208,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
206208
generator.write(this.routing);
207209

208210
}
209-
generator.writeKey("_source");
210-
JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);
211+
if (this.source != null) {
212+
generator.writeKey("_source");
213+
JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper);
214+
215+
}
211216

212217
}
213218

@@ -262,6 +267,7 @@ public final Builder<TDocument> metadata(String key, JsonData value) {
262267
@Nullable
263268
private String routing;
264269

270+
@Nullable
265271
private TDocument source;
266272

267273
@Nullable
@@ -320,9 +326,9 @@ public final Builder<TDocument> routing(@Nullable String value) {
320326
}
321327

322328
/**
323-
* Required - API name: {@code _source}
329+
* API name: {@code _source}
324330
*/
325-
public final Builder<TDocument> source(TDocument value) {
331+
public final Builder<TDocument> source(@Nullable TDocument value) {
326332
this.source = value;
327333
return this;
328334
}

0 commit comments

Comments
 (0)