Skip to content

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

@okarmazin

Description

@okarmazin

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • 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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions