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
  • #13369
Closed
Open
Issue created Sep 07, 2022 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Kotlin] Path parameter values with slashes are not encoded correctly

Created by: segevfiner

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

If you try to pass a path parameter value that has slashes in it, it won't be escaped correctly, leading to a 404.

openapi-generator version

5.4.0

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Test
  version: 0.1.0
paths:
  /repos/{repoPath}/documents:
    get:
      parameters:
        - schema:
            type: string
          in: path
          name: repoPath
          required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties: {}
Generation Details
{
  "$schema": "../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "5.4.0",
    "generators": {
      "kotlin": {
        "generatorName": "kotlin",
        "output": "kotlin",
        "inputSpec": "openapi.yaml",
        "additionalProperties": {
          "groupId": "test",
          "packageName": "test",
          "artifactVersion": "0.1.0"
        }
      }
    }
  }
}
Steps to reproduce
  1. Use the generated client and pass a repoPath that has a slash in it.
Related issues/PRs
Suggest a fix

The problem is using addPathSegments which splits on / and doesn't escape it in the passed string. We will have to handle escaping by ourselves and use addEncodedPathSegments or store the path as a list of String to pass to multiple calls to addPathSegment.

Assignee
Assign to
Time tracking