swagger-api / swagger-api/swagger-codegen

@RolesAllowed for JaxRs for server Resource

Open
#10,001 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I am using swagger-codegen to generate my resource and objects in my java backend. I want to generate:

@GET
@Path("myPath")
@RolesAllowed("myRole")
@Produces(MediaType.APPLICATION_JSON)
public Response operation(@QueryParam("field") String field) {
    return service.operation(field);
}

But I don't manage to generate the @RolesAllowed("myRole").

I already checked the code from the repo but I don't even find the part where generates that part.

Is that possible?

(You may find this question rised by me also in stackoverflow)

Thanks! :)

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 by tracing the Java server templates in swagger-codegen that render JAX-RS resource methods; the issue does not name a file or test. Check how operation-level authorization data is represented in the OpenAPI input and follow it through template rendering. Done means generated resources include the requested @RolesAllowed annotation when that configuration is present, with coverage for the generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, authorization, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.