Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed null constraints on NodeInfo fields that are returned null from Amazon OpenSearch Service #1131

Closed
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
- name: Run Docker
run: |
echo "PASSWORD=admin" >> $GITHUB_ENV
docker-compose --project-directory .ci/opensearch build --build-arg OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
docker-compose --project-directory .ci/opensearch up -d
docker compose --project-directory .ci/opensearch build --build-arg OPENSEARCH_VERSION=${{ matrix.entry.opensearch_version }}
docker compose --project-directory .ci/opensearch up -d
sleep 60

- name: Sets password (new versions)
Expand All @@ -64,4 +64,4 @@ jobs:

- name: Stop Docker
run: |
docker-compose --project-directory .ci/opensearch down
docker compose --project-directory .ci/opensearch down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Dependencies
- Bumps `org.junit:junit-bom` from 5.10.2 to 5.10.3
- Bumps `org.owasp.dependencycheck` from 10.0.2 to 10.0.3
- Bumps `org.eclipse.parsson:parsson` from 1.1.6 to 1.1.7

This section is for maintaining a changelog for all breaking changes for the client that cannot be released in the 2.x line. All other non-breaking changes should be added to [Unreleased 2.x] section.

Expand All @@ -16,6 +17,7 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Changed
- Migrate client transports to Apache HttpClient / Core 5.x ([#246](https://github.com/opensearch-project/opensearch-java/pull/246))
- Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769))
- Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124))

### Deprecated
- Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536))
Expand All @@ -34,13 +36,16 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Dependencies

### Changed
- Changed URL path encoding to own implementation adapted from Apache HTTP Client 5's ([#1109](https://github.com/opensearch-project/opensearch-java/pull/1109))

### Deprecated

### Removed

### Fixed
- Fixed error when deserializing a normalizer without 'type' ([#1111](https://github.com/opensearch-project/opensearch-java/pull/1111))
- Fixed deserialization of SearchRequest when `_source` is an array ([#1117](https://github.com/opensearch-project/opensearch-java/pull/1117))
- Removed null constraints on NodeInfo fields that are returned null from Amazon OpenSearch Service ([#1131](https://github.com/opensearch-project/opensearch-java/pull/1131))

### Security

Expand Down Expand Up @@ -513,4 +518,4 @@ This section is for maintaining a changelog for all breaking changes for the cli
[2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0
[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0
8 changes: 7 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# UPGRADING

## [UPGRADING 2.x to 3.0]
## Upgrading 2.x to 3.0
### URL Path Encoding
- The default URL path encoding has been changed to be more conservative. Previously the `!`, `$`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `;`, `=`, `@` and `:` characters were left un-encoded, they will now be percent-encoded. If you require the previous behavior you can specify the `org.opensearch.path.encoding=HTTP_CLIENT_V4_EQUIV` system property.

### SearchAfter of SearchRequest type
- Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769))
- Consider using `FieldValue.of` to make string type values compatible.
Expand All @@ -18,3 +21,6 @@ After:
.searchAfter(FieldValue.of("string1"), FieldValue.of("string2"))
.searchAfter(List.of(FieldValue.of("String")))
```

### DanglingIndex creationDateMillis type
- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`.
2 changes: 1 addition & 1 deletion java-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ dependencies {
// Needed even if using Jackson to have an implementation of the Jsonp object model
// EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// https://github.com/eclipse-ee4j/parsson
api("org.eclipse.parsson:parsson:1.1.6")
api("org.eclipse.parsson:parsson:1.1.7")

// EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// http://json-b.net/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
import org.opensearch.client.opensearch._types.OpenSearchException;
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

/**
* Client for the namespace.
*/
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class OpenSearchAsyncClient extends OpenSearchAsyncClientBase<OpenSearchAsyncClient> {
public OpenSearchAsyncClient(OpenSearchTransport transport) {
Expand All @@ -61,6 +65,12 @@ public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions tra
return new OpenSearchAsyncClient(this.transport, transportOptions);
}

// ----- Child clients

public OpenSearchDanglingIndicesAsyncClient danglingIndices() {
return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@
import org.opensearch.client.opensearch._types.OpenSearchException;
import org.opensearch.client.opensearch.core.InfoRequest;
import org.opensearch.client.opensearch.core.InfoResponse;
import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient;
import org.opensearch.client.transport.OpenSearchTransport;
import org.opensearch.client.transport.TransportOptions;

/**
* Client for the namespace.
*/
@Generated("org.opensearch.client.codegen.CodeGenerator")
public class OpenSearchClient extends OpenSearchClientBase<OpenSearchClient> {
public OpenSearchClient(OpenSearchTransport transport) {
Expand All @@ -60,6 +64,12 @@ public OpenSearchClient withTransportOptions(@Nullable TransportOptions transpor
return new OpenSearchClient(this.transport, transportOptions);
}

// ----- Child clients

public OpenSearchDanglingIndicesClient danglingIndices() {
return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions);
}

// ----- Endpoint: info

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@
* 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 javax.annotation.Generated;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectDeserializer;
Expand All @@ -42,22 +47,22 @@

// typedef: _types.AcknowledgedResponseBase

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

private final boolean acknowledged;

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

protected AcknowledgedResponseBase(AbstractBuilder<?> builder) {

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

}

/**
* Required - For a successful response, this value is always true. On failure,
* an exception is returned instead.
* Required - For a successful response, this value is always true. On failure, an exception is returned instead.
* <p>
* API name: {@code acknowledged}
* </p>
*/
public final boolean acknowledged() {
return this.acknowledged;
Expand All @@ -66,44 +71,42 @@ public final boolean acknowledged() {
/**
* 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("acknowledged");
generator.write(this.acknowledged);

}

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

protected abstract static class AbstractBuilder<BuilderT extends AbstractBuilder<BuilderT>> extends ObjectBuilderBase {
private Boolean acknowledged;

/**
* Required - For a successful response, this value is always true. On failure,
* an exception is returned instead.
* Required - For a successful response, this value is always true. On failure, an exception is returned instead.
* <p>
* API name: {@code acknowledged}
* </p>
*/
public final BuilderT acknowledged(boolean value) {
this.acknowledged = value;
return self();
}

protected abstract BuilderT self();

}

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

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

op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged");

}

}
Loading