OpenAPITools / OpenAPITools/openapi-generator

[REQ][HTML] YAML multiline string formatting of descriptions should be translated to HTML

Open
#1,716 0 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

When using the literal style indicator (|) in a block scalar for a description, the formatting is ignored when inserted into HTML.

paths:
  /employees/{id}:
    get:
      description: |
        First line
        Second line

But right now this come out as First line Second line in the rendered HTML.

Describe the solution you'd like

When the literal style indicator is specified in the YAML, a <br> tag should be inserted at each newline when generating the HTML.

Additional context

Inserting <br> tags is how the Swagger UI does this and the formatting works great there.
Here's a good reference link on YAML multiline syntax.

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 at the HTML generation path for OpenAPI descriptions and reproduce the issue with the YAML literal block example in the report. Compare the generated output with Swagger UI's newline behavior; the work is done when each newline in a literal-style description is represented by a
tag in the rendered HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, yaml
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.