[cpprestsdk] Clashing of cpp parameter names with local variables.
Created by: Jauler
Description
Some local variables declared in cpprestsdk api-source.mustache file are likely to clash with real parameter names in specs, for example, having spec:
......
"parameters": [
{
"uniqueItems": true,
"type": "string",
"description": "path to the resource",
"name": "path",
"in": "path",
"required": true
},
{
"uniqueItems": true,
"type": "string",
"description": "Path is the URL path to use for the current proxy request to pod.",
"name": "path",
"in": "query"
}
]
......
will generate function:
pplx::task<utility::string_t> CoreV1Api::connectCoreV1DeleteNamespacedPodProxy(utility::string_t name, utility::string_t _namespace, boost::optional<utility::string_t> path)
where parameter path
will clash with local variable path
:
utility::string_t path = utility::conversions::to_string_t("{{{path}}}");
in api source file.
openapi-generator version
3.1.2-SNAPSHOT
OpenAPI declaration file content or url
https://github.com/kubernetes/kubernetes/blob/release-1.10/api/openapi-spec/swagger.json
Command line used for generation
java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate --generator-name cpp-restsdk --output output -i https://raw.githubusercontent.com/kubernetes/kubernetes/release-1.10/api/openapi-spec/swagger.json
Suggest a fix/enhancement
- Parameter names in api-source.mustache could be renamed, e.g.
_<name>_
or_param_<name>_
or similar. - Variable names used in mustache files could be added to the list of reserved words, although I am not sure how easy it would be to keep this list up to date.