pap
3 years agoNew Contributor
Bug when generating Java client-side code - duplicate parameter ?
Hello,
We have an API which has an endpoint which defines two parameters like these:
parameters:
- name: number_id
in: path
description: The group id.
required: true
schema:
type: integer
description: The group id.
format: int32
...
- name: NumberId
in: query
description: Id of number.
schema:
type: integer
description: Id of number.
format: int32
nullable: true
...
It is not our own API, we got the API definition file from one of our vendors.
So I have no control over the API definition JSON/YAML file.
When I import it in SwaggerHub it is marked as VALID.
But later, when I try to generate client-side java code from it in SwaggerHub (from that same valid API definition), I get code generated this way
public SomeResponseModel apiNumbersNumberIdConversationsGet(Integer numberId, ..., Integer numberId, ...) throws ApiException {
...
}
And this of course doesn't compile because it has duplicate numberId parameter.
Is this a bug in the Swagger Hub codegen module?
Seems to me it's just assigning the same Java parameter name for two different endpoint parameters, which doesn't seem right.
Thanks in advance.