OpenAPITools / OpenAPITools/openapi-generator
[BUG][Go] Multiline info.description is squished to a single line in the top of file comments
Nobody has claimed this yet.
- 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 (example)?
- 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
A multiline description that renders fine in swagger-ui is generated to the top every single file and squished to a single line when generated in the go generator. I expected it to preserve newlines. Also note that Go doc comments are not markdown, a truly complete solution would need to transform the CommonMark to the minimal syntax supported by Go to avoid unexpected rendering issues. - Not a godoc comment, just a top of file comment, not rendered by godoc.
openapi-generator version
v4.2.6 and feeeedd34d4f3a83501825d025502874f669a6bc (Docker image openapitools/openapi-generator-cli@sha256:4396b434b09f03c9cb9a20ff39f1406f13a9b224a25e77a41679cd993eb5c968)
OpenAPI declaration file content or url
openapi: '3.0.3'
info:
title: Multiline Description
version: 0.1.0
description: |
Paragraph #1
Paragraph #2
Paragraph #3
1. Some
2. List
3. Of
4. `Things`
paths: {}
Generation Details
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli@sha256:4396b434b09f03c9cb9a20ff39f1406f13a9b224a25e77a41679cd993eb5c968 generate \
-i /local/openapi.yaml \
-g go \
-o /local/out/go
Steps to reproduce
- Generate the provided schema for go.
- Look at the comment at the top of the generated go files.
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by generating the provided OpenAPI YAML with the Go generator using the Docker command in the issue, then inspect the top comments in the generated Go files. Trace how info.description is rendered and verify that paragraph breaks and list line breaks are preserved instead of being squished into one line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100