Merge remote-tracking branch 'origin/master'

This commit is contained in:
Robert Winkler
2016-04-06 08:12:35 +02:00
15 changed files with 175 additions and 85 deletions

View File

@@ -28,6 +28,7 @@ image::src/docs/asciidoc/images/Swagger2Markup_definitions.PNG[]
== Reference documentation
- http://swagger2markup.readme.io/[Reference Documentation]
- http://swagger2markup.github.io/swagger2markup/1.0.0-SNAPSHOT/[1.0.0-SNAPSHOT Documentation]
- https://github.com/Swagger2Markup/swagger2markup/blob/master/RELEASENOTES.adoc[Release notes]
- https://github.com/Swagger2Markup/spring-swagger2markup-demo[Demo using Swagger2Markup, Spring Boot, Springfox and spring-restdocs]

View File

@@ -109,11 +109,11 @@ public class DefinitionsDocumentBuilder extends MarkupDocumentBuilder {
if (checkThatDefinitionIsNotInIgnoreList(definitionName)) {
buildDefinition(definitionName, model);
if (logger.isInfoEnabled()) {
logger.info("Definition processed: {}", definitionName);
logger.info("Definition processed : '{}'", definitionName);
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("Definition was ignored: {}", definitionName);
logger.debug("Definition was ignored : '{}'", definitionName);
}
}
}
@@ -162,7 +162,7 @@ public class DefinitionsDocumentBuilder extends MarkupDocumentBuilder {
Path definitionFile = outputPath.resolve(resolveDefinitionDocument(definitionName));
defDocBuilder.writeToFileWithoutExtension(definitionFile, StandardCharsets.UTF_8);
if (logger.isInfoEnabled()) {
logger.info("Separate definition file produced: {}", definitionFile);
logger.info("Separate definition file produced : '{}'", definitionFile);
}
definitionRef(definitionName, this.markupDocBuilder);

View File

@@ -18,6 +18,7 @@ package io.github.swagger2markup.internal.document.builder;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.Swagger2MarkupExtensionRegistry;
import io.github.swagger2markup.internal.document.MarkupDocument;
import io.github.swagger2markup.markup.builder.MarkupDocBuilder;
import io.github.swagger2markup.spi.OverviewDocumentExtension;
import io.swagger.models.*;
@@ -106,53 +107,67 @@ public class OverviewDocumentBuilder extends MarkupDocumentBuilder {
private void buildVersionInfoSection(String version) {
if(isNotBlank(version)){
this.markupDocBuilder.sectionTitleLevel2(CURRENT_VERSION);
this.markupDocBuilder.textLine(VERSION + COLON + version, true);
MarkupDocBuilder paragraph = this.markupDocBuilder.copy(false);
paragraph.italicText(VERSION).textLine(COLON + version);
this.markupDocBuilder.paragraph(paragraph.toString(), true);
}
}
private void buildContactInfoSection(Contact contact) {
if(contact != null){
this.markupDocBuilder.sectionTitleLevel2(CONTACT_INFORMATION);
MarkupDocBuilder paragraph = this.markupDocBuilder.copy(false);
if(isNotBlank(contact.getName())){
this.markupDocBuilder.textLine(CONTACT_NAME + COLON + contact.getName(), true);
paragraph.italicText(CONTACT_NAME).textLine(COLON + contact.getName());
}
if(isNotBlank(contact.getEmail())){
this.markupDocBuilder.textLine(CONTACT_EMAIL + COLON + contact.getEmail(), true);
paragraph.italicText(CONTACT_EMAIL).textLine(COLON + contact.getEmail());
}
this.markupDocBuilder.paragraph(paragraph.toString(), true);
}
}
private void buildLicenseInfoSection(License license, String termOfService) {
if(license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) {
if (
(license != null && (isNotBlank(license.getName()) || isNotBlank(license.getUrl()))) ||
(isNotBlank(termOfService))
) {
this.markupDocBuilder.sectionTitleLevel2(LICENSE_INFORMATION);
MarkupDocBuilder paragraph = this.markupDocBuilder.copy(false);
if (isNotBlank(license.getName())) {
this.markupDocBuilder.textLine(LICENSE + COLON + license.getName(), true);
paragraph.italicText(LICENSE).textLine(COLON + license.getName());
}
if (isNotBlank(license.getUrl())) {
this.markupDocBuilder.textLine(LICENSE_URL + COLON + license.getUrl(), true);
paragraph.italicText(LICENSE_URL).textLine(COLON + license.getUrl());
}
}
if(isNotBlank(termOfService)){
this.markupDocBuilder.textLine(TERMS_OF_SERVICE + COLON + termOfService, true);
if(isNotBlank(termOfService)){
paragraph.italicText(TERMS_OF_SERVICE).textLine(COLON + termOfService);
}
this.markupDocBuilder.paragraph(paragraph.toString(), true);
}
}
private void buildUriSchemeSection(Swagger swagger) {
if(isNotBlank(swagger.getHost()) || isNotBlank(swagger.getBasePath()) || isNotEmpty(swagger.getSchemes())) {
this.markupDocBuilder.sectionTitleLevel2(URI_SCHEME);
MarkupDocBuilder paragraph = this.markupDocBuilder.copy(false);
if (isNotBlank(swagger.getHost())) {
this.markupDocBuilder.textLine(HOST + COLON + swagger.getHost(), true);
paragraph.italicText(HOST).textLine(COLON + swagger.getHost());
}
if (isNotBlank(swagger.getBasePath())) {
this.markupDocBuilder.textLine(BASE_PATH + COLON + swagger.getBasePath(), true);
paragraph.italicText(BASE_PATH).textLine(COLON + swagger.getBasePath());
}
if (isNotEmpty(swagger.getSchemes())) {
List<String> schemes = new ArrayList<>();
for (Scheme scheme : swagger.getSchemes()) {
schemes.add(scheme.toString());
}
this.markupDocBuilder.textLine(SCHEMES + COLON + join(schemes, ", "), true);
paragraph.italicText(SCHEMES).textLine(COLON + join(schemes, ", "));
}
this.markupDocBuilder.paragraph(paragraph.toString(), true);
}
}
@@ -164,7 +179,7 @@ public class OverviewDocumentBuilder extends MarkupDocumentBuilder {
String name = tag.getName();
String description = tag.getDescription();
if(isNoneBlank(description)){
tagsList.add(name + COLON + description);
tagsList.add(name + COLON + description);
}else{
tagsList.add(name);
}
@@ -176,14 +191,26 @@ public class OverviewDocumentBuilder extends MarkupDocumentBuilder {
private void buildConsumesSection(List<String> consumes) {
if (isNotEmpty(consumes)) {
this.markupDocBuilder.sectionTitleLevel2(CONSUMES);
this.markupDocBuilder.unorderedList(consumes);
this.markupDocBuilder.newLine();
for (String consume : consumes) {
MarkupDocBuilder contentType = this.markupDocBuilder.copy(false);
contentType.literalText(consume);
this.markupDocBuilder.unorderedListItem(contentType.toString());
}
this.markupDocBuilder.newLine();
}
}
private void buildProducesSection(List<String> consumes) {
if (isNotEmpty(consumes)) {
private void buildProducesSection(List<String> produces) {
if (isNotEmpty(produces)) {
this.markupDocBuilder.sectionTitleLevel2(PRODUCES);
this.markupDocBuilder.unorderedList(consumes);
this.markupDocBuilder.newLine();
for (String consume : produces) {
MarkupDocBuilder contentType = this.markupDocBuilder.copy(false);
contentType.literalText(consume);
this.markupDocBuilder.unorderedListItem(contentType.toString());
}
this.markupDocBuilder.newLine();
}
}

View File

@@ -245,7 +245,7 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
java.nio.file.Path operationFile = outputPath.resolve(resolveOperationDocument(operation));
pathDocBuilder.writeToFileWithoutExtension(operationFile, StandardCharsets.UTF_8);
if (logger.isInfoEnabled()) {
logger.info("Separate operation file produced: {}", operationFile);
logger.info("Separate operation file produced : '{}'", operationFile);
}
buildOperationRef(operation, this.markupDocBuilder);
@@ -255,7 +255,7 @@ public class PathsDocumentBuilder extends MarkupDocumentBuilder {
}
if (logger.isInfoEnabled()) {
logger.info("Operation processed: {}", operation);
logger.info("Operation processed : '{}' (normalized id = '{}')", operation, normalizeName(operation.getId()));
}
}

View File

@@ -38,7 +38,7 @@ public class DiffUtils {
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(expectedDirectory)) {
for (Path expectedFile : directoryStream) {
Path actualFile = actualDirectory.resolve(expectedFile.getFileName());
LOGGER.info("Diffing file {} with {}", actualFile, expectedFile);
LOGGER.info("Diffing file '{}' with '{}'", actualFile, expectedFile);
DiffAssertions.assertThat(actualFile).isEqualTo(expectedFile, reportPath);
}
}
@@ -49,7 +49,7 @@ public class DiffUtils {
public static void assertThatFileIsEqual(Path expectedFile, Path actualFile, String reportName) {
Path reportPath = Paths.get("build/diff-report/", reportName);
LOGGER.info("Diffing file {} with {}", actualFile, expectedFile);
LOGGER.info("Diffing file '{}' with '{}'", actualFile, expectedFile);
DiffAssertions.assertThat(actualFile).isEqualTo(expectedFile, reportPath);
}
}

View File

@@ -11,20 +11,28 @@ For this sample, you can use the api key `special-key` to test the authorization
=== Version information
Version : 1.0.0 +
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
Contact : apiteam@swagger.io +
[%hardbreaks]
_Contact_ : apiteam@swagger.io
=== License information
License : Apache 2.0 +
License URL : http://www.apache.org/licenses/LICENSE-2.0.html +
Terms of service : http://helloreverb.com/terms/ +
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
Host : petstore.swagger.io +
BasePath : /v2 +
Schemes : HTTP +
[%hardbreaks]
_Host_ : petstore.swagger.io
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags

View File

@@ -7,9 +7,13 @@ Description
=== Version information
Version : Developer build +
[%hardbreaks]
_Version_ : Developer build
=== URI scheme
Host : localhost:8080 +
[%hardbreaks]
_Host_ : localhost:8080

View File

@@ -11,20 +11,28 @@ For this sample, you can use the api key `special-key` to test the authorization
=== Version information
Version : 1.0.0 +
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
Contact : apiteam@wordnik.com +
[%hardbreaks]
_Contact_ : apiteam@wordnik.com
=== License information
License : Apache 2.0 +
License URL : http://www.apache.org/licenses/LICENSE-2.0.html +
Terms of service : http://helloreverb.com/terms/ +
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
Host : petstore.swagger.wordnik.com +
BasePath : /v2 +
Schemes : HTTP +
[%hardbreaks]
_Host_ : petstore.swagger.wordnik.com
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags

View File

@@ -11,20 +11,28 @@ For this sample, you can use the api key `special-key` to test the authorization
=== Version information
Version : 1.0.0 +
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
Contact : apiteam@wordnik.com +
[%hardbreaks]
_Contact_ : apiteam@wordnik.com
=== License information
License : Apache 2.0 +
License URL : http://www.apache.org/licenses/LICENSE-2.0.html +
Terms of service : http://helloreverb.com/terms/ +
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
Host : petstore.swagger.wordnik.com +
BasePath : /v2 +
Schemes : HTTP +
[%hardbreaks]
_Host_ : petstore.swagger.wordnik.com
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags

View File

@@ -11,20 +11,28 @@ For this sample, you can use the api key `special-key` to test the authorization
=== Version information
Version : 1.0.0 +
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
Contact : apiteam@swagger.io +
[%hardbreaks]
_Contact_ : apiteam@swagger.io
=== License information
License : Apache 2.0 +
License URL : http://www.apache.org/licenses/LICENSE-2.0.html +
Terms of service : http://helloreverb.com/terms/ +
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
Host : petstore.swagger.io +
BasePath : /v2 +
Schemes : HTTP +
[%hardbreaks]
_Host_ : petstore.swagger.io
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags

View File

@@ -7,20 +7,24 @@ Service API
=== Version information
Version : 2.18 +
[%hardbreaks]
_Version_ : 2.18
=== URI scheme
Host : service.host.com +
Schemes : HTTPS +
[%hardbreaks]
_Host_ : service.host.com
_Schemes_ : HTTPS
=== Consumes
* application/json
* `application/json`
=== Produces
* application/json
* `application/json`

View File

@@ -7,14 +7,20 @@ Description
=== Version information
Version : Developer build +
[%hardbreaks]
_Version_ : Developer build
=== Contact information
Contact : (Contact name) +
[%hardbreaks]
_Contact_ : (Contact name)
=== URI scheme
Host : localhost:8080 +
BasePath : /engine +
[%hardbreaks]
_Host_ : localhost:8080
_BasePath_ : /engine
=== Tags

View File

@@ -7,9 +7,13 @@ Description
=== Version information
Version : Developer build +
[%hardbreaks]
_Version_ : Developer build
=== URI scheme
Host : localhost:8080 +
[%hardbreaks]
_Host_ : localhost:8080

View File

@@ -11,20 +11,28 @@ For this sample, you can use the api key `special-key` to test the authorization
=== Version information
Version : 1.0.0 +
[%hardbreaks]
_Version_ : 1.0.0
=== Contact information
Contact : apiteam@swagger.io +
[%hardbreaks]
_Contact_ : apiteam@swagger.io
=== License information
License : Apache 2.0 +
License URL : http://www.apache.org/licenses/LICENSE-2.0.html +
Terms of service : http://helloreverb.com/terms/ +
[%hardbreaks]
_License_ : Apache 2.0
_License URL_ : http://www.apache.org/licenses/LICENSE-2.0.html
_Terms of service_ : http://helloreverb.com/terms/
=== URI scheme
Host : petstore.swagger.io +
BasePath : /v2 +
Schemes : HTTP +
[%hardbreaks]
_Host_ : petstore.swagger.io
_BasePath_ : /v2
_Schemes_ : HTTP
=== Tags

View File

@@ -11,20 +11,24 @@ For this sample, you can use the api key `special-key` to test the authorization
### Version information
Version : 1.0.0
*Version* : 1.0.0
### Contact information
Contact : apiteam@swagger.io
*Contact* : apiteam@swagger.io
### License information
License : Apache 2.0
License URL : http://www.apache.org/licenses/LICENSE-2.0.html
Terms of service : http://helloreverb.com/terms/
*License* : Apache 2.0
*License URL* : http://www.apache.org/licenses/LICENSE-2.0.html
*Terms of service* : http://helloreverb.com/terms/
### URI scheme
Host : petstore.swagger.io
BasePath : /v2
Schemes : HTTP
*Host* : petstore.swagger.io
*BasePath* : /v2
*Schemes* : HTTP
### Tags