Skip to content

Commit

Permalink
Generate more indices operations (#1358)
Browse files Browse the repository at this point in the history
* Generate aliases operations

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.add_block

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.analyze

Signed-off-by: Thomas Farr <[email protected]>

* Generate indices.clear_cache

Signed-off-by: Thomas Farr <[email protected]>

* Remove deserializing of path params in request objects

Signed-off-by: Thomas Farr <[email protected]>

* Test that deserialization fails

Signed-off-by: Thomas Farr <[email protected]>

* spotless

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Dec 18, 2024
1 parent 354debe commit 773b200
Show file tree
Hide file tree
Showing 54 changed files with 3,959 additions and 1,891 deletions.
9 changes: 8 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,11 @@ After:

### snapshot.ShardsStatsSummaryItem renamed to snapshot.SnapshotShardsStatsSummaryItem
- The `snapshot.ShardsStatsSummaryItem` class has been renamed to `snapshot.SnapshotShardsStatsSummaryItem`, this affects:
- `snapshot.SnapshotShardsStatsSummary`'s (previously `snapshot.ShardsStatsSummary`) `incremental` and `total` fields.
- `snapshot.SnapshotShardsStatsSummary`'s (previously `snapshot.ShardsStatsSummary`) `incremental` and `total` fields.

### AnalyzeToken
- The `endOffset`, `position`, `positionLength` and `startOffset` properties have been corrected to be of type `int` instead of `long`.

### ExplainAnalyzeToken
- The `endOffset`, `position`, `positionLength`, `startOffset` and `termFrequency` properties have been corrected to be of type `int` instead of `long`.
- The `positionlength` and `termfrequency` properties have had their casing corrected to `positionLength` and `termFrequency` respectively.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@
* GitHub history for details.
*/

//----------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------

package org.opensearch.client.opensearch._types;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
Expand All @@ -43,46 +49,63 @@

// typedef: _types.ShardsOperationResponseBase

@Generated("org.opensearch.client.codegen.CodeGenerator")
public abstract class ShardsOperationResponseBase implements PlainJsonSerializable {

@Nonnull
private final ShardStatistics shards;

// ---------------------------------------------------------------------------------------------

protected ShardsOperationResponseBase(AbstractBuilder<?> builder) {

this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards");

}

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

/**
* Serialize this object to JSON.
*/
@Override
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartObject();
serializeInternal(generator, mapper);
generator.writeEnd();
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

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

}

// ---------------------------------------------------------------------------------------------

protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>> extends ObjectBuilderBase {
private ShardStatistics shards;

protected AbstractBuilder() {}

protected AbstractBuilder(ShardsOperationResponseBase o) {
this.shards = o.shards;
}

protected AbstractBuilder(AbstractBuilder<BuilderT> o) {
this.shards = o.shards;
}

@Nonnull
protected abstract BuilderT self();

/**
* Required - API name: {@code _shards}
*/
@Nonnull
public final BuilderT shards(ShardStatistics value) {
this.shards = value;
return self();
Expand All @@ -91,21 +114,32 @@ public final BuilderT shards(ShardStatistics value) {
/**
* Required - API name: {@code _shards}
*/
@Nonnull
public final BuilderT shards(Function<ShardStatistics.Builder, ObjectBuilder<ShardStatistics>> fn) {
return this.shards(fn.apply(new ShardStatistics.Builder()).build());
return shards(fn.apply(new ShardStatistics.Builder()).build());
}

protected abstract BuilderT self();

}

// ---------------------------------------------------------------------------------------------

protected static <BuilderT extends AbstractBuilder<BuilderT>> void setupShardsOperationResponseBaseDeserializer(
ObjectDeserializer<BuilderT> op
) {

op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards");
}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + this.shards.hashCode();
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
ShardsOperationResponseBase other = (ShardsOperationResponseBase) o;
return this.shards.equals(other.shards);
}
}
Loading

0 comments on commit 773b200

Please sign in to comment.