openrewrite / openrewrite/rewrite
Unirest 4.x
Open
Nobody has claimed this yet.
recipe
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 571
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What problem are you trying to solve?
Starting with Unirest 4.x, there were a couple of breaking changes that need manual intervention:
- The core Unirest package has been moved from kong.unirest to kong.unirest.core, this prevents classloader issues where Unirest 4 may conflict with previous versions which may also be on the classpath.
- Unirest no longer comes with GSON as a default JSON parser. In order to enable JSON support you must include either the GSON or Jackson JSON
What precondition(s) should be checked before applying this recipe?
- The project uses Unirest-java
- The project is using at least Java 11
Examples :
diff --git a/pom.xml b/pom.xml
index aa3b42f..ea24a72 100644
--- a/pom.xml
+++ b/pom.xml
<dependencies>
@@ -43,8 +44,7 @@
<dependency>
<groupId>com.konghq</groupId>
- <artifactId>unirest-java</artifactId>
- <version>3.14.5</version>
+ <artifactId>unirest-java-core</artifactId>
+ <version>4.2.7</version>
</dependency>
-import kong.unirest.RequestBodyEntity;
-import kong.unirest.Unirest;
+import kong.unirest.core.RequestBodyEntity;
+import kong.unirest.core.Unirest;
import kong.unirest.jackson.JacksonObjectMapper;
Any additional context
https://github.com/Kong/unirest-java/blob/main/UPGRADE_GUIDE.md
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 reading the Unirest upgrade guide linked in the issue and compare its migration details with the pom.xml and import changes shown in the example. Identify the existing recipe entry point and tests for dependency or package migrations. Done means projects using Unirest-java on Java 11 or newer are updated for the Unirest 4.x coordinates, imports, and JSON-parser requirement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100