Skip to content

Invalid java client code is generated when body parameter is a map. #7565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sreeshas opened this issue Feb 2, 2018 · 0 comments
Open

Comments

@sreeshas
Copy link
Contributor

sreeshas commented Feb 2, 2018

Description

When body parameter is a map, generated code is not correct.
Currently "Object" is generated. It should have been Map<String, Object>

Swagger-codegen version 2.2.3
Swagger declaration file content or url
{
            "in": "body",
            "name": "body",
            "description": "description",
            "required": true,
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "object"
              }
            }
          }
Command line used for generation

generate -i swagger.json -l java -o output

Suggest a fix/enhancement

Generated Code:

 public ApiResponse<RefLinkDto> methodName( Object body) throws ApiException {
   
    }

Correct Code: 

 public ApiResponse<RefLinkDto> methodName(Map<String, Object> body) throws ApiException {
   
    }


@3ygun 3ygun mentioned this issue Feb 13, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant