From 4973f9674a670f5b3752e28abbdb0f0544e345af Mon Sep 17 00:00:00 2001 From: Robert Winkler Date: Mon, 4 Apr 2016 13:55:52 +0200 Subject: [PATCH] Added Gradle Plugin documentation --- src/docs/asciidoc/command_line_interface.adoc | 4 +++- src/docs/asciidoc/gradle_plugin.adoc | 23 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/docs/asciidoc/command_line_interface.adoc b/src/docs/asciidoc/command_line_interface.adoc index 707891ad..7568138d 100644 --- a/src/docs/asciidoc/command_line_interface.adoc +++ b/src/docs/asciidoc/command_line_interface.adoc @@ -62,9 +62,11 @@ You can convert a local Swagger file into a file as follows: [source, subs="attributes"] ---- -java -jar swagger2markup-cli-1.0.0-SNAPSHOT.jar convert -i /path/to/swagger_petstore.yaml -o /tmp/swagger.adoc +java -jar swagger2markup-cli-1.0.0-SNAPSHOT.jar convert -i /path/to/swagger_petstore.yaml -o /tmp/swagger ---- +NOTE: The input file must not have a file extension + It generates the Markup documents into the file `/tmp/swagger.adoc`. ==== Conversion of a remote Swagger file diff --git a/src/docs/asciidoc/gradle_plugin.adoc b/src/docs/asciidoc/gradle_plugin.adoc index 41a60a5d..17e6b670 100644 --- a/src/docs/asciidoc/gradle_plugin.adoc +++ b/src/docs/asciidoc/gradle_plugin.adoc @@ -20,15 +20,34 @@ buildscript { apply plugin: 'io.github.swagger2markup' ---- -The plugin adds a new task named ``convertSwagger2markup``. You can customize the task by configuring a Map of <>. +The plugin adds a new task named ``convertSwagger2markup``. You can run the task as follows: -[source,java] +`gradlew convertSwagger2markup` + +You can customize the task by configuring a Map of <>. + +[source,groovy] ---- convertSwagger2markup { + swaggerInput file("src/docs/asciidoc") + markupOutputFile file("${buildDir}/asciidoc") config = [(Swagger2MarkupProperties.MARKUP_LANGUAGE) : MarkupLanguage.ASCIIDOC.toString(), (Swagger2MarkupProperties.PATHS_GROUPED_BY) : GroupBy.TAGS.toString()] } + ---- +[options="header"] +.Gradle Plugin properties +|==== +| Name | Description | Type | Example | Default +| swaggerInput | The directory or file path to the Swagger specification | File | `file("src/docs/swagger_petstore.yaml")` (file) or `file("src/docs/swagger")` (directory) | ``file("src/docs/swagger")`` +| markupOutputDir | The directory where the output should be stored. | String | `new File("/tmp/asciidoc")` | ``file("$buildDir/asciidoc")`` +| markupOutputFile | The file (without extensions) where the output should be stored. | String | ``file("$buildDir/asciidoc/swagger")`` | +| config | The Swagger2Markup properties to configure the converter | Map | ['swagger2markup.markupLanguage' : 'ASCCIDOC'] | +|==== + + +