OpenAPITools / OpenAPITools/openapi-generator

[REQ][JAVA][Spring] Put @RequestMapping 'value' to a variable

Open
#17,717 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Describe the solution you'd like

I would like the @RequestMapping annotation value to be extracted into a public static String variable. This would enable us to use the extracted path for example in spring web security config.

Additional context

This is what I'm looking for:

@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2024-01-26T14:13:01.608014+01:00[Europe/Budapest]")
@Validated
@Tag(name = "demo", description = "the demo API")
public interface DemoApi {

    public static String SEND_LOGIN_EVENT_URL = "/event/login";
@RequestMapping(
    method = RequestMethod.POST,
    value = SEND_LOGIN_EVENT_URL,
    produces = { "application/json" },
    consumes = { "application/json" }
)

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

Start at the Spring generator or templates that emit the DemoApi @RequestMapping and trace how annotation values are rendered. Confirm the generated interface exposes a public static String for each path and uses that constant in the annotation, then verify the generated output with the repository’s relevant generator tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.