Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Feb 10, 2025
1 parent 2b43fef commit f584b38
Show file tree
Hide file tree
Showing 20 changed files with 203 additions and 131 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

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

package org.opensearch.client.opensearch._types.aggregations;

import jakarta.json.stream.JsonGenerator;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
import org.opensearch.client.util.ObjectBuilderBase;
import org.opensearch.client.util.ToCopyableBuilder;

// typedef: _types.aggregations.PercentageScoreHeuristic

@Generated("org.opensearch.client.codegen.CodeGenerator")
public class PercentageScoreHeuristic
implements
PlainJsonSerializable,
ToCopyableBuilder<PercentageScoreHeuristic.Builder, PercentageScoreHeuristic> {

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

private PercentageScoreHeuristic(Builder builder) {}

public static PercentageScoreHeuristic of(Function<PercentageScoreHeuristic.Builder, ObjectBuilder<PercentageScoreHeuristic>> fn) {
return fn.apply(new Builder()).build();
}

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

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

@Override
@Nonnull
public Builder toBuilder() {
return new Builder(this);
}

@Nonnull
public static Builder builder() {
return new Builder();
}

/**
* Builder for {@link PercentageScoreHeuristic}.
*/
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, PercentageScoreHeuristic> {

public Builder() {}

private Builder(PercentageScoreHeuristic o) {}

private Builder(Builder o) {}

@Override
@Nonnull
public Builder copy() {
return new Builder(this);
}

/**
* Builds a {@link PercentageScoreHeuristic}.
*
* @throws NullPointerException if some of the required fields are null.
*/
@Override
@Nonnull
public PercentageScoreHeuristic build() {
_checkSingleUse();

return new PercentageScoreHeuristic(this);
}
}

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

/**
* Singleton instance for {@link PercentageScoreHeuristic}.
*/
public static final PercentageScoreHeuristic _INSTANCE = builder().build();

public static final JsonpDeserializer<PercentageScoreHeuristic> _DESERIALIZER = JsonpDeserializer.emptyObject(
PercentageScoreHeuristic._INSTANCE
);

@Override
public int hashCode() {
int result = 17;
return result;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -62,7 +63,7 @@
public class GeoShape implements PlainJsonSerializable, ToCopyableBuilder<GeoShape.Builder, GeoShape> {

@Nonnull
private final List<String> coordinates;
private final List<JsonData> coordinates;

@Nullable
private final String type;
Expand All @@ -82,7 +83,7 @@ public static GeoShape of(Function<GeoShape.Builder, ObjectBuilder<GeoShape>> fn
* API name: {@code coordinates}
*/
@Nonnull
public final List<String> coordinates() {
public final List<JsonData> coordinates() {
return this.coordinates;
}

Expand All @@ -108,8 +109,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (ApiTypeHelper.isDefined(this.coordinates)) {
generator.writeKey("coordinates");
generator.writeStartArray();
for (String item0 : this.coordinates) {
generator.write(item0);
for (JsonData item0 : this.coordinates) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
Expand Down Expand Up @@ -138,7 +139,7 @@ public static Builder builder() {
*/
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, GeoShape> {
@Nullable
private List<String> coordinates;
private List<JsonData> coordinates;
@Nullable
private String type;

Expand Down Expand Up @@ -168,7 +169,7 @@ public Builder copy() {
* </p>
*/
@Nonnull
public final Builder coordinates(List<String> list) {
public final Builder coordinates(List<JsonData> list) {
this.coordinates = _listAddAll(this.coordinates, list);
return this;
}
Expand All @@ -181,7 +182,7 @@ public final Builder coordinates(List<String> list) {
* </p>
*/
@Nonnull
public final Builder coordinates(String value, String... values) {
public final Builder coordinates(JsonData value, JsonData... values) {
this.coordinates = _listAdd(this.coordinates, value, values);
return this;
}
Expand Down Expand Up @@ -220,7 +221,7 @@ public GeoShape build() {
);

protected static void setupGeoShapeDeserializer(ObjectDeserializer<GeoShape.Builder> op) {
op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "coordinates");
op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER), "coordinates");
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
super.serializeInternal(generator, mapper);
generator.writeKey("scaling_factor");
generator.write(this.scalingFactor);
}
Expand Down Expand Up @@ -183,7 +182,6 @@ public RankFeatureFunctionLogarithm build() {
);

protected static void setupRankFeatureFunctionLogarithmDeserializer(ObjectDeserializer<RankFeatureFunctionLogarithm.Builder> op) {
setupRankFeatureFunctionDeserializer(op);
op.add(Builder::scalingFactor, JsonpDeserializer.floatDeserializer(), "scaling_factor");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
super.serializeInternal(generator, mapper);
if (this.pivot != null) {
generator.writeKey("pivot");
generator.write(this.pivot);
Expand Down Expand Up @@ -189,7 +188,6 @@ public RankFeatureFunctionSaturation build() {
);

protected static void setupRankFeatureFunctionSaturationDeserializer(ObjectDeserializer<RankFeatureFunctionSaturation.Builder> op) {
setupRankFeatureFunctionDeserializer(op);
op.add(Builder::pivot, JsonpDeserializer.floatDeserializer(), "pivot");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
}

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
super.serializeInternal(generator, mapper);
generator.writeKey("exponent");
generator.write(this.exponent);

Expand Down Expand Up @@ -214,7 +213,6 @@ public RankFeatureFunctionSigmoid build() {
);

protected static void setupRankFeatureFunctionSigmoidDeserializer(ObjectDeserializer<RankFeatureFunctionSigmoid.Builder> op) {
setupRankFeatureFunctionDeserializer(op);
op.add(Builder::exponent, JsonpDeserializer.floatDeserializer(), "exponent");
op.add(Builder::pivot, JsonpDeserializer.floatDeserializer(), "pivot");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
Expand All @@ -38,7 +39,7 @@
public class XyShape implements PlainJsonSerializable, ToCopyableBuilder<XyShape.Builder, XyShape> {

@Nonnull
private final List<String> coordinates;
private final List<JsonData> coordinates;

@Nullable
private final String type;
Expand All @@ -58,7 +59,7 @@ public static XyShape of(Function<XyShape.Builder, ObjectBuilder<XyShape>> fn) {
* API name: {@code coordinates}
*/
@Nonnull
public final List<String> coordinates() {
public final List<JsonData> coordinates() {
return this.coordinates;
}

Expand All @@ -84,8 +85,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (ApiTypeHelper.isDefined(this.coordinates)) {
generator.writeKey("coordinates");
generator.writeStartArray();
for (String item0 : this.coordinates) {
generator.write(item0);
for (JsonData item0 : this.coordinates) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
Expand Down Expand Up @@ -114,7 +115,7 @@ public static Builder builder() {
*/
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, XyShape> {
@Nullable
private List<String> coordinates;
private List<JsonData> coordinates;
@Nullable
private String type;

Expand Down Expand Up @@ -144,7 +145,7 @@ public Builder copy() {
* </p>
*/
@Nonnull
public final Builder coordinates(List<String> list) {
public final Builder coordinates(List<JsonData> list) {
this.coordinates = _listAddAll(this.coordinates, list);
return this;
}
Expand All @@ -157,7 +158,7 @@ public final Builder coordinates(List<String> list) {
* </p>
*/
@Nonnull
public final Builder coordinates(String value, String... values) {
public final Builder coordinates(JsonData value, JsonData... values) {
this.coordinates = _listAdd(this.coordinates, value, values);
return this;
}
Expand Down Expand Up @@ -196,7 +197,7 @@ public XyShape build() {
);

protected static void setupXyShapeDeserializer(ObjectDeserializer<XyShape.Builder> op) {
op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "coordinates");
op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer(JsonData._DESERIALIZER), "coordinates");
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");
}

Expand Down
Loading

0 comments on commit f584b38

Please sign in to comment.