Updated documentation
This commit is contained in:
23
README.adoc
23
README.adoc
@@ -62,16 +62,19 @@ public class Swagger2MarkupTest {
|
|||||||
public void convertSwaggerToMarkup() {
|
public void convertSwaggerToMarkup() {
|
||||||
//Remote
|
//Remote
|
||||||
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").
|
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").
|
||||||
toAsciiDoc("src/docs/asciidoc/example.adoc");
|
withMarkupLanguage(MarkupLanguage.MARKDOWN).
|
||||||
|
withExamples("docs/generated").withSchemas("docs/schemas").build()
|
||||||
|
.intoFolder("src/docs/markdown");
|
||||||
|
|
||||||
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").
|
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").
|
||||||
toMarkdown("src/docs/markdown/example.md");
|
withExamples("docs").withSchemas("docs/schemas").build()
|
||||||
|
.intoFolder("src/docs/asciidoc");
|
||||||
|
|
||||||
//Local
|
//Local
|
||||||
File file = new File(Swagger2MarkupTest.class.getResource("/json/swagger.json").getFile());
|
File file = new File(Swagger2MarkupTest.class.getResource("/json/swagger.json").getFile());
|
||||||
Swagger2MarkupConverter.from(file.getAbsolutePath()).toAsciiDoc("src/docs/asciidoc/swagger.adoc")
|
Swagger2MarkupConverter.from(file.getAbsolutePath()).build()
|
||||||
|
.intoFolder("src/docs/asciidoc");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
@@ -132,14 +135,12 @@ image::images/mkdocs_html.PNG[mkdocs_html]
|
|||||||
image::images/asciidoc_pdf.PNG[asciidoc_pdf]
|
image::images/asciidoc_pdf.PNG[asciidoc_pdf]
|
||||||
|
|
||||||
== Document Builder
|
== Document Builder
|
||||||
The converter allows to build an AsciiDoc or Markdown document via the Builder pattern:
|
The Swagger2Markup library allows to build an AsciiDoc or Markdown document via the Builder pattern:
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
String asciiDoc = new AsciiDocBuilder().documentTitle("Title")
|
DocumentBuilder builder = DocumentBuilders.documentBuilder(MarkupLanguage.ASCIIDOC);
|
||||||
.sectionTitleLevel1("Section1").paragraph("Text text")
|
builder.documentTitle("Test title").textLine("Text line").writeToFile("/tmp", "test.adoc", StandardCharsets.UTF_8);
|
||||||
.sectionTitleLevel2("Code examples").listing("Code example").toString();
|
|
||||||
|
|
||||||
String markdown = new MarkdownBuilder().documentTitle("Title")
|
DocumentBuilder builder = DocumentBuilders.documentBuilder(MarkupLanguage.MARKDOWN);
|
||||||
.sectionTitleLevel1("Section1").paragraph("Text text")
|
builder.documentTitle("Test title").textLine("Text line").writeToFile("/tmp", "test.adoc", StandardCharsets.UTF_8);
|
||||||
.sectionTitleLevel2("Code examples").listing("Code example").toString();
|
|
||||||
----
|
----
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
= Release Notes
|
= Release Notes
|
||||||
|
|
||||||
== Version 0.1.0
|
== Version 0.1.0
|
||||||
* Initial version with support for AsciiDoc and Markdown
|
* Initial version with support for AsciiDoc and Markdown
|
||||||
|
|
||||||
|
== Version 0.2.0
|
||||||
|
* This version is not downward compatible. This version supports includes of example files and JSON/XML Schema files. See documentation.
|
||||||
@@ -13,7 +13,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
description = 'swagger2markup Build'
|
description = 'swagger2markup Build'
|
||||||
version = '0.2.0'
|
version = '0.2.1'
|
||||||
group = 'io.github.robwin'
|
group = 'io.github.robwin'
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public class PathsDocument extends MarkupDocument {
|
|||||||
if(examplesEnabled){
|
if(examplesEnabled){
|
||||||
String summary = operation.getSummary();
|
String summary = operation.getSummary();
|
||||||
if(StringUtils.isNotBlank(summary)) {
|
if(StringUtils.isNotBlank(summary)) {
|
||||||
String exampleFolder = summary.replace(" ", "_").toLowerCase();
|
String exampleFolder = summary.replace(".", "").replace(" ", "_").toLowerCase();
|
||||||
example(EXAMPLE_REQUEST, exampleFolder, REQUEST_EXAMPLE_FILE_NAME);
|
example(EXAMPLE_REQUEST, exampleFolder, REQUEST_EXAMPLE_FILE_NAME);
|
||||||
example(EXAMPLE_RESPONSE, exampleFolder, RESPONSE_EXAMPLE_FILE_NAME);
|
example(EXAMPLE_RESPONSE, exampleFolder, RESPONSE_EXAMPLE_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user