Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2702
Closed
Open
Issue created Apr 19, 2019 by Administrator@rootContributor

[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.

Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking