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

Set endpoint description in Markdown #560

Merged
merged 1 commit into from
Jan 9, 2017

Conversation

frodrigo
Copy link
Contributor

@frodrigo frodrigo commented Jan 4, 2017

Set endpoint description in Markdown #559
Map clearly Grape desc/detail to Swagger summary/description

@frodrigo frodrigo force-pushed the summary-description branch from 6f7f76b to a41387c Compare January 4, 2017 18:03
Copy link
Member

@LeFnord LeFnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for sorting out the description vs. summary stuff
and revert the other two changes, there a Markdown adapter is given, this implies, given Markdown should be transformed into HTML

@@ -104,7 +106,7 @@ def app
specify do
expect(subject['paths']['/use_gfm_detail']['get']).to include('description')
expect(subject['paths']['/use_gfm_detail']['get']['description']).to eql(
"<h1 id=\"this-returns-something\">This returns something</h1>\n<p># Burgers in Heaven</p>\n\n<blockquote>\n <p>A burger doesnt come for free</p>\n</blockquote>\n\n<p>If you want to reserve a burger in heaven, you have to do<br />\nsome crazy stuff on earth.</p>\n\n<pre><code>def do_good\nputs 'help people'\nend\n</code></pre>\n\n<ul>\n <li><em>Will go to Heaven:</em> Probably</li>\n <li><em>Will go to Hell:</em> Probably not</li>\n</ul>"
"> A burger doesn't come for free\n\nIf you want to reserve a burger in heaven, you have to do\nsome crazy stuff on earth.\n\n```\ndef do_good\nputs 'help people'\nend\n```\n\n* _Will go to Heaven:_ Probably\n* _Will go to Hell:_ Probably not\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -142,7 +145,7 @@ def app
specify do
expect(subject['paths']['/use_gfm_rc_detail']['get']).to include('description')
expect(subject['paths']['/use_gfm_rc_detail']['get']['description']).to eql(
"<h1>This returns something</h1>\n\n<p># Burgers in Heaven</p>\n\n<blockquote>\n<p>A burger doesn&#39;t come for free</p>\n</blockquote>\n\n<p>If you want to reserve a burger in heaven, you have to do\nsome crazy stuff on earth.</p>\n<pre class=\"highlight plaintext\"><code>def do_good\nputs 'help people'\nend\n</code></pre>\n<ul>\n<li><em>Will go to Heaven:</em> Probably</li>\n<li><em>Will go to Hell:</em> Probably not</li>\n</ul>"
"> A burger doesn't come for free\n\nIf you want to reserve a burger in heaven, you have to do\nsome crazy stuff on earth.\n\n```\ndef do_good\nputs 'help people'\nend\n```\n\n* _Will go to Heaven:_ Probably\n* _Will go to Hell:_ Probably not\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frodrigo frodrigo force-pushed the summary-description branch from a41387c to 1ff8431 Compare January 5, 2017 09:47
@frodrigo
Copy link
Contributor Author

frodrigo commented Jan 5, 2017

I done what you ask.
But I'm still puzzled by two things:

  • swagger 2 spec ask for Markdown, not HTML,
  • the add_swagger_documentation {info: description: ''} is not processed by the Markdown renderer and throw as is.

@frodrigo frodrigo force-pushed the summary-description branch 2 times, most recently from bdcc25c to b8870c3 Compare January 5, 2017 10:38
@LeFnord
Copy link
Member

LeFnord commented Jan 5, 2017

thanks @frodrigo for adaptions … actual, the summary can be prtovided as plain text, as md, and as html rendered md, if the specific option was set

yeap, it seems that the spec accept plain text and markdown, but not HTML, as you said, what did you think, should the markdown render stuff moved out?

@frodrigo
Copy link
Contributor Author

frodrigo commented Jan 6, 2017

I think for swagger 2 spec the HTML is no more required. And moreover tools using the spec expect markdown and convert it (e.g. swgger ui or swagger code gen deface the output, because they recive HTML and trait it as markdown).

@LeFnord
Copy link
Member

LeFnord commented Jan 8, 2017

would you remove all the markdown stuff then in this PR, or did you prefer to do it in a separate one?

@LeFnord
Copy link
Member

LeFnord commented Jan 9, 2017

@frodrigo … want to mörge it, the moving of Markdown out could be done in a separate PR, ok?

@LeFnord LeFnord merged commit 8197f8f into ruby-grape:master Jan 9, 2017
@LeFnord LeFnord mentioned this pull request Jan 11, 2017
LeFnord pushed a commit to LeFnord/grape-swagger that referenced this pull request Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants