OpenAPITools / OpenAPITools/openapi-generator

[BUG][HTML] Parameter names garbled in generated documentation, '-' is replaced with 'Minus'

Open
#11,292 0 comments 0 reactions 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

Description

Parameter names are garbled in html output, - is replaced with Minus in parameter names.

openapi-generator version

5.3.1

OpenAPI declaration file content or url

See modified petstore.yaml gist

Generation Details / Steps to Reproduce
curl https://gist.githubusercontent.com/lpar/4af360f8a2c94d2a31c6e12062f2812c/raw/1a11fd965c099669677f3b79c4eecbb73e4f34b8/petstore2.yaml > petstore2.yaml
mkdir petstore
npx openapi-generator-cli version-manager set 5.3.1
npx openapi-generator-cli generate -i petstore2.yaml -g html -o petstore
grep Minus petstore/index.html
Related issues/PRs

Somewhat related to #6465, which is a similar problem in html2 affecting HTTP headers.

Suggest a fix

I'm guessing that the templates for html are using a variable which contains a parameter name that has been sanitized for code generation. Presumably html2 uses the correct variable name (at least for parameters), as it doesn't have the same bug.

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 by reproducing the issue with the linked petstore2.yaml and the documented html generation commands, then inspect the html templates that render parameter names. Compare the parameter variable used by html with the behavior of html2, as suggested in the report. Done means generated HTML preserves '-' in parameter names instead of rendering it as 'Minus'; verify with grep on petstore/index.html.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, java, openapi
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.