diff --git a/src/main/java/io/github/swagger2markup/internal/document/builder/MarkupDocumentBuilder.java b/src/main/java/io/github/swagger2markup/internal/document/builder/MarkupDocumentBuilder.java index 23afc81c..47e5b540 100644 --- a/src/main/java/io/github/swagger2markup/internal/document/builder/MarkupDocumentBuilder.java +++ b/src/main/java/io/github/swagger2markup/internal/document/builder/MarkupDocumentBuilder.java @@ -113,12 +113,12 @@ public abstract class MarkupDocumentBuilder { List localDefinitions = new ArrayList<>(); List> cells = new ArrayList<>(); List 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 propertyNames = toKeySet(type.getProperties(), config.getPropertyOrdering()); for (String propertyName : propertyNames) { diff --git a/src/main/java/io/github/swagger2markup/internal/document/builder/PathsDocumentBuilder.java b/src/main/java/io/github/swagger2markup/internal/document/builder/PathsDocumentBuilder.java index b3d09723..5245893a 100644 --- a/src/main/java/io/github/swagger2markup/internal/document/builder/PathsDocumentBuilder.java +++ b/src/main/java/io/github/swagger2markup/internal/document/builder/PathsDocumentBuilder.java @@ -454,12 +454,12 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder { if (displayParameters) { List> cells = new ArrayList<>(); List 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 securityDefinitions = globalContext.getSwagger().getSecurityDefinitions(); List> cells = new ArrayList<>(); List 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> securityScheme : securitySchemes) { for (Map.Entry> securityEntry : securityScheme.entrySet()) { String securityKey = securityEntry.getKey(); @@ -688,15 +688,15 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder { buildSectionTitle(RESPONSES, docBuilder); List 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 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 responseNames = toKeySet(responses, config.getResponseOrdering()); for (String responseName : responseNames) { diff --git a/src/main/java/io/github/swagger2markup/internal/document/builder/SecurityDocumentBuilder.java b/src/main/java/io/github/swagger2markup/internal/document/builder/SecurityDocumentBuilder.java index ef5c1f5f..a9d1490e 100644 --- a/src/main/java/io/github/swagger2markup/internal/document/builder/SecurityDocumentBuilder.java +++ b/src/main/java/io/github/swagger2markup/internal/document/builder/SecurityDocumentBuilder.java @@ -115,8 +115,8 @@ public class SecurityDocumentBuilder extends MarkupDocumentBuilder { markupDocBuilder.textLine(TOKEN_URL + " : " + oauth2Scheme.getTokenUrl()); } List> cells = new ArrayList<>(); - List cols = Arrays.asList(new MarkupTableColumn(NAME_COLUMN, 1), - new MarkupTableColumn(DESCRIPTION_COLUMN, 6)); + List cols = Arrays.asList(new MarkupTableColumn(NAME_COLUMN).withWidthRatio(1), + new MarkupTableColumn(DESCRIPTION_COLUMN).withWidthRatio(6)); for (Map.Entry scope : oauth2Scheme.getScopes().entrySet()) { List content = Arrays.asList(scope.getKey(), scope.getValue()); cells.add(content); diff --git a/src/test/resources/expected_results/asciidoc/default/paths.adoc b/src/test/resources/expected_results/asciidoc/default/paths.adoc index 8c9b9a80..32e336a0 100644 --- a/src/test/resources/expected_results/asciidoc/default/paths.adoc +++ b/src/test/resources/expected_results/asciidoc/default/paths.adoc @@ -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 diff --git a/src/test/resources/expected_results/asciidoc/examples/paths.adoc b/src/test/resources/expected_results/asciidoc/examples/paths.adoc index d616e942..75927e24 100644 --- a/src/test/resources/expected_results/asciidoc/examples/paths.adoc +++ b/src/test/resources/expected_results/asciidoc/examples/paths.adoc @@ -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 diff --git a/src/test/resources/expected_results/asciidoc/generated_examples/paths.adoc b/src/test/resources/expected_results/asciidoc/generated_examples/paths.adoc index 015f94ba..429a3e88 100644 --- a/src/test/resources/expected_results/asciidoc/generated_examples/paths.adoc +++ b/src/test/resources/expected_results/asciidoc/generated_examples/paths.adoc @@ -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 diff --git a/src/test/resources/expected_results/asciidoc/group_by_tags/paths.adoc b/src/test/resources/expected_results/asciidoc/group_by_tags/paths.adoc index 939365c5..9c0c82f8 100644 --- a/src/test/resources/expected_results/asciidoc/group_by_tags/paths.adoc +++ b/src/test/resources/expected_results/asciidoc/group_by_tags/paths.adoc @@ -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