[BUG] '/' prepended to paths that don't start with '/'
Created by: dkliban
Bug Report Checklist
Description
I am currently trying to switch from swagger-codegen-cli to openapi-generator-cli, but I ran into a problem with the generated Python client code. I do not experience the same behavior when generating client code using swagger-codegen-cli.
/
is prepended to paths that don't start with a /
. This is a problem because my OpenAPI schema includes paths that consist of a single path parameter. e.g.: {artifact_href}
. In the generated code this is turned into /{artifact_href}
. Since the path parameter being passed in looks like /pulp/api/v3/artifacts/1234/
, the client makes a request to http://localhost//pulp/api/v3/artifacts/1234/
and the server is unable to service the request. Notice the //
in the URL.
This problem is not unique to the Python generator. I am seeing the exact same behavior for Ruby also.
openapi-generator version
The latest docker image of openapi-generator-cli.
OpenAPI declaration file content or url
https://docs.pulpproject.org/en/3.0/nightly/api.json
Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
-i /local/api.json \
-g python \
-o /local/pulpcore-client \
-DpackageName=pulpcore.client.pulpcore \
-DprojectName=pulpcore-client \
-DpackageVersion=3.0.0rc1 \
--skip-validate-spec
Steps to reproduce
Generate a Python client with the schema from above. Observe that the client that is generated has
return self.api_client.call_api(
'/{artifact_href}', 'GET',
while the path for this operation in the OpenAPI schema was simply {artifact_href}
. I would expect the generator to not modify the path value.