Skip to content
This repository was archived by the owner on Aug 8, 2018. It is now read-only.
This repository was archived by the owner on Aug 8, 2018. It is now read-only.

Duplicate Model In Swagger File Because Of Same RequestBody variable Name #190

@mkvivek

Description

@mkvivek

Hi All,
we are using SpringFox to generate our Spring Rest API documentation, but having an issue while creating the swagger.json,Swagger version is 2.0("swagger":"2.0").

One of the spring controller we have a set of end points like shown below(marked as bold).

public @responsebody ResponseEntity bulkUpdateEmployee(RequestBody List contactIdList,RequestHeader(Constants.TOKEN_KEY) String authToken) {}

public @responsebody ResponseEntity bulkUpdateCategory(RequestBody List contactIdList,@RequestHeader(Constants.TOKEN_KEY) String authToken) {} etc.

So the Json Created is also having the same

[{"in":"body","name":"contactIdList","description":"contactIdList","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int64"}}},{"name":"categoryId","in":"path","description":"categoryId","required":true,"type":"integer","format":"int64"},{"name":"token","in":"header","description":"authToken","required":true,"type":"string"}],"responses":controller"],"summary":"bulkUpdateEmployee","operationId":"bulkUpdateEmployeeUsingPOST","consumes":["application/json"],"produces":["/"],"parameters":[{"in":"body","name":"contactIdList","description":"contactIdList","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int64"}}},{"name":"employeeId","in":"path","description":"employeeId","required":true,"type":"integer","format":"int64"}

While importing the tool is giving error like " contactIdList is duplicate and the same model name already exist" because of the same name and parameters.

Is there a way to overcome this ?

Thanks in advance.
Vivek

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions