Skip to content

[JAVA] Feign client generator: HTTP Header params are getting converted to camel case #3502

@himanshu-mishra

Description

@himanshu-mishra
Description

For Java API Client using Feign as library, header param names are getting converted to came case breaking the API.
For example: header parameter user-id gets converted to userId.

Swagger-codegen version

2.2.0

Suggest a Fix

Issue is with Line 30 of api.mustache
https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/Java/libraries/feign/api.mustache#L30

Changing the template on left hand side from paramName to baseName fixes the issue.
From:
"{{paramName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}},
To:
"{{baseName}}: {{=<% %>=}}{<%paramName%>}<%={{ }}=%>"{{#hasMore}},

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions