Skip to content

use baseName instead of paramName#3273

Merged
wing328 merged 1 commit intoswagger-api:masterfrom
tao-qian:use-base-name
Jul 7, 2016
Merged

use baseName instead of paramName#3273
wing328 merged 1 commit intoswagger-api:masterfrom
tao-qian:use-base-name

Conversation

@tao-qian
Copy link
Contributor

@tao-qian tao-qian commented Jul 1, 2016

Use baseName instead of paramName in @FormParam().

baseName is the one specified in the "name" field in the schema, and is normally of the form "user_id". I believe paramName is converted from baseName to be used as Java parameter name, and it is of the form "userId".

Currently, for the schema

parameters: [
    {
            "name": "user_id",
            "in": "formData",
            "type": "string"
    }
]

the generated code would be @FormParam("userId") String userId. The Jersey framework would then expect the name of the form parameter to be "userId" instead of user_id.

We are using the baseName instead of paramName in pathParams.mustache and queryParams.mustache.

@wing328
Copy link
Contributor

wing328 commented Jul 2, 2016

@qtstc thanks for the PR. Please do a rebase on the latest master to resolve the merge conflicts.

@wing328 wing328 added this to the v2.2.0 milestone Jul 2, 2016
@gmousset
Copy link

gmousset commented Jul 5, 2016

There is the same issue with SpringMVC and path parameters.

@wing328
Copy link
Contributor

wing328 commented Jul 5, 2016

@gmousset please pull the latest master and give it another try as the spring generator has changed a lot (e.g. default to generate spring boot server stub instead).

If it's still an issue, please help submit a PR so that we can review the fix.

cc @cbornet

@tao-qian
Copy link
Contributor Author

tao-qian commented Jul 6, 2016

@wing328 merged conflict resolved

@wing328 wing328 merged commit 62d06f7 into swagger-api:master Jul 7, 2016
@wing328
Copy link
Contributor

wing328 commented Jul 7, 2016

@qtstc PR merged. Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants