openrewrite / openrewrite/rewrite-spring

@PathVariable, @RequestBody, @ApiParam, similar annotations, may be removed if they're present on superclass or interface

Open
#9 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #698 by @arodionov — closed without merging
enhancement
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

There are various spring annotations, including but not limited to @PathVariable, @RequestBody, @Valid, @Size, @ApiParam, @Pattern, which allow developers to tell spring about the contract their API has.

If these annotations are present on a superclass or interface being implemented then they can be removed from the subclass.
Leaving them isn't necessarily harmful so long as the arguments of the duplicated annotations match. If the arguments do not match it's a spring runtime error. So this is a "best practices & hygiene" rather than an "essential for migration" sort visitor.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the annotation cases listed in the issue and the history of closed pull request #698 before starting. Identify the existing recipe entry point and tests for Spring annotation handling, then verify that inherited annotations are removed only when appropriate and that coverage includes the listed annotation types and conflicting arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.