Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline in Description Not Rendering As Multiline #1108

Closed
cjbarth opened this issue Nov 10, 2016 · 13 comments
Closed

Multiline in Description Not Rendering As Multiline #1108

cjbarth opened this issue Nov 10, 2016 · 13 comments

Comments

@cjbarth
Copy link

cjbarth commented Nov 10, 2016

Swagger File

swagger: '2.0'
info:
  title: Sample
  version: "1.0.0"
produces:
  - application/json
paths:
  /range:
    get:
      summary: Gets Random Range
      description: |
        This is an example of a working multiline.
        
        You can see that this is on a separate line.
        
        Which is very much unlike what is seen below with the description of the RangeObject.
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/RangeObject'
definitions:
  RangeObject:
    type: object
    description: |
      Example implementation specification:

      {start}-{end}    Start at {start}, end at {end}
      
      {start}          Start at {start}, end at the end of the current paragraph
    properties:
      start:
        type: integer
      end:
        type: integer
    required:
      - start
  • Version: Swagger Editor v2.10.3
  • Browser/OS: Chrome/macOS

Issue
The description for the RangeObject isn't showing with multiple lines. All the lines are concatenated together with a space, which makes it very hard to read. The multiline syntax is working elsewhere.

@webron
Copy link
Contributor

webron commented Nov 10, 2016

Verified the issue exists.

@aleksei-saharov
Copy link

@webron This issue still exists.
Same effect occurs for all types of definition. Object, string, integer, enum,...

@webron
Copy link
Contributor

webron commented Dec 7, 2016

@aleksei-saharov - well, in our defense, we never said it was fixed.

@aleksei-saharov
Copy link

@webron I agree, but I try to tell that it take place for all definition types. Not only type: object
I faced with it today.

@webron
Copy link
Contributor

webron commented Dec 7, 2016

Got it, thanks.

@aleksei-saharov
Copy link

@webron When can we expect it to get fixed?

@webron
Copy link
Contributor

webron commented Jan 11, 2017

We're working on a major update and that's where our focus lies, so unlikely before then. I don't have an ETA for the update though.

@webron
Copy link
Contributor

webron commented Jun 9, 2017

This should no longer be an issue with the new editor.

@webron webron closed this as completed Jun 9, 2017
@aleksei-saharov
Copy link

@webron but it is!
Try to check @cjbarth example
I have checked it with editor.swagger.io and got following result
image

Did you test it before closing?

@webron
Copy link
Contributor

webron commented Jun 9, 2017

@aleksei-saharov I did not. I had to go through ~300 tickets, I don't have the capacity to test every single one of them. Sometimes, tickets were wrongfully closed. However, this issue is covered by swagger-api/swagger-ui#2745. I believe there might be another ticket in the UI, but I can't find it right now.

@neclimdul
Copy link

I just ran into this so I can confirm it exist but its a bit complicated. Since its at the top of the google results I'll provide a little more information for future people https://xkcd.com/979/

Because this is so specific it might not even be a bug but here's the details:

  1. Its in swagger-ui not the editor specifically because just pointing the ui to a spec triggers this.
  2. It only happens if there are no markdown control characters in the description.
  3. It only seems to be the path description? Models like the one in the example seem to work fine now.

Examples:

Correct rendering

Path spec

description: |
  # Header
  Line 1

  Line 2

Output:

Header

Line 1

Line 2

"Incorrect" rendering

Path spec:

description:
  Line 1

  Line 2

Output:

Line 1 Line 2

@tvprasad
Copy link

tvprasad commented Dec 6, 2019

To start a line just add # in front of the it.

/pet/findByTags:
get:
tags:
- pet
summary: Add a new pet
description: |
### Muliple tags can be provided with comma separated strings.
### test line.
#### line 3

@fprotimaru
Copy link

fprotimaru commented Oct 3, 2021

this worked for me. Just try this (openapi 3):

/pet/findByTags:
get:
tags:
- pet
summary: Add a new pet
description: |
  Muliple tags can be provided with comma separated strings. \
  test line. \
  line 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants