Changed inlineSchemaDepthLevel from Integer to int

Changed default value of inlineSchemaDepthLevel from 0 to 1
This commit is contained in:
Robert Winkler
2016-02-03 08:46:52 +01:00
parent 2a300a2ef6
commit c62f6085f7
6 changed files with 30 additions and 13 deletions

View File

@@ -145,7 +145,7 @@ public class Swagger2MarkupConverter {
private OrderBy definitionsOrderedBy = OrderBy.NATURAL;
private MarkupLanguage markupLanguage = MarkupLanguage.ASCIIDOC;
private Language outputLanguage = Language.EN;
private Integer inlineSchemaDepthLevel = 0;
private int inlineSchemaDepthLevel = 0;
/**
* Creates a Builder using a given Swagger source.
@@ -277,7 +277,7 @@ public class Swagger2MarkupConverter {
* @param inlineSchemaDepthLevel
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withInlineSchemaDepthLevel(Integer inlineSchemaDepthLevel) {
public Builder withInlineSchemaDepthLevel(int inlineSchemaDepthLevel) {
this.inlineSchemaDepthLevel = inlineSchemaDepthLevel;
return this;
}

View File

@@ -66,7 +66,7 @@ public class DefinitionsDocument extends MarkupDocument {
private boolean separatedDefinitionsEnabled;
private String outputDirectory;
private final OrderBy definitionsOrderedBy;
private final Integer inlineSchemaDepthLevel;
private final int inlineSchemaDepthLevel;
public DefinitionsDocument(Swagger2MarkupConfig swagger2MarkupConfig, String outputDirectory){
super(swagger2MarkupConfig);

View File

@@ -75,7 +75,7 @@ public class PathsDocument extends MarkupDocument {
private boolean handWrittenDescriptionsEnabled;
private String descriptionsFolderPath;
private final GroupBy pathsGroupedBy;
private final Integer inlineSchemaDepthLevel;
private final int inlineSchemaDepthLevel;
public PathsDocument(Swagger2MarkupConfig swagger2MarkupConfig){
super(swagger2MarkupConfig);

View File

@@ -35,7 +35,7 @@ public class Swagger2MarkupConfig {
private final GroupBy pathsGroupedBy;
private final OrderBy definitionsOrderedBy;
private final Language outputLanguage;
private final Integer inlineSchemaDepthLevel;
private final int inlineSchemaDepthLevel;
/**
* @param swagger the Swagger source
@@ -52,7 +52,7 @@ public class Swagger2MarkupConfig {
public Swagger2MarkupConfig(Swagger swagger, MarkupLanguage markupLanguage, String examplesFolderPath,
String schemasFolderPath, String descriptionsFolderPath, boolean separatedDefinitions,
GroupBy pathsGroupedBy, OrderBy definitionsOrderedBy, Language outputLanguage,
Integer inlineSchemaDepthLevel) {
int inlineSchemaDepthLevel) {
this.swagger = swagger;
this.markupLanguage = markupLanguage;
this.examplesFolderPath = examplesFolderPath;
@@ -101,7 +101,7 @@ public class Swagger2MarkupConfig {
return outputLanguage;
}
public Integer getInlineSchemaDepthLevel() {
public int getInlineSchemaDepthLevel() {
return inlineSchemaDepthLevel;
}
}

View File

@@ -77,6 +77,23 @@ public class Swagger2MarkupConverterTest {
assertThat(directories).hasSize(3).containsAll(asList("definitions.adoc", "overview.adoc", "paths.adoc"));
}
@Test
public void testSwagger2AsciiDocWithInlineSchema() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_inlineSchema.yaml").getFile());
File outputDirectory = new File("build/docs/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath())
.withInlineSchemaDepthLevel(1).build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(3).containsAll(asList("definitions.adoc", "overview.adoc", "paths.adoc"));
}
@Test
public void testSwagger2AsciiDocGroupedByTags() throws IOException {
//Given

View File

@@ -14,7 +14,7 @@ paths:
/LaunchCommand:
post:
summary: LaunchCommand
description: <description>
description: Dummy description
tags:
- All
parameters:
@@ -41,7 +41,7 @@ paths:
schema:
$ref: '#/definitions/Simple'
- name: LaunchCommandRequest
description: <description>
description: Launch something
in: body
schema:
description: Inline schema
@@ -52,19 +52,19 @@ paths:
- MaxCount
properties:
DryRun:
description: <description>
description: Dummy description
type: boolean
SecurityGroup.N:
description: <description>
description: Dummy description
type: array
items:
type: string
type: string
Location:
description: <description>
description: Dummy description
$ref: '#/definitions/Location'
KernelId:
description: <description>
description: Dummy description
type: string
responses:
200: