Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -23,6 +23,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Add document lifecycle guide and runnable sample ([#2017](https://github.com/opensearch-project/opensearch-java/pull/2017))

### Fixed
- Fix `DerivedField` serializing unsupported `name` field causing `mapper_parsing_exception` ([#2036](https://github.com/opensearch-project/opensearch-java/pull/2036))

## [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

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 do not modify classes marked as @Generated, submit the fix to the OpenSearch API specification instead [1]. thank you

[1] https://github.com/opensearch-project/opensearch-api-specification/blob/ec27dffec4f87a3d15434c0a203d9e84a99356e1/spec/schemas/_common.yaml#L576

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
3 changes: 0 additions & 3 deletions java-codegen/opensearch-openapi.yaml
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
Loading