Swagger-editor: Multiline in Description Not Rendering As Multiline

Created on 10 Nov 2016  路  12Comments  路  Source: swagger-api/swagger-editor


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.

bug

Most helpful comment

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

All 12 comments

Verified the issue exists.

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

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

@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.

Got it, thanks.

@webron When can we expect it to get fixed?

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.

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

@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?

@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 https://github.com/swagger-api/swagger-ui/issues/2745. I believe there might be another ticket in the UI, but I can't find it right now.

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

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

Was this page helpful?
0 / 5 - 0 ratings