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

broken new Line parsing YAML #5475

Closed
HenriPro opened this issue Jul 17, 2019 · 1 comment · Fixed by #5520
Closed

broken new Line parsing YAML #5475

HenriPro opened this issue Jul 17, 2019 · 1 comment · Fixed by #5520

Comments

@HenriPro
Copy link

HenriPro commented Jul 17, 2019

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome, safari, firefox
  • Method of installation: dist bundle, swagger.io demo
  • Swagger-UI version: 3.18.3
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

Screen Shot 2019-07-17 at 4 22 50 PM

Example Swagger/OpenAPI definition:

swagger: '2.0'
info:
  description: broken line break
  version: 1.0
basePath: /test
schemes:
  - https
securityDefinitions:
  ApiKeyAuth:
    type: apiKey
    in: header
    name: apikey
paths:
  /test/brokennewline:
    get:
      tags:
        - Broken New Line
      summary: Broken new Line example
      description: Broken new line YAML example
      operationId: BrokenNewLine
      consumes:
        - application/json
      produces:
        - application/json
      security:
        - ApiKeyAuth: []
      parameters:
        - name: X-applicationNameA
          description: |
            This works note the dash on the line bellow
            e.g. CXMOBILE-56789
          in: header
          required: true
          type: string 
        - name: X-applicationNameB
          description: | 
            This should be also be two lines
            e.g. CXMOBILE156789
          in: header
          required: true
          type: string           

Describe the bug you're encountering

Fails to render new lines for parameter description as expected.
Both parameter descriptions should be two lines. Only the first one is rendered with a

The second without the dash does not get split into a new line. Adding a character like a comma or dash does result in correct render.

To reproduce...

Steps to reproduce the behavior:
Load yaml file

Expected behavior

All new lines in parameter description to be rendered as separate lines in html

@shockey
Copy link
Contributor

shockey commented Jul 18, 2019

Might be best to just remove our plaintext optimization to solve this:

if(isPlainText(source)) {
// If the source text is not Markdown,
// let's save some time and just render it.
return <div className="markdown">
{source}
</div>

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

Successfully merging a pull request may close this issue.

2 participants