OpenAPITools / OpenAPITools/openapi-generator

[Java] Default values for string-type header parameters are generated with two sets of quotes

Open
#1,697 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

Completely identical to #540 just that this time the problem exits for header values.

openapi-generator version

3.3.4

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: Issue example
  version: 1.0.0
paths:
  /foo:
    get:
      parameters:
        - name: bar
          in: header
          required: false
          schema:
            type: string
            default: foobar
      responses:
        default:
          description: successful operation
Command line used for generation

java -jar openapi-generator-cli.jar generate -g spring -i openapi.yaml

Steps to reproduce
Related issues/PRs

#540

Suggest a fix

#708 <- migrate mustach fixes from queryParams.mustache to headerParams.mustache

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

Compare headerParams.mustache with the queryParams.mustache fix discussed in #540 and #708. Run the supplied OpenAPI Generator command with the example specification, then verify that the generated Spring Java code uses the string header default with only one set of quotes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.