Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Winkler committed May 2, 2016
2 parents 36e0a26 + ff91a4f commit ddd679a
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 397 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@
import java.util.Optional;

/**
* Dynamically search for markup files in {@code contentPath} to append in Definitions, with the format :<br>
* - {@code document-before-*.<markup.ext>} : import before Definitions document with levelOffset = 0<br>
* - {@code document-after-*.<markup.ext>} : import after Definitions document with levelOffset = 0<br>
* - {@code document-begin-*.<markup.ext>} : import just after Definitions document main title with levelOffset = 1<br>
* - {@code document-end-*.<markup.ext>} : import at the end of Definitions document with levelOffset = 1<br>
* - {@code definition-begin-*.<markup.ext>} : import just after each definition title with levelOffset = 2<br>
* - {@code definition-end-*.<markup.ext>} : import at the end of each definition with levelOffset = 2<br>
* Dynamically search for markup files in {@code contentPath} to append in Definitions document.
* <p>
* Markup files are appended in the natural order of their names, for each category.
*/
Expand Down Expand Up @@ -120,12 +114,12 @@ public void apply(Context context) {
case DOCUMENT_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
break;
case DEFINITION_BEFORE:
case DEFINITION_BEGIN:
case DEFINITION_END:
case DEFINITION_AFTER:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(Paths.get(IOUtils.normalizeName(context.getDefinitionName().get()))), contentPrefix(position), levelOffset(context));
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", position));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
import java.util.Optional;

/**
* Dynamically search for markup files in {@code contentPath} to append to Overview, with the format :<br>
* - {@code document-before-*.<markup.ext>} : import before Overview document with levelOffset = 0<br>
* - {@code document-after-*.<markup.ext>} : import after Overview document with levelOffset = 0<br>
* - {@code document-begin-*.<markup.ext>} : import just after Overview document main title with levelOffset = 1<br>
* - {@code document-end-*.<markup.ext>} : import at the end of Overview document with levelOffset = 1<br>
* Dynamically search for markup files in {@code contentPath} to append to Overview document.
* <p>
* Markup files are appended in the natural order of their names, for each category.
*/
Expand Down Expand Up @@ -117,8 +113,6 @@ public void apply(Context context) {
case DOCUMENT_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", position));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@
import java.util.Optional;

/**
* Dynamically search for markup files in {@code contentPath} to append to Operations, with the format :<br>
* - {@code document-before-*.<markup.ext>} : import before Paths document with levelOffset = 0<br>
* - {@code document-after-*.<markup.ext>} : import after Paths document with levelOffset = 0<br>
* - {@code document-begin-*.<markup.ext>} : import just after Paths document main title with levelOffset = 1<br>
* - {@code document-end-*.<markup.ext>} : import at the end of Paths document with levelOffset = 1<br>
* - {@code operation-begin-*.<markup.ext>} : import just after each operation title with levelOffset = 2(GroupBy.AS_IS) | 3(GroupBy.TAGS)<br>
* - {@code operation-end-*.<markup.ext>} : import at the end of each operation with levelOffset = 2(GroupBy.AS_IS) | 3(GroupBy.TAGS)<br>
* Dynamically search for markup files in {@code contentPath} to append to Paths document.
* <p>
* Markup files are appended in the natural order of their names, for each category.
*/
Expand Down Expand Up @@ -120,12 +114,28 @@ public void apply(Context context) {
case DOCUMENT_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
break;
case OPERATION_BEFORE:
case OPERATION_BEGIN:
case OPERATION_END:
case OPERATION_AFTER:
case OPERATION_DESCRIPTION_BEFORE:
case OPERATION_DESCRIPTION_AFTER:
case OPERATION_PARAMETERS_BEFORE:
case OPERATION_PARAMETERS_AFTER:
case OPERATION_RESPONSES_BEFORE:
case OPERATION_RESPONSES_AFTER:
case OPERATION_SECURITY_BEFORE:
case OPERATION_SECURITY_AFTER:
case OPERATION_DESCRIPTION_BEGIN:
case OPERATION_DESCRIPTION_END:
case OPERATION_PARAMETERS_BEGIN:
case OPERATION_PARAMETERS_END:
case OPERATION_RESPONSES_BEGIN:
case OPERATION_RESPONSES_END:
case OPERATION_SECURITY_BEGIN:
case OPERATION_SECURITY_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getOperation().get().getId())), contentPrefix(position), levelOffset(context));
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", position));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@
import java.util.Optional;

/**
* Dynamically search for markup files in {@code contentPath} to append to Overview, with the format :<br>
* - {@code document-before-*.<markup.ext>} : import before Overview document with levelOffset = 0<br>
* - {@code document-after-*.<markup.ext>} : import after Overview document with levelOffset = 0<br>
* - {@code document-begin-*.<markup.ext>} : import just after Overview document main title with levelOffset = 1<br>
* - {@code document-end-*.<markup.ext>} : import at the end of Overview document with levelOffset = 1<br>
* - {@code definition-begin-*.<markup.ext>} : import just after each definition title with levelOffset = 2<br>
* - {@code definition-end-*.<markup.ext>} : import at the end of each definition with levelOffset = 2<br>
* Dynamically search for markup files in {@code contentPath} to append to Security document.
* <p>
* Markup files are appended in the natural order of their names, for each category.
*/
Expand Down Expand Up @@ -120,12 +114,12 @@ public void apply(Context context) {
case DOCUMENT_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
break;
case DEFINITION_BEGIN:
case DEFINITION_END:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getDefinitionName().get())), contentPrefix(position), levelOffset(context));
case SECURITY_SCHEME_BEFORE:
case SECURITY_SCHEME_BEGIN:
case SECURITY_SCHEME_END:
case SECURITY_SCHEME_AFTER:
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getSecuritySchemeName().get())), contentPrefix(position), levelOffset(context));
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", position));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class DynamicDocumentExtensionTest {
public void testSwagger2AsciiDocExtensions() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(DynamicDocumentExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
Path outputDirectory = Paths.get("build/test/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory.toFile());

//When
Expand Down Expand Up @@ -70,7 +70,7 @@ public void testSwagger2AsciiDocExtensions() throws IOException, URISyntaxExcept
public void testSwagger2MarkdownExtensions() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(DynamicDocumentExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/docs/markdown/generated");
Path outputDirectory = Paths.get("build/test/markdown/generated");
FileUtils.deleteQuietly(outputDirectory.toFile());

//When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,11 @@ public void apply(Context context) {

if (schemaBaseUri != null) {
switch (context.getPosition()) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case DEFINITION_BEGIN:
break;
case DEFINITION_END:
for (SchemaMetadata schema : DEFAULT_SCHEMAS) {
schemaSection(context, schema, levelOffset(context));
}
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.getPosition()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class SchemaExtensionTest {
public void testSwagger2AsciiDocSchemaExtension() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(SchemaExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
Path outputDirectory = Paths.get("build/test/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory.toFile());

//When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void setUp(){
public void testSwagger2AsciiDocConversionWithSpringRestDocsExtension() throws IOException, URISyntaxException {
//Given
Path file = Paths.get(SpringRestDocsExtensionsTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
Path outputDirectory = Paths.get("build/docs/asciidoc/spring_rest_docs");
Path outputDirectory = Paths.get("build/test/asciidoc/spring_rest_docs");
FileUtils.deleteQuietly(outputDirectory.toFile());

//When
Expand Down
Loading

0 comments on commit ddd679a

Please sign in to comment.