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
  • #11304
Closed
Open
Issue created Jan 13, 2022 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][KOTLIN] Generated code contains "`" instead of backtick, when using parameters with reserved kotlin names

Created by: knutjda

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

When generating kotlin code using 'kotlin' generator, and one of the parameters is in reserved kotlin names, the generated code contains backtick "`" encoded as HTML entity: ` in the Api-class:

fun test(`value`: kotlin.String) : Unit { ... }

fun testWithHttpInfo(&#x60;value&#x60;: kotlin.String) : ApiResponse<Unit?> { ... }

fun testRequestConfig(&#x60;value&#x60;: kotlin.String) : RequestConfig<Unit> { ... }

And that will not compile very well.

openapi-generator version

5.3.1

OpenAPI declaration file content or url
openapi: 3.0.3
info:
  title: Kotlin Issue
  version: "1.0"

servers:
  - url: "http://localhost"

paths:
  /test/{value}:
    post:
      summary: test
      operationId: test
      parameters:
        - name: value
          in: path
          required: true
          schema:
            type: string
          example: something
      responses:
        '200':
          description: OK
Generation Details
openapi-generator-cli generate -i temp.yml -g kotlin
Steps to reproduce

generate code and open DefaultApi.kt

Related issues/PRs

This is related to #11148 (closed)

Suggest a fix
Assignee
Assign to
Time tracking