OpenAPITools / OpenAPITools/openapi-generator

[BUG] [JAVA] [Spring Boot] [Maven Plugin] illegal character '/' for quote

Open
#21,835 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

When generating Spring Boot Controllers for the Camunda 7 openapi.yaml the generation fails with illegal character: '\' starting from openapi-generator-maven-plugin version 7.13.0

I used the following pom.xml from https://mvnrepository.com/artifact/org.camunda.bpm/camunda-engine-rest-openapi/7.23.0

As far as i can see it is caused by the strange but valid openapi example response content on line 537 of the API.

Image

EDIT: i just saw, that also an XML in the example content causes problems (line 3029 of openapi.yml):

  /decision-definition/{id}/xml:
    get:
      description: Retrieves the DMN XML of a decision definition.
      operationId: getDecisionDefinitionDmnXmlById
      parameters:
      - description: The id of the decision definition.
        explode: false
        in: path
        name: id
        required: true
        schema:
          type: string
        style: simple
      responses:
        "200":
          content:
            application/json:
              examples:
                example-1:
                  description: Response for GET `/decision-definition/aDecisionDefinitionId/xml`
                  summary: Status 200 response
                  value:
                    id: aDecisionDefinitionId
                    dmnXml: |-
                      <?xml version="1.0" encoding="UTF-8"?>
                                                          <definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd"
                                                                       id="definitions"
                                                                       name="camunda"
                                                                       namespace="http://camunda.org/schema/1.0/dmn">
                                                            <decision id="testDecision" name="decision">
                                                              <decisionTable id="table">
                                                                <output id="result" name="result" >
                                                                </output>
                                                                <rule id="rule">
                                                                  <outputEntry id="output1">
                                                                    <text>"not okay"</text>
                                                                  </outputEntry>
                                                                </rule>
                                                              </decisionTable>
                                                            </decision>
                                                          </definitions>
              schema:
                $ref: '#/components/schemas/DecisionDefinitionDiagramDto'
          description: Request successful.`

I guess the first issue with the href": is a bug in the camunda API as well and i created a bug report there: https://github.com/camunda/camunda-bpm-platform/issues/5383.

Nevertheless it probably not should break the code generation.

openapi-generator version

It works until 7.12.0.
It fails with 7.13.0 until at least 7.15.0

OpenAPI declaration file content or url

openapi.yaml

Generation Details

see below

Steps to reproduce

pom.xml
openapi.yaml

Related issues/PRs

none

Suggest a fix

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached pom.xml and openapi.yaml, and reproduce generation with openapi-generator-maven-plugin 7.12.0 and 7.13.0 or later. Trace the failure for the href and XML example content; done means Spring Boot controller generation succeeds for the supplied OpenAPI declaration without illegal-character errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.