From 76013efcc065e4f4ca9b2a8ccdf9b5aca42d8629 Mon Sep 17 00:00:00 2001 From: Sam Snyder Date: Fri, 27 Oct 2023 14:49:22 -0700 Subject: [PATCH] Improve descriptions of FindApiEndpoints and FindApiCalls --- .../java/spring/search/FindApiCalls.java | 10 ++++++++-- .../java/spring/search/FindApiEndpoints.java | 13 ++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/openrewrite/java/spring/search/FindApiCalls.java b/src/main/java/org/openrewrite/java/spring/search/FindApiCalls.java index 9ee72d8dc..b4dd13ac1 100644 --- a/src/main/java/org/openrewrite/java/spring/search/FindApiCalls.java +++ b/src/main/java/org/openrewrite/java/spring/search/FindApiCalls.java @@ -15,6 +15,8 @@ */ package org.openrewrite.java.spring.search; +import lombok.EqualsAndHashCode; +import lombok.Value; import org.openrewrite.ExecutionContext; import org.openrewrite.Recipe; import org.openrewrite.SourceFile; @@ -28,8 +30,11 @@ import java.util.Objects; + +@Value +@EqualsAndHashCode(callSuper = true) public class FindApiCalls extends Recipe { - final transient ApiCalls calls = new ApiCalls(this); + transient ApiCalls calls = new ApiCalls(this); @Override public String getDisplayName() { @@ -38,7 +43,8 @@ public String getDisplayName() { @Override public String getDescription() { - return "Find outbound API calls that this application is making."; + //language=markdown + return "Find outbound HTTP API calls made via Spring's `RestTemplate` class."; } @Override diff --git a/src/main/java/org/openrewrite/java/spring/search/FindApiEndpoints.java b/src/main/java/org/openrewrite/java/spring/search/FindApiEndpoints.java index 47f37f14f..d444330e1 100644 --- a/src/main/java/org/openrewrite/java/spring/search/FindApiEndpoints.java +++ b/src/main/java/org/openrewrite/java/spring/search/FindApiEndpoints.java @@ -15,6 +15,8 @@ */ package org.openrewrite.java.spring.search; +import lombok.EqualsAndHashCode; +import lombok.Value; import org.openrewrite.ExecutionContext; import org.openrewrite.Recipe; import org.openrewrite.TreeVisitor; @@ -31,21 +33,26 @@ import static java.util.stream.Collectors.toList; +@Value +@EqualsAndHashCode(callSuper = true) public class FindApiEndpoints extends Recipe { private static final List REST_ENDPOINTS = Stream.of("Request", "Get", "Post", "Put", "Delete", "Patch") .map(method -> new AnnotationMatcher("@org.springframework.web.bind.annotation." + method + "Mapping")) .collect(toList()); - final transient ApiEndpoints apis = new ApiEndpoints(this); + transient ApiEndpoints apis = new ApiEndpoints(this); @Override public String getDisplayName() { - return "Find API endpoints"; + return "Find Spring API endpoints"; } @Override public String getDescription() { - return "Find all API endpoints that this application exposes."; + //language=markdown + return "Find all HTTP API endpoints exposed by Spring applications. " + + "More specifically, this marks method declarations annotated with `@RequestMapping`, `@GetMapping`, " + + "`@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` as search results."; } @Override