openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][kotlin-client] ALL: Default enum values of operation params can get html-escaped

Open okarmazin opened this issue 2 months ago • 0 comments

Bug Report Checklist

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

Operation parameter defaults for enums don't get passed through as raw values.

Therefore, when a reserved Kotlin keyword is set as the default value of that parameter, Mustache will html-escape the backticks, generating invalid code.

This is true for all clients.

openapi-generator version

master

OpenAPI declaration file content or url
...
 "paths": {
    "/documents": {
      "get": {
        "operationId": "document-download",
        "parameters": [
          {
            "name": "disposition",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "inline",
              "enum": [
                "attachment",
                "inline"
              ]
            }
          }
        ]
      }
...  

generates

fun documentDownload(disposition: DispositionDocumentDownload? = DispositionDocumentDownload.`inline`) : java.io.File

okarmazin avatar Dec 07 '25 17:12 okarmazin