diff --git a/CHANGELOG.md b/CHANGELOG.md index f3a10a5a53..9132cde8a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ This section is for maintaining a changelog for all breaking changes for the cli - Fix PutTemplateRequest field deserialization ([#723](https://github.com/opensearch-project/opensearch-java/pull/723)) - Fix PutIndexTemplateRequest field deserialization ([#765](https://github.com/opensearch-project/opensearch-java/pull/765)) - Fix InnerHits storedFields deserialization/serialization ([#781](https://github.com/opensearch-project/opensearch-java/pull/781) +- Fix PutPipelineRequest field deserialization ([#789](https://github.com/opensearch-project/opensearch-java/issues/789) ### Security @@ -258,4 +259,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 \ No newline at end of file +[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0 diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java index 163e03dda2..80e58122ea 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java @@ -481,6 +481,7 @@ protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer b.id("test-pipeline") + .description("pipeline desc") + .processors(p -> p.convert(c -> c.field("age").targetField("age").type(ConvertType.Integer))) + ); + + var input = "{\"id\":\"test-pipeline\",\"description\":\"pipeline desc\"," + + "\"processors\":[{\"convert\":{\"field\":\"age\",\"target_field\":\"age\",\"type\":\"integer\"}}]}"; + + var deserialized = fromJson(input, PutPipelineRequest._DESERIALIZER); + + assertEquals(putPipelineRequest.id(), deserialized.id()); + assertEquals(putPipelineRequest.description(), deserialized.description()); + assertEquals(putPipelineRequest.processors().size(), deserialized.processors().size()); + + var processor = putPipelineRequest.processors().get(0); + var deserializedProcessor = deserialized.processors().get(0); + assertEquals(processor._kind(), deserializedProcessor._kind()); + assertEquals(processor.convert().field(), deserializedProcessor.convert().field()); + assertEquals(processor.convert().targetField(), deserializedProcessor.convert().targetField()); + assertEquals(processor.convert().type(), deserializedProcessor.convert().type()); + } }