opensearch-project / opensearch-project/opensearch-java
[FEATURE] toString on API classes
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 165
- Forks
- 250
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 26
Description
Is your feature request related to a problem?
When interacting with the OpenSearch-Java API during development and testing, I noticed the lack of a toString implementation on the generated API. On test assertion failures this leads to failed assertions looking like this:
java.lang.AssertionError:
Expected size: 99 but was: 100 in:
[org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@4b65d9f4,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@44536de4,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@5fcfde70,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@4d95a72e,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@28da7d11,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@77b919a3,
org.opensearch.client.opensearch.core.mget.MultiGetResponseItem@5624657a,
[...]
Which is not exactly helpful to analyse the error... ;-)
What solution would you like?
I'd like to propose adding a minimal toString implementation to the API's POJOs that captures the essence of the respective object. For the MultiGetResponseItem from the sample above that could be index + id of the returned document if there is a result and the failure status if it represents a failure.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the generated API POJOs, especially MultiGetResponseItem, and the issue discussion about what each representation should contain. Determine the intended scope and consistent object details for toString output. Done means the relevant API objects produce useful assertion messages without exposing only default identity strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100