Skip to content

[jaxrs-resteasy] Tags not considered when generating API classes #3446

Open
@s-kaufmann

Description

@s-kaufmann
Description

For jaxrs-resteasy server stub code generation, the naming/grouping of API classes with tags as described here does not work.
In the below example I would expect an OperationOneApi and OperationTwoApi to be generated. Instead I get a SourceApi because of the path parameter {source}.

Swagger-codegen version

2.2.0

Swagger declaration file content or url
swagger: "2.0"
info:
  version: "0.2"
  title: title
  description: description
consumes:
  - application/json
produces:
  - application/json
paths:
    /{source}/operationOne:
      post:
            tags:
                - operationOne
            parameters: 
                - name: source
                  in: path
                  required: true
                  type: string  
            responses:
                '200':
                    description: response 
    /{source}/operationTwo:
      post:
            tags:
                - operationTwo
            parameters: 
                - name: source
                  in: path
                  required: true
                  type: string  
            responses:
                '200':
                    description: response 
Command line used for generation

java -jar swagger-codegen-cli.jar generate -i test.yml -l jaxrs-resteasy -o generated

Steps to reproduce

see above

Related issues

#820

Suggest a Fix

Though I do not really understand the structure of the code, it seems to me that the problem is located in JavaResteasyServerCodegen.addOperationToGroup().
The method is identical (or, some would say "copy&paste") to other classes of the io.swagger.codegen.languages package, but the tag parameter is never used.
If I replace the method with the same method from JavaCXFServerCodegen

    public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
        super.addOperationToGroup(tag, resourcePath, operation, co, operations);        
        co.subresourceOperation = !co.path.isEmpty();
    }

then it works for me. But I have no idea if this is the right way...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions