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 description with json #82

Closed
pedro-teixeira opened this issue Aug 19, 2016 · 8 comments
Closed

Multiline description with json #82

pedro-teixeira opened this issue Aug 19, 2016 · 8 comments
Assignees

Comments

@pedro-teixeira
Copy link

I'm adding descriptions with \n but they are not interpreted.

Example:

{
  "basePath": "/v1",
  "consumes": [
    "application/json"
  ],
  "host": "test.com",
  "info": {
    "description": "Test\nTest",
    "title": "Test",
    "version": "1"
  }
}

Am I doing something wrong or is this really an issue?

@RomanHotsiy RomanHotsiy self-assigned this Aug 20, 2016
@RomanHotsiy
Copy link
Member

@pedro-teixeira this is an issue.
Will try to include this fix in the next release.

@pedro-teixeira
Copy link
Author

Thanks @RomanGotsiy

@pedro-teixeira
Copy link
Author

@RomanGotsiy thank you for the quick fix! I saw you created a new release (v1.1.1) but I think the GitHub pages release is missing.

@pedro-teixeira
Copy link
Author

Now it's there, it seems to be working fine! Thank you again.

@RomanHotsiy
Copy link
Member

@pedro-teixeira yes, GitHub pages release is deployed by CI so it requires some time

@RomanHotsiy
Copy link
Member

@pedro-teixeira I'm sorry but I have to revert this fix.
According to the Swagger spec description field is GitHub Flavored Markdown.

So when you logged this issue I had tried adding a new line here in comments to this issue and it worked: line break was added. So that's why I considered this to be a bug. But now I've checked the same thing on README file and this doesn't work there: a new line is not line break there. I have also checked how SwaggerUI handles this and it doesn't treat newlines as page breaks. As most of the users test their specs on SwaggerUI I don't want to introduce incompatibility here.

After I revert this fix you can achieve what you need by the following (according to the markdown spec)

  1. add two new lines: "description": "Test\n\nTest"... (it will create a new paragraph)
  2. end a line with two or more spaces: "description": "Test \nTest"..
  3. add HTML hard break: "description": "Test<br>Test"... (HTML tags are supported by GFM)

Let me know if you are ok with this.

@pedro-teixeira
Copy link
Author

@RomanGotsiy works for me! Thank you!

@christopher-bonitz
Copy link

christopher-bonitz commented Jul 22, 2021

I think I found this bug in another element, can I request to reopen this issue? the fix is most likely very similar.
I'm finding missing new lines on model descriptions/summery

"Horse": {
"terminalId": {
"type": "string",
"description": "Identification bla bla bla. \r\nIt must be possible to bla bla bla.\r\nThis information is only required for bla bla bla",
"nullable": true
}
}

I have been able to get around this by simply adding <br /> to the xml summaries that are generating the model descriptions.
Not a terrible way to do it, but a shame since newlines are supported in the output pipeline

Thanks a lot

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

3 participants