Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Fixed
- Fix `unitTest` task not running the tests in the `test` source set ([#2074](https://github.com/opensearch-project/opensearch-java/pull/2074))
- Run model tests against both JSON mappers instead of picking one at random ([#2085](https://github.com/opensearch-project/opensearch-java/pull/2085))
- Fix `ShardFailure.shard` incorrectly marked required causing `MissingRequiredPropertyException` ([#2037](https://github.com/opensearch-project/opensearch-java/pull/2037))

## [Unreleased 3.x]
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ public class DerivedField implements PlainJsonSerializable, ToCopyableBuilder<De
@Nullable
private final Boolean ignoreMalformed;

@Nonnull
private final String name;

@Nullable
private final String prefilterField;

Expand All @@ -88,7 +85,6 @@ public class DerivedField implements PlainJsonSerializable, ToCopyableBuilder<De
private DerivedField(Builder builder) {
this.format = builder.format;
this.ignoreMalformed = builder.ignoreMalformed;
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.prefilterField = builder.prefilterField;
this.properties = ApiTypeHelper.unmodifiable(builder.properties);
this.script = ApiTypeHelper.requireNonNull(builder.script, this, "script");
Expand All @@ -115,14 +111,6 @@ public final Boolean ignoreMalformed() {
return this.ignoreMalformed;
}

/**
* Required - API name: {@code name}
*/
@Nonnull
public final String name() {
return this.name;
}

/**
* API name: {@code prefilter_field}
*/
Expand Down Expand Up @@ -176,9 +164,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.ignoreMalformed);
}

generator.writeKey("name");
generator.write(this.name);

if (this.prefilterField != null) {
generator.writeKey("prefilter_field");
generator.write(this.prefilterField);
Expand Down Expand Up @@ -222,7 +207,6 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder
private String format;
@Nullable
private Boolean ignoreMalformed;
private String name;
@Nullable
private String prefilterField;
@Nullable
Expand All @@ -235,7 +219,6 @@ public Builder() {}
private Builder(DerivedField o) {
this.format = o.format;
this.ignoreMalformed = o.ignoreMalformed;
this.name = o.name;
this.prefilterField = o.prefilterField;
this.properties = _mapCopy(o.properties);
this.script = o.script;
Expand All @@ -245,7 +228,6 @@ private Builder(DerivedField o) {
private Builder(Builder o) {
this.format = o.format;
this.ignoreMalformed = o.ignoreMalformed;
this.name = o.name;
this.prefilterField = o.prefilterField;
this.properties = _mapCopy(o.properties);
this.script = o.script;
Expand Down Expand Up @@ -276,15 +258,6 @@ public final Builder ignoreMalformed(@Nullable Boolean value) {
return this;
}

/**
* Required - API name: {@code name}
*/
@Nonnull
public final Builder name(String value) {
this.name = value;
return this;
}

/**
* API name: {@code prefilter_field}
*/
Expand Down Expand Up @@ -373,7 +346,6 @@ public DerivedField build() {
protected static void setupDerivedFieldDeserializer(ObjectDeserializer<DerivedField.Builder> op) {
op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format");
op.add(Builder::ignoreMalformed, JsonpDeserializer.booleanDeserializer(), "ignore_malformed");
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(Builder::prefilterField, JsonpDeserializer.stringDeserializer(), "prefilter_field");
op.add(Builder::properties, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "properties");
op.add(Builder::script, Script._DESERIALIZER, "script");
Expand All @@ -385,7 +357,6 @@ public int hashCode() {
int result = 17;
result = 31 * result + Objects.hashCode(this.format);
result = 31 * result + Objects.hashCode(this.ignoreMalformed);
result = 31 * result + this.name.hashCode();
result = 31 * result + Objects.hashCode(this.prefilterField);
result = 31 * result + Objects.hashCode(this.properties);
result = 31 * result + this.script.hashCode();
Expand All @@ -400,7 +371,6 @@ public boolean equals(Object o) {
DerivedField other = (DerivedField) o;
return Objects.equals(this.format, other.format)
&& Objects.equals(this.ignoreMalformed, other.ignoreMalformed)
&& this.name.equals(other.name)
&& Objects.equals(this.prefilterField, other.prefilterField)
&& Objects.equals(this.properties, other.properties)
&& this.script.equals(other.script)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public class ShardFailure implements PlainJsonSerializable, ToCopyableBuilder<Sh
@Nonnull
private final ErrorCause reason;

private final int shard;
@Nullable
private final Integer shard;

@Nullable
private final String status;
Expand All @@ -83,7 +84,7 @@ private ShardFailure(Builder builder) {
this.node = builder.node;
this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary");
this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason");
this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard");
this.shard = builder.shard;
this.status = builder.status;
}

Expand Down Expand Up @@ -123,9 +124,10 @@ public final ErrorCause reason() {
}

/**
* Required - API name: {@code shard}
* API name: {@code shard}
*/
public final int shard() {
@Nullable
public final Integer shard() {
return this.shard;
}

Expand Down Expand Up @@ -164,8 +166,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("reason");
this.reason.serialize(generator, mapper);

generator.writeKey("shard");
generator.write(this.shard);
if (this.shard != null) {
generator.writeKey("shard");
generator.write(this.shard);
}

if (this.status != null) {
generator.writeKey("status");
Expand Down Expand Up @@ -271,7 +275,7 @@ public final Builder reason(Function<ErrorCause.Builder, ObjectBuilder<ErrorCaus
}

/**
* Required - API name: {@code shard}
* API name: {@code shard}
*/
@Nonnull
public final Builder shard(int value) {
Expand Down Expand Up @@ -328,7 +332,7 @@ public int hashCode() {
result = 31 * result + Objects.hashCode(this.node);
result = 31 * result + Boolean.hashCode(this.primary);
result = 31 * result + this.reason.hashCode();
result = 31 * result + Integer.hashCode(this.shard);
result = 31 * result + Objects.hashCode(this.shard);
result = 31 * result + Objects.hashCode(this.status);
return result;
}
Expand All @@ -342,7 +346,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.node, other.node)
&& this.primary == other.primary
&& this.reason.equals(other.reason)
&& this.shard == other.shard
&& Objects.equals(this.shard, other.shard)
&& Objects.equals(this.status, other.status);
}
}
4 changes: 0 additions & 4 deletions java-codegen/opensearch-openapi.yaml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit a change against https://github.com/opensearch-project/openSearch-api-specification, thank you

@gingeekrishna gingeekrishna Aug 17, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted the spec fix upstream: opensearch-project/opensearch-api-specification#1194

Original file line number Diff line number Diff line change
Expand Up @@ -38878,8 +38878,6 @@ components:
_common___DerivedField:
type: object
properties:
name:
type: string
type:
type: string
script:
Expand All @@ -38893,7 +38891,6 @@ components:
format:
type: string
required:
- name
- script
- type
_common___DFIIndependenceMeasure:
Expand Down Expand Up @@ -40849,7 +40846,6 @@ components:
required:
- primary
- reason
- shard
_common___ShardInfo:
type: object
properties:
Expand Down
Loading