Skip to content

[BUG][JAVA] Java string quotes incorrectly escaped in value strings #22629

Closed

Description

@zomborid

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

This:

paths:
  /endpoint:
    post:
      tags:
        - "My \"quoted\" api"

Generates:

...
tags = { "My "quoted" api" }
...

Other inputs with similar results:

  • My \"quoted\" api
  • 'My "quoted" api'
  • 'My \"quoted\" api'

Generated code:

  • @Tag(name="My "quoted" api")
  • @Operation(tags={ "My \"quoted\" api" })

Expected generated string: "My \"quoted\" api"

Description/comment strings are correctly escaped, and are not affected.

openapi-generator version

7.12.0, 7.13.0, 7.18.0 are affected.
7.12.0 works as expected does not include the example objects in the generated interface, and therefore did not cause issues.

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Example
  version: 0.1.0
paths:
  /endpoint:
    get:
      tags:
        - Example "quoted" ops
      summary: Summary
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
              examples:
                Example1:
                  value:
                    res: a "quoted" string
Generation Details

Stack: Maven, Spring Boot, openapi-generator-maven-plugin

Configuration:

<minimalUpdate>true</minimalUpdate>
<configOptions>
  <useSpringBoot3>true</useSpringBoot3>
  <oas3>true</oas3>
  <useSpringController>true</useSpringController>
  <useSpringfox>false</useSpringfox>
  <interfaceOnly>true</interfaceOnly>
</configOptions>
Steps to reproduce
Related issues/PRs
Suggest a fix

Activity

  1. added 2 commits that reference this issue on Jul 6, 2026
    ec924d3
    ba80810
  2. added a commit that references this issue on Jul 7, 2026
    93d7f80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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