use new MDB .withHeaderColumn

This commit is contained in:
Hugo de Paix de Coeur
2016-03-16 13:47:24 +01:00
parent 54147bbddb
commit ccf3ee8e7d
7 changed files with 52 additions and 52 deletions

View File

@@ -113,12 +113,12 @@ public abstract class MarkupDocumentBuilder {
List<ObjectType> localDefinitions = new ArrayList<>();
List<List<String>> cells = new ArrayList<>();
List<MarkupTableColumn> cols = Arrays.asList(
new MarkupTableColumn(NAME_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"),
new MarkupTableColumn(REQUIRED_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(EXAMPLE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"),
new MarkupTableColumn(REQUIRED_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(SCHEMA_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(EXAMPLE_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
if (MapUtils.isNotEmpty(type.getProperties())) {
Set<String> propertyNames = toKeySet(type.getProperties(), config.getPropertyOrdering());
for (String propertyName : propertyNames) {

View File

@@ -454,12 +454,12 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
if (displayParameters) {
List<List<String>> cells = new ArrayList<>();
List<MarkupTableColumn> cols = Arrays.asList(
new MarkupTableColumn(TYPE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(NAME_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"),
new MarkupTableColumn(REQUIRED_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
new MarkupTableColumn(TYPE_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"),
new MarkupTableColumn(REQUIRED_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(SCHEMA_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
for (Parameter parameter : parameters) {
if (filterParameter(parameter)) {
Type type = ParameterUtils.getType(parameter, new DefinitionDocumentResolverFromOperation());
@@ -635,9 +635,9 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
Map<String, SecuritySchemeDefinition> securityDefinitions = globalContext.getSwagger().getSecurityDefinitions();
List<List<String>> cells = new ArrayList<>();
List<MarkupTableColumn> cols = Arrays.asList(
new MarkupTableColumn(TYPE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(NAME_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(SCOPES_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"));
new MarkupTableColumn(TYPE_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(SCOPES_COLUMN).withWidthRatio(6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"));
for (Map<String, List<String>> securityScheme : securitySchemes) {
for (Map.Entry<String, List<String>> securityEntry : securityScheme.entrySet()) {
String securityKey = securityEntry.getKey();
@@ -688,15 +688,15 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
buildSectionTitle(RESPONSES, docBuilder);
List<MarkupTableColumn> responseCols = Arrays.asList(
new MarkupTableColumn(HTTP_CODE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN, 3).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
new MarkupTableColumn(HTTP_CODE_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(3).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
new MarkupTableColumn(SCHEMA_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
List<MarkupTableColumn> responseHeaderCols = Arrays.asList(
new MarkupTableColumn(NAME_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN, 3).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1).withHeaderColumn(true).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(3).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
new MarkupTableColumn(SCHEMA_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"),
new MarkupTableColumn(DEFAULT_COLUMN).withWidthRatio(1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
Set<String> responseNames = toKeySet(responses, config.getResponseOrdering());
for (String responseName : responseNames) {

View File

@@ -115,8 +115,8 @@ public class SecurityDocumentBuilder extends MarkupDocumentBuilder {
markupDocBuilder.textLine(TOKEN_URL + " : " + oauth2Scheme.getTokenUrl());
}
List<List<String>> cells = new ArrayList<>();
List<MarkupTableColumn> cols = Arrays.asList(new MarkupTableColumn(NAME_COLUMN, 1),
new MarkupTableColumn(DESCRIPTION_COLUMN, 6));
List<MarkupTableColumn> cols = Arrays.asList(new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1),
new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(6));
for (Map.Entry<String, String> scope : oauth2Scheme.getScopes().entrySet()) {
List<String> content = Arrays.asList(scope.getKey(), scope.getValue());
cells.add(content);

View File

@@ -48,7 +48,7 @@ POST /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -119,7 +119,7 @@ PUT /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -190,7 +190,7 @@ Multiple status values can be provided with comma seperated strings
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -261,7 +261,7 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -315,7 +315,7 @@ POST /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -395,7 +395,7 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|apiKey|<<_api_key,api_key>>|
@@ -444,7 +444,7 @@ DELETE /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets

View File

@@ -48,7 +48,7 @@ POST /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -135,7 +135,7 @@ PUT /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -196,7 +196,7 @@ Multiple status values can be provided with comma seperated strings
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -257,7 +257,7 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -311,7 +311,7 @@ POST /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -381,7 +381,7 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|apiKey|<<_api_key,api_key>>|
@@ -430,7 +430,7 @@ DELETE /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets

View File

@@ -48,7 +48,7 @@ POST /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -166,7 +166,7 @@ PUT /pets
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -258,7 +258,7 @@ Multiple status values can be provided with comma seperated strings
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -343,7 +343,7 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -421,7 +421,7 @@ POST /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -505,7 +505,7 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|apiKey|<<_api_key,api_key>>|
@@ -587,7 +587,7 @@ DELETE /pets/{petId}
==== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets

View File

@@ -48,7 +48,7 @@ POST /pets
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -114,7 +114,7 @@ PUT /pets
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -180,7 +180,7 @@ Multiple status values can be provided with comma seperated strings
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -246,7 +246,7 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -295,7 +295,7 @@ POST /pets/{petId}
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
@@ -370,7 +370,7 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|apiKey|<<_api_key,api_key>>|
@@ -414,7 +414,7 @@ DELETE /pets/{petId}
===== Security
[options="header", cols=".^1,.^1h,.^6"]
[options="header", cols=".^1h,.^1h,.^6"]
|===
|Type|Name|Scopes
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets