AppThreat / atom

Atom is a novel intermediate representation for applications and a standalone tool that is powered by chen.
https://appthreat.com
Apache License 2.0
35 stars 2 forks source link

OpenAPI spec generation in Java Spring does not prefix endpoints with the RequestMapping #143

Open Sohit1212 opened 1 month ago

Sohit1212 commented 1 month ago

Describe the issue

When trying to generate openAPI spec for a java Spring application using atom and atom-tools, the endpoints in generated spec are missing the @RequestMapping prefix path eg.

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private TransactionService transactionService;
    @Autowired
    private BalanceService balanceService;
    @Autowired
    private MailService mailService;
    @Autowired
    private UserService userService;
    @Autowired
    PasswordEncoder passwordEncoded;

    @GetMapping("/balance/{accountNo}")

Here the generated openAPI spec has endpoint /balance/{accountNo} whereas the actual endpoint should be /user/balance/{accountNo}

prabhu commented 1 month ago

Nice bug. We have a similar issue in Python with blueprint apps. I am a bit busy till end of June, but will try to think of a way to propagate class annotations to the method level.