Skip to content

Commit

Permalink
Improve descriptions of FindApiEndpoints and FindApiCalls
Browse files Browse the repository at this point in the history
  • Loading branch information
sambsnyd committed Oct 27, 2023
1 parent 5af999b commit 76013ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -31,21 +33,26 @@

import static java.util.stream.Collectors.toList;

@Value
@EqualsAndHashCode(callSuper = true)
public class FindApiEndpoints extends Recipe {
private static final List<AnnotationMatcher> 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
Expand Down

0 comments on commit 76013ef

Please sign in to comment.