diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java index 7822908e4b..cead52f23d 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java @@ -187,8 +187,8 @@ public final Boolean includeDefaults() { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -414,8 +414,8 @@ public final Builder includeDefaults(@Nullable Boolean value) { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -431,8 +431,8 @@ public final Builder index(List list) { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java index 34719923bb..fada14bad7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java @@ -140,8 +140,8 @@ public final Time masterTimeout() { } /** - * Comma-separated list of index template names used to limit the request. Wildcard () expressions are supported. To - * return all index templates, omit this parameter or use a value of _all or . + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} *

@@ -278,8 +278,8 @@ public final Builder masterTimeout(Function> f } /** - * Comma-separated list of index template names used to limit the request. Wildcard () expressions are supported. - * To return all index templates, omit this parameter or use a value of _all or . + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} *

@@ -295,8 +295,8 @@ public final Builder name(List list) { } /** - * Comma-separated list of index template names used to limit the request. Wildcard () expressions are supported. - * To return all index templates, omit this parameter or use a value of _all or . + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java index be2d852e49..e338763804 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java @@ -46,8 +46,10 @@ import javax.annotation.Generated; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.RequestBase; @@ -65,9 +67,11 @@ /** * Updates the index settings. */ +@JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") public class PutIndicesSettingsRequest extends RequestBase implements + PlainJsonSerializable, ToCopyableBuilder { @Nullable @@ -179,8 +183,8 @@ public final Boolean ignoreUnavailable() { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -409,8 +413,8 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

@@ -426,8 +430,8 @@ public final Builder index(List list) { } /** - * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (). To - * target all data streams and indexes, omit this parameter or use or _all. + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} *

diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java index 9fb7a70ca5..020823bc03 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java @@ -654,9 +654,6 @@ protected static void setupPutTemplateRequestDeserializer(ObjectDeserializer { @Nullable diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/core/PutTemplateRequestTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/core/PutTemplateRequestTest.java index 0ca7c53594..ab34c97984 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/core/PutTemplateRequestTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/core/PutTemplateRequestTest.java @@ -29,7 +29,6 @@ public void deserialize_validFieldsIncluded_RequestIsBuilt() throws JsonProcessi final Map indexTemplateMap = new HashMap<>(); indexTemplateMap.put("name", "test"); indexTemplateMap.put("index_patterns", "*"); - indexTemplateMap.put("create", true); indexTemplateMap.put("order", 1); final String indexTemplate = new ObjectMapper().writeValueAsString(indexTemplateMap); @@ -37,9 +36,8 @@ public void deserialize_validFieldsIncluded_RequestIsBuilt() throws JsonProcessi final PutTemplateRequest putTemplateRequest = PutTemplateRequest._DESERIALIZER.deserialize(parser, mapper); - assertEquals(putTemplateRequest.name(), "test"); - assertEquals(putTemplateRequest.indexPatterns(), Collections.singletonList("*")); - assertEquals((int) putTemplateRequest.order(), 1); - assertEquals(putTemplateRequest.create(), true); + assertEquals("test", putTemplateRequest.name()); + assertEquals(Collections.singletonList("*"), putTemplateRequest.indexPatterns()); + assertEquals((Integer) 1, putTemplateRequest.order()); } } diff --git a/java-codegen/build.gradle.kts b/java-codegen/build.gradle.kts index 1fb5b501ed..1936c59448 100644 --- a/java-codegen/build.gradle.kts +++ b/java-codegen/build.gradle.kts @@ -172,7 +172,7 @@ dependencies { implementation("org.semver4j", "semver4j", "5.3.0") // BSD-2-Clause - implementation("org.commonmark", "commonmark", "0.23.0") + implementation("org.commonmark", "commonmark", "0.24.0") // EPL-2.0 testImplementation(platform("org.junit:junit-bom:5.11.3")) diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index e35a3593a0..7e7f867ab4 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -20855,7 +20855,8 @@ components: Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values. schema: - type: number + type: integer + format: int32 style: form indices.recovery___path.index: in: path diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java index 41c72ed35e..e7c4f2e06e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java @@ -50,7 +50,7 @@ private Field(@Nonnull Builder builder) { } this.type = Objects.requireNonNull(builder.type, "type must not be null"); this.required = builder.required; - this.description = builder.description != null ? Markdown.toJavaDocHtml(builder.description) : null; + this.description = builder.description; this.deprecation = builder.deprecation; this.aliases = builder.aliases; } @@ -156,7 +156,7 @@ public Builder withRequired(boolean required) { @Nonnull public Builder withDescription(@Nullable String description) { - this.description = description; + this.description = description != null ? Markdown.toJavaDocHtml(description) : null; return this; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index 3024963920..c806b31fee 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -107,6 +107,11 @@ public Collection getFieldsToDeserialize() { return fields.values(); } + @Override + public boolean hasFieldsToSerialize() { + return hasRequestBody(); + } + public boolean hasRequestBody() { return hasDelegatedBodyField() || !getBodyFields().isEmpty(); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index e2928c673a..66804fe4ae 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; import org.apache.commons.lang3.NotImplementedException; @@ -214,12 +215,6 @@ private RequestShape visit(@Nonnull Namespace parent, @Nonnull OperationGroup gr shape.addPathParam(entry.getValue().toBuilder().withRequired(requiredPathParams.contains(entry.getKey())).build()); } - variants.stream() - .flatMap(v -> v.getAllRelevantParameters(In.Query).stream()) - .filter(p -> !p.isGlobal()) - .map(this::visit) - .forEachOrdered(shape::addQueryParam); - variants.stream() .map(OpenApiOperation::getRequestBody) .flatMap(Optional::stream) @@ -237,6 +232,16 @@ private RequestShape visit(@Nonnull Namespace parent, @Nonnull OperationGroup gr } }); + var bodyFieldNames = (shape.hasDelegatedBodyField() + ? (ObjectShapeBase) shape.getDelegatedBodyField().getType().getTargetShape().orElseThrow() + : shape).getBodyFields().stream().map(Field::getWireName).collect(Collectors.toSet()); + + variants.stream() + .flatMap(v -> v.getAllRelevantParameters(In.Query).stream()) + .filter(p -> !p.isGlobal() && !bodyFieldNames.contains(p.getName().orElseThrow())) + .map(this::visit) + .forEachOrdered(shape::addQueryParam); + if (shape.getExtendsType() == null) { shape.setExtendsType(Types.Client.OpenSearch._Types.RequestBase); } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache index ebdacdc7ae..9219fc912f 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/queryParamify.mustache @@ -1,7 +1,15 @@ -{{#type.isString}} - {{value}} -{{/type.isString}} -{{^type.isString}} +{{#type.isList}} + {{#type.listValueType.isString}} + String.join(",", {{value}}) + {{/type.listValueType.isString}} + {{^type.listValueType.isString}} + {{value}} + .stream() + .map(v -> {{#type.listValueType.queryParamify}}v{{/type.listValueType.queryParamify}}) + .collect({{TYPES.Java.Util.Stream.Collectors}}.joining(",")) + {{/type.listValueType.isString}} +{{/type.isList}} +{{^type.isList}} {{#type.isEnum}} {{value}}.jsonValue() {{/type.isEnum}} @@ -10,20 +18,17 @@ String.valueOf({{value}}) {{/type.isPotentiallyBoxedPrimitive}} {{^type.isPotentiallyBoxedPrimitive}} - {{#type.isList}} - {{#type.listValueType.isString}} - String.join(",", {{value}}) - {{/type.listValueType.isString}} - {{^type.listValueType.isString}} + {{#type.isNumber}} + String.valueOf({{value}}) + {{/type.isNumber}} + {{^type.isNumber}} + {{#type.isString}} {{value}} - .stream() - .map(v -> {{#type.listValueType.queryParamify}}v{{/type.listValueType.queryParamify}}) - .collect({{TYPES.Java.Util.Stream.Collectors}}.joining(",")) - {{/type.listValueType.isString}} - {{/type.isList}} - {{^type.isList}} - {{value}}._toJsonString() - {{/type.isList}} + {{/type.isString}} + {{^type.isString}} + {{value}}._toJsonString() + {{/type.isString}} + {{/type.isNumber}} {{/type.isPotentiallyBoxedPrimitive}} {{/type.isEnum}} -{{/type.isString}} +{{/type.isList}} \ No newline at end of file