Skip to content

[BUG] String default wrong quotation #2358

@zwergy88

Description

@zwergy88

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

We use the maven plugin to create our models and interfaces in spring boot.
I wanted to set an optional header parameter to a default value used on the server side. However, I can not define the string correctly. The output is always masked incorrectly with extra double quotes.

openapi-generator version
org.openapitools openapi-generator-maven-plugin 3.3.4
OpenAPI declaration file content or url
components:
    parameters:
        XConsumerId:
            in: header
            name: x-consumer-id
            description: 'filled by gateway'
            required: false
            schema:
                type: string
                default: "c1" # tried also c1 and 'c1' 
            example: c1

Generated code
@ApiParam(value = "filled by gateway" , defaultValue=""c1"") @RequestHeader(value="x-consumer-id", required=false) String xConsumerId

"" of defaultValue is not correct

Command line used for generation

Execute maven plugin

Steps to reproduce
Related issues/PRs
Suggest a fix

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