Skip to content

Commit

Permalink
fix: remove required check on indices.stats.ShardStats.shards
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Macpherson <[email protected]>
  • Loading branch information
LiamMacpherson authored and Liam Macpherson committed Sep 2, 2024
1 parent 5a9ea74 commit c98c500
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Removed

### Fixed
- Remove required check on ShardStats.shards ([#XXX](https://github.com/opensearch-project/opensearch-java/pull/XXX))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,15 @@
package org.opensearch.client.opensearch.indices.stats;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
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.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch._types.BulkStats;
import org.opensearch.client.opensearch._types.CompletionStats;
import org.opensearch.client.opensearch._types.DocStats;
import org.opensearch.client.opensearch._types.FielddataStats;
import org.opensearch.client.opensearch._types.FlushStats;
import org.opensearch.client.opensearch._types.GetStats;
import org.opensearch.client.opensearch._types.IndexingStats;
import org.opensearch.client.opensearch._types.MergesStats;
import org.opensearch.client.opensearch._types.RecoveryStats;
import org.opensearch.client.opensearch._types.RefreshStats;
import org.opensearch.client.opensearch._types.RequestCacheStats;
import org.opensearch.client.opensearch._types.SearchStats;
import org.opensearch.client.opensearch._types.SegmentsStats;
import org.opensearch.client.opensearch._types.StoreStats;
import org.opensearch.client.opensearch._types.TranslogStats;
import org.opensearch.client.opensearch._types.WarmerStats;
import org.opensearch.client.json.*;
import org.opensearch.client.opensearch._types.*;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;

import javax.annotation.Nullable;
import java.util.function.Function;

// typedef: indices.stats.ShardStats

@JsonpDeserializable
Expand Down Expand Up @@ -110,6 +91,7 @@ public class ShardStats implements PlainJsonSerializable {
@Nullable
private final BulkStats bulk;

@Nullable
private final ShardsTotalStats shards;

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -302,8 +284,9 @@ public final BulkStats bulk() {
}

/**
* Required - API name: {@code shards}
* API name: {@code shards}
*/
@Nullable
public final ShardsTotalStats shards() {
return this.shards;
}
Expand Down Expand Up @@ -387,9 +370,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
this.bulk.serialize(generator, mapper);

}
generator.writeKey("shards");
this.shards.serialize(generator, mapper);

if (this.shards != null) {
generator.writeKey("shards");
this.shards.serialize(generator, mapper);
}
}

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -444,6 +428,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<S
@Nullable
private BulkStats bulk;

@Nullable
private ShardsTotalStats shards;

/**
Expand Down Expand Up @@ -777,15 +762,15 @@ public final Builder bulk(Function<BulkStats.Builder, ObjectBuilder<BulkStats>>
}

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

/**
* Required - API name: {@code shards}
* API name: {@code shards}
*/
public final Builder shards(Function<ShardsTotalStats.Builder, ObjectBuilder<ShardsTotalStats>> fn) {
return this.shards(fn.apply(new ShardsTotalStats.Builder()).build());
Expand Down

0 comments on commit c98c500

Please sign in to comment.