Skip to content

Commit ddd679a

Browse files
author
Robert Winkler
committed
Merge remote-tracking branch 'origin/master'
2 parents 36e0a26 + ff91a4f commit ddd679a

File tree

9 files changed

+205
-397
lines changed

9 files changed

+205
-397
lines changed

swagger2markup-import-files-ext/src/main/java/io/github/swagger2markup/extensions/DynamicDefinitionsDocumentExtension.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@
3131
import java.util.Optional;
3232

3333
/**
34-
* Dynamically search for markup files in {@code contentPath} to append in Definitions, with the format :<br>
35-
* - {@code document-before-*.<markup.ext>} : import before Definitions document with levelOffset = 0<br>
36-
* - {@code document-after-*.<markup.ext>} : import after Definitions document with levelOffset = 0<br>
37-
* - {@code document-begin-*.<markup.ext>} : import just after Definitions document main title with levelOffset = 1<br>
38-
* - {@code document-end-*.<markup.ext>} : import at the end of Definitions document with levelOffset = 1<br>
39-
* - {@code definition-begin-*.<markup.ext>} : import just after each definition title with levelOffset = 2<br>
40-
* - {@code definition-end-*.<markup.ext>} : import at the end of each definition with levelOffset = 2<br>
34+
* Dynamically search for markup files in {@code contentPath} to append in Definitions document.
4135
* <p>
4236
* Markup files are appended in the natural order of their names, for each category.
4337
*/
@@ -120,12 +114,12 @@ public void apply(Context context) {
120114
case DOCUMENT_END:
121115
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
122116
break;
117+
case DEFINITION_BEFORE:
123118
case DEFINITION_BEGIN:
124119
case DEFINITION_END:
120+
case DEFINITION_AFTER:
125121
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(Paths.get(IOUtils.normalizeName(context.getDefinitionName().get()))), contentPrefix(position), levelOffset(context));
126122
break;
127-
default:
128-
throw new RuntimeException(String.format("Unknown position '%s'", position));
129123
}
130124
}
131125
}

swagger2markup-import-files-ext/src/main/java/io/github/swagger2markup/extensions/DynamicOverviewDocumentExtension.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
import java.util.Optional;
3131

3232
/**
33-
* Dynamically search for markup files in {@code contentPath} to append to Overview, with the format :<br>
34-
* - {@code document-before-*.<markup.ext>} : import before Overview document with levelOffset = 0<br>
35-
* - {@code document-after-*.<markup.ext>} : import after Overview document with levelOffset = 0<br>
36-
* - {@code document-begin-*.<markup.ext>} : import just after Overview document main title with levelOffset = 1<br>
37-
* - {@code document-end-*.<markup.ext>} : import at the end of Overview document with levelOffset = 1<br>
33+
* Dynamically search for markup files in {@code contentPath} to append to Overview document.
3834
* <p>
3935
* Markup files are appended in the natural order of their names, for each category.
4036
*/
@@ -117,8 +113,6 @@ public void apply(Context context) {
117113
case DOCUMENT_END:
118114
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
119115
break;
120-
default:
121-
throw new RuntimeException(String.format("Unknown position '%s'", position));
122116
}
123117
}
124118
}

swagger2markup-import-files-ext/src/main/java/io/github/swagger2markup/extensions/DynamicPathsDocumentExtension.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@
3131
import java.util.Optional;
3232

3333
/**
34-
* Dynamically search for markup files in {@code contentPath} to append to Operations, with the format :<br>
35-
* - {@code document-before-*.<markup.ext>} : import before Paths document with levelOffset = 0<br>
36-
* - {@code document-after-*.<markup.ext>} : import after Paths document with levelOffset = 0<br>
37-
* - {@code document-begin-*.<markup.ext>} : import just after Paths document main title with levelOffset = 1<br>
38-
* - {@code document-end-*.<markup.ext>} : import at the end of Paths document with levelOffset = 1<br>
39-
* - {@code operation-begin-*.<markup.ext>} : import just after each operation title with levelOffset = 2(GroupBy.AS_IS) | 3(GroupBy.TAGS)<br>
40-
* - {@code operation-end-*.<markup.ext>} : import at the end of each operation with levelOffset = 2(GroupBy.AS_IS) | 3(GroupBy.TAGS)<br>
34+
* Dynamically search for markup files in {@code contentPath} to append to Paths document.
4135
* <p>
4236
* Markup files are appended in the natural order of their names, for each category.
4337
*/
@@ -120,12 +114,28 @@ public void apply(Context context) {
120114
case DOCUMENT_END:
121115
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
122116
break;
117+
case OPERATION_BEFORE:
123118
case OPERATION_BEGIN:
124119
case OPERATION_END:
120+
case OPERATION_AFTER:
121+
case OPERATION_DESCRIPTION_BEFORE:
122+
case OPERATION_DESCRIPTION_AFTER:
123+
case OPERATION_PARAMETERS_BEFORE:
124+
case OPERATION_PARAMETERS_AFTER:
125+
case OPERATION_RESPONSES_BEFORE:
126+
case OPERATION_RESPONSES_AFTER:
127+
case OPERATION_SECURITY_BEFORE:
128+
case OPERATION_SECURITY_AFTER:
129+
case OPERATION_DESCRIPTION_BEGIN:
130+
case OPERATION_DESCRIPTION_END:
131+
case OPERATION_PARAMETERS_BEGIN:
132+
case OPERATION_PARAMETERS_END:
133+
case OPERATION_RESPONSES_BEGIN:
134+
case OPERATION_RESPONSES_END:
135+
case OPERATION_SECURITY_BEGIN:
136+
case OPERATION_SECURITY_END:
125137
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getOperation().get().getId())), contentPrefix(position), levelOffset(context));
126138
break;
127-
default:
128-
throw new RuntimeException(String.format("Unknown position '%s'", position));
129139
}
130140
}
131141
}

swagger2markup-import-files-ext/src/main/java/io/github/swagger2markup/extensions/DynamicSecurityDocumentExtension.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@
3131
import java.util.Optional;
3232

3333
/**
34-
* Dynamically search for markup files in {@code contentPath} to append to Overview, with the format :<br>
35-
* - {@code document-before-*.<markup.ext>} : import before Overview document with levelOffset = 0<br>
36-
* - {@code document-after-*.<markup.ext>} : import after Overview document with levelOffset = 0<br>
37-
* - {@code document-begin-*.<markup.ext>} : import just after Overview document main title with levelOffset = 1<br>
38-
* - {@code document-end-*.<markup.ext>} : import at the end of Overview document with levelOffset = 1<br>
39-
* - {@code definition-begin-*.<markup.ext>} : import just after each definition title with levelOffset = 2<br>
40-
* - {@code definition-end-*.<markup.ext>} : import at the end of each definition with levelOffset = 2<br>
34+
* Dynamically search for markup files in {@code contentPath} to append to Security document.
4135
* <p>
4236
* Markup files are appended in the natural order of their names, for each category.
4337
*/
@@ -120,12 +114,12 @@ public void apply(Context context) {
120114
case DOCUMENT_END:
121115
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath, contentPrefix(position), levelOffset(context));
122116
break;
123-
case DEFINITION_BEGIN:
124-
case DEFINITION_END:
125-
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getDefinitionName().get())), contentPrefix(position), levelOffset(context));
117+
case SECURITY_SCHEME_BEFORE:
118+
case SECURITY_SCHEME_BEGIN:
119+
case SECURITY_SCHEME_END:
120+
case SECURITY_SCHEME_AFTER:
121+
dynamicContent.extensionsSection(extensionMarkupLanguage, contentPath.resolve(IOUtils.normalizeName(context.getSecuritySchemeName().get())), contentPrefix(position), levelOffset(context));
126122
break;
127-
default:
128-
throw new RuntimeException(String.format("Unknown position '%s'", position));
129123
}
130124
}
131125
}

swagger2markup-import-files-ext/src/test/java/io/github/swagger2markup/extensions/DynamicDocumentExtensionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class DynamicDocumentExtensionTest {
4040
public void testSwagger2AsciiDocExtensions() throws IOException, URISyntaxException {
4141
//Given
4242
Path file = Paths.get(DynamicDocumentExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
43-
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
43+
Path outputDirectory = Paths.get("build/test/asciidoc/generated");
4444
FileUtils.deleteQuietly(outputDirectory.toFile());
4545

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

7676
//When

swagger2markup-import-schemas-ext/src/main/java/io/github/swagger2markup/extensions/SchemaExtension.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,11 @@ public void apply(Context context) {
124124

125125
if (schemaBaseUri != null) {
126126
switch (context.getPosition()) {
127-
case DOCUMENT_BEFORE:
128-
case DOCUMENT_AFTER:
129-
case DOCUMENT_BEGIN:
130-
case DOCUMENT_END:
131-
case DEFINITION_BEGIN:
132-
break;
133127
case DEFINITION_END:
134128
for (SchemaMetadata schema : DEFAULT_SCHEMAS) {
135129
schemaSection(context, schema, levelOffset(context));
136130
}
137131
break;
138-
default:
139-
throw new RuntimeException(String.format("Unknown position '%s'", context.getPosition()));
140132
}
141133
}
142134
}

swagger2markup-import-schemas-ext/src/test/java/io/github/swagger2markup/extensions/SchemaExtensionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class SchemaExtensionTest {
4040
public void testSwagger2AsciiDocSchemaExtension() throws IOException, URISyntaxException {
4141
//Given
4242
Path file = Paths.get(SchemaExtensionTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
43-
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
43+
Path outputDirectory = Paths.get("build/test/asciidoc/generated");
4444
FileUtils.deleteQuietly(outputDirectory.toFile());
4545

4646
//When

swagger2markup-spring-restdocs-ext/src/test/java/io/github/swagger2markup/extensions/SpringRestDocsExtensionsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void setUp(){
5353
public void testSwagger2AsciiDocConversionWithSpringRestDocsExtension() throws IOException, URISyntaxException {
5454
//Given
5555
Path file = Paths.get(SpringRestDocsExtensionsTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
56-
Path outputDirectory = Paths.get("build/docs/asciidoc/spring_rest_docs");
56+
Path outputDirectory = Paths.get("build/test/asciidoc/spring_rest_docs");
5757
FileUtils.deleteQuietly(outputDirectory.toFile());
5858

5959
//When

0 commit comments

Comments
 (0)