Merge branch 'develop' into features/schema-ext
Conflicts: src/test/java/io/github/robwin/swagger2markup/Swagger2MarkupConverterTest.java
This commit is contained in:
36
build.gradle
36
build.gradle
@@ -6,7 +6,6 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
|
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
|
||||||
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10.1'
|
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.10.1'
|
||||||
classpath 'io.spring.gradle:dependency-management-plugin:0.5.5.RELEASE'
|
|
||||||
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
|
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
|
||||||
classpath 'org.asciidoctor:asciidoctorj:1.5.2'
|
classpath 'org.asciidoctor:asciidoctorj:1.5.2'
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
|
||||||
@@ -22,7 +21,6 @@ apply plugin: 'maven-publish'
|
|||||||
apply plugin: 'org.asciidoctor.convert'
|
apply plugin: 'org.asciidoctor.convert'
|
||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
apply plugin: 'com.github.kt3k.coveralls'
|
apply plugin: 'com.github.kt3k.coveralls'
|
||||||
apply plugin: 'io.spring.dependency-management'
|
|
||||||
apply plugin: 'com.jfrog.bintray'
|
apply plugin: 'com.jfrog.bintray'
|
||||||
apply plugin: "com.jfrog.artifactory"
|
apply plugin: "com.jfrog.artifactory"
|
||||||
apply from: 'gradle/publishing.gradle'
|
apply from: 'gradle/publishing.gradle'
|
||||||
@@ -41,34 +39,20 @@ repositories {
|
|||||||
}
|
}
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
//mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'io.github.robwin:markup-document-builder'
|
compile 'io.github.robwin:markup-document-builder:0.1.6-SNAPSHOT'
|
||||||
compile 'io.swagger:swagger-compat-spec-parser'
|
compile 'io.swagger:swagger-compat-spec-parser:1.0.17'
|
||||||
compile 'commons-collections:commons-collections'
|
compile 'commons-collections:commons-collections:3.2.1'
|
||||||
compile 'commons-io:commons-io'
|
compile 'commons-io:commons-io:2.4'
|
||||||
compile 'org.slf4j:slf4j-api'
|
compile 'org.slf4j:slf4j-api:1.7.12'
|
||||||
testCompile 'junit:junit'
|
testCompile 'junit:junit:4.11'
|
||||||
testCompile 'org.asciidoctor:asciidoctorj:1.5.4'
|
testCompile 'org.asciidoctor:asciidoctorj:1.5.4'
|
||||||
testCompile 'ch.qos.logback:logback-classic'
|
testCompile 'ch.qos.logback:logback-classic:1.1.2'
|
||||||
testCompile 'org.assertj:assertj-core'
|
testCompile 'org.assertj:assertj-core:2.2.0'
|
||||||
testCompile 'com.sksamuel.diff:diff'
|
testCompile 'com.sksamuel.diff:diff:1.1.11'
|
||||||
}
|
|
||||||
|
|
||||||
dependencyManagement {
|
|
||||||
dependencies {
|
|
||||||
dependency "io.github.robwin:markup-document-builder:0.1.6-SNAPSHOT"
|
|
||||||
dependency "io.swagger:swagger-compat-spec-parser:1.0.17"
|
|
||||||
dependency "commons-collections:commons-collections:3.2.1"
|
|
||||||
dependency "commons-io:commons-io:2.4"
|
|
||||||
dependency "junit:junit:4.11"
|
|
||||||
dependency "org.slf4j:slf4j-api:1.7.12"
|
|
||||||
dependency "ch.qos.logback:logback-classic:1.1.2"
|
|
||||||
dependency "org.assertj:assertj-core:2.2.0"
|
|
||||||
dependency "com.sksamuel.diff:diff:1.1.11"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public abstract class MarkupDocument {
|
|||||||
this.config = globalContext.config;
|
this.config = globalContext.config;
|
||||||
this.outputPath = outputPath;
|
this.outputPath = outputPath;
|
||||||
|
|
||||||
this.markupDocBuilder = MarkupDocBuilders.documentBuilder(config.getMarkupLanguage()).withAnchorPrefix(config.getAnchorPrefix());
|
this.markupDocBuilder = MarkupDocBuilders.documentBuilder(config.getMarkupLanguage(), config.getLineSeparator()).withAnchorPrefix(config.getAnchorPrefix());
|
||||||
|
|
||||||
ResourceBundle labels = ResourceBundle.getBundle("io/github/robwin/swagger2markup/lang/labels", config.getOutputLanguage().toLocale());
|
ResourceBundle labels = ResourceBundle.getBundle("io/github/robwin/swagger2markup/lang/labels", config.getOutputLanguage().toLocale());
|
||||||
DEFAULT_COLUMN = labels.getString("default_column");
|
DEFAULT_COLUMN = labels.getString("default_column");
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class PathsDocument extends MarkupDocument {
|
|||||||
|
|
||||||
if (paths != null) {
|
if (paths != null) {
|
||||||
for (Map.Entry<String, Path> path : paths.entrySet()) {
|
for (Map.Entry<String, Path> path : paths.entrySet()) {
|
||||||
Map<HttpMethod, Operation> operations = path.getValue().getOperationMap();
|
Map<HttpMethod, Operation> operations = path.getValue().getOperationMap(); // TODO AS_IS does not work because of https://github.com/swagger-api/swagger-core/issues/1696
|
||||||
|
|
||||||
if (operations != null) {
|
if (operations != null) {
|
||||||
for (Map.Entry<HttpMethod, Operation> operation : operations.entrySet()) {
|
for (Map.Entry<HttpMethod, Operation> operation : operations.entrySet()) {
|
||||||
@@ -504,7 +504,7 @@ public class PathsDocument extends MarkupDocument {
|
|||||||
docBuilder.paragraph(parameter.getDescription());
|
docBuilder.paragraph(parameter.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkupDocBuilder typeInfos = MarkupDocBuilders.documentBuilder(config.getMarkupLanguage());
|
MarkupDocBuilder typeInfos = MarkupDocBuilders.documentBuilder(config.getMarkupLanguage(), config.getLineSeparator());
|
||||||
typeInfos.italicText(REQUIRED_COLUMN).textLine(": " + parameter.getRequired());
|
typeInfos.italicText(REQUIRED_COLUMN).textLine(": " + parameter.getRequired());
|
||||||
typeInfos.italicText(NAME_COLUMN).textLine(": " + parameter.getName());
|
typeInfos.italicText(NAME_COLUMN).textLine(": " + parameter.getName());
|
||||||
if (!(type instanceof ObjectType)) {
|
if (!(type instanceof ObjectType)) {
|
||||||
@@ -682,7 +682,8 @@ public class PathsDocument extends MarkupDocument {
|
|||||||
List<List<String>> cells = new ArrayList<>();
|
List<List<String>> cells = new ArrayList<>();
|
||||||
List<MarkupTableColumn> cols = Arrays.asList(
|
List<MarkupTableColumn> cols = Arrays.asList(
|
||||||
new MarkupTableColumn(HTTP_CODE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
|
new MarkupTableColumn(HTTP_CODE_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1h"),
|
||||||
new MarkupTableColumn(DESCRIPTION_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^6"),
|
new MarkupTableColumn(DESCRIPTION_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
|
||||||
|
new MarkupTableColumn(HEADERS_COLUMN, 6).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^3"),
|
||||||
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
|
new MarkupTableColumn(SCHEMA_COLUMN, 1).withMarkupSpecifiers(MarkupLanguage.ASCIIDOC, ".^1"));
|
||||||
Set<String> responseNames;
|
Set<String> responseNames;
|
||||||
if (config.getResponseOrdering() == null)
|
if (config.getResponseOrdering() == null)
|
||||||
@@ -693,6 +694,12 @@ public class PathsDocument extends MarkupDocument {
|
|||||||
|
|
||||||
for (String responseName : responseNames) {
|
for (String responseName : responseNames) {
|
||||||
Response response = responses.get(responseName);
|
Response response = responses.get(responseName);
|
||||||
|
Map<String, Property> headers = response.getHeaders();
|
||||||
|
|
||||||
|
List<String> headersToRender = new LinkedList<>();
|
||||||
|
if(MapUtils.isNotEmpty(headers)){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (response.getSchema() != null) {
|
if (response.getSchema() != null) {
|
||||||
Property property = response.getSchema();
|
Property property = response.getSchema();
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ package io.github.robwin.swagger2markup.config;
|
|||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
|
import io.github.robwin.markup.builder.LineSeparator;
|
||||||
import io.github.robwin.markup.builder.MarkupLanguage;
|
import io.github.robwin.markup.builder.MarkupLanguage;
|
||||||
import io.github.robwin.swagger2markup.*;
|
import io.github.robwin.swagger2markup.*;
|
||||||
import io.github.robwin.swagger2markup.utils.IOUtils;
|
import io.github.robwin.swagger2markup.utils.IOUtils;
|
||||||
import io.swagger.models.HttpMethod;
|
import io.swagger.models.HttpMethod;
|
||||||
import io.swagger.models.parameters.Parameter;
|
import io.swagger.models.parameters.Parameter;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -64,6 +66,7 @@ public class Swagger2MarkupConfig {
|
|||||||
private String interDocumentCrossReferencesPrefix;
|
private String interDocumentCrossReferencesPrefix;
|
||||||
private boolean flatBodyEnabled;
|
private boolean flatBodyEnabled;
|
||||||
private String anchorPrefix;
|
private String anchorPrefix;
|
||||||
|
private LineSeparator lineSeparator;
|
||||||
|
|
||||||
private String overviewDocument;
|
private String overviewDocument;
|
||||||
private String pathsDocument;
|
private String pathsDocument;
|
||||||
@@ -256,6 +259,10 @@ public class Swagger2MarkupConfig {
|
|||||||
return separatedDefinitionsFolder;
|
return separatedDefinitionsFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LineSeparator getLineSeparator() {
|
||||||
|
return lineSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private static final String PROPERTIES_PREFIX = "swagger2markup.";
|
private static final String PROPERTIES_PREFIX = "swagger2markup.";
|
||||||
@@ -333,6 +340,10 @@ public class Swagger2MarkupConfig {
|
|||||||
config.parameterOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "parameterOrderBy"));
|
config.parameterOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "parameterOrderBy"));
|
||||||
config.propertyOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "propertyOrderBy"));
|
config.propertyOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "propertyOrderBy"));
|
||||||
config.responseOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "responseOrderBy"));
|
config.responseOrderBy = OrderBy.valueOf(safeProperties.getProperty(PROPERTIES_PREFIX + "responseOrderBy"));
|
||||||
|
String lineSeparator = safeProperties.getProperty(PROPERTIES_PREFIX + "lineSeparator");
|
||||||
|
if(StringUtils.isNoneBlank(lineSeparator)){
|
||||||
|
config.lineSeparator = LineSeparator.valueOf(lineSeparator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Properties defaultProperties() {
|
private Properties defaultProperties() {
|
||||||
@@ -726,7 +737,7 @@ public class Swagger2MarkupConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Optionally prefix all anchors for unicity
|
* Optionally prefix all anchors for unicity
|
||||||
*
|
*.
|
||||||
* @param anchorPrefix anchor prefix.
|
* @param anchorPrefix anchor prefix.
|
||||||
* @return this builder
|
* @return this builder
|
||||||
*/
|
*/
|
||||||
@@ -736,6 +747,18 @@ public class Swagger2MarkupConfig {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the line separator which should be used .
|
||||||
|
*
|
||||||
|
* @param lineSeparator the lineSeparator
|
||||||
|
* @return this builder
|
||||||
|
*/
|
||||||
|
public Builder withLineSeparator(LineSeparator lineSeparator) {
|
||||||
|
Validate.notNull(lineSeparator, "%s must no be null", "lineSeparator");
|
||||||
|
config.lineSeparator = lineSeparator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ swagger2markup.securityDocument=security
|
|||||||
swagger2markup.separatedOperationsFolder=operations
|
swagger2markup.separatedOperationsFolder=operations
|
||||||
swagger2markup.separatedDefinitionsFolder=definitions
|
swagger2markup.separatedDefinitionsFolder=definitions
|
||||||
swagger2markup.tagOrderBy=NATURAL
|
swagger2markup.tagOrderBy=NATURAL
|
||||||
swagger2markup.operationOrderBy=AS_IS
|
swagger2markup.operationOrderBy=NATURAL
|
||||||
swagger2markup.definitionOrderBy=NATURAL
|
swagger2markup.definitionOrderBy=NATURAL
|
||||||
swagger2markup.parameterOrderBy=NATURAL
|
swagger2markup.parameterOrderBy=NATURAL
|
||||||
swagger2markup.propertyOrderBy=NATURAL
|
swagger2markup.propertyOrderBy=NATURAL
|
||||||
|
|||||||
@@ -0,0 +1,433 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Robert Winkler
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package io.github.robwin.swagger2markup;
|
||||||
|
|
||||||
|
import io.github.robwin.markup.builder.LineSeparator;
|
||||||
|
import io.github.robwin.swagger2markup.assertions.DiffUtils;
|
||||||
|
import io.github.robwin.swagger2markup.config.Swagger2MarkupConfig;
|
||||||
|
import io.github.robwin.swagger2markup.extension.Swagger2MarkupExtensionRegistry;
|
||||||
|
import io.github.robwin.swagger2markup.extension.repository.DynamicDefinitionsContentExtension;
|
||||||
|
import io.github.robwin.swagger2markup.extension.repository.DynamicOperationsContentExtension;
|
||||||
|
import io.github.robwin.swagger2markup.extension.repository.SpringRestDocsExtension;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
|
||||||
|
import static org.assertj.core.api.BDDAssertions.assertThat;
|
||||||
|
|
||||||
|
public class AsciidocConverterTest {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(AsciidocConverterTest.class);
|
||||||
|
private static final String[] EXPECTED_FILES = new String[]{"definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"};
|
||||||
|
private List<String> expectedFiles;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp(){
|
||||||
|
expectedFiles = new ArrayList<>(asList(EXPECTED_FILES));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionAsString() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
|
||||||
|
//When
|
||||||
|
String asciiDocAsString = Swagger2MarkupConverter.from(file).build()
|
||||||
|
.asString();
|
||||||
|
//Then
|
||||||
|
assertThat(asciiDocAsString).isNotEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversion() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withLineSeparator(LineSeparator.WINDOWS).build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(file).withConfig(config).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/default").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversion.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionFromString() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/yaml/swagger_petstore.yaml"));
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withLineSeparator(LineSeparator.WINDOWS).build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(swaggerJsonString).withConfig(config).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/default").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversion.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithSpringRestDocsExtension() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/yaml/swagger_petstore.yaml"));
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
||||||
|
.withExtension(new SpringRestDocsExtension(Paths.get("src/docs/asciidoc/paths").toUri()).withDefaultSnippets())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(swaggerJsonString)
|
||||||
|
.withConfig(config)
|
||||||
|
.withExtensionRegistry(registry)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/spring_rest_docs").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversionWithSpringRestDocsExtension.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithExamples() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/json/swagger_examples.json"));
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(swaggerJsonString)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/examples").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversionWithExamples.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithGeneratedExamples() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/json/swagger_examples.json"));
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withGeneratedExamples()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(swaggerJsonString)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/generated_examples").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversionWithGeneratedExamples.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocWithInlineSchema() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_inlineSchema.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withInlineSchemaDepthLevel(1)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocGroupedByTags() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withPathsGroupedBy(GroupBy.TAGS)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/asciidoc/group_by_tags").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocGroupedByTags.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocGroupedByTagsWithMissingTag() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/json/swagger_missing_tag.json").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
//When
|
||||||
|
try {
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withPathsGroupedBy(GroupBy.TAGS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
// If NullPointerException was not thrown, test would fail the specified message
|
||||||
|
failBecauseExceptionWasNotThrown(NullPointerException.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
assertThat(e).hasMessage("Can't GroupBy.TAGS > Operation 'updatePet' has not tags");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithDefinitionDescriptions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withDefinitionDescriptions(Paths.get("src/docs/asciidoc/definitions"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionDoesNotContainUriScheme() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_should_not_contain_uri_scheme.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConverter.from(file).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc"))))
|
||||||
|
.doesNotContain("=== URI scheme");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionContainsUriScheme() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_should_contain_uri_scheme.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConverter.from(file).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc"))))
|
||||||
|
.contains("=== URI scheme");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithSeparatedDefinitions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withSeparatedDefinitions()
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file).withConfig(config).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
expectedFiles.add("definitions");
|
||||||
|
assertThat(files).hasSize(5).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
||||||
|
String[] definitions = definitionsDirectory.toFile().list();
|
||||||
|
assertThat(definitions).hasSize(5).containsAll(
|
||||||
|
asList("Category.adoc", "Order.adoc", "Pet.adoc", "Tag.adoc", "User.adoc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithSeparatedOperations() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withSeparatedOperations()
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file).withConfig(config).build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
expectedFiles.add("operations");
|
||||||
|
assertThat(files).hasSize(5).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path pathsDirectory = outputDirectory.resolve("operations");
|
||||||
|
String[] paths = pathsDirectory.toFile().list();
|
||||||
|
assertThat(paths).hasSize(18);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithRussianOutputLanguage() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withOutputLanguage(Language.RU)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")), Charset.forName("UTF-8")))
|
||||||
|
.contains("== Определения");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocConversionWithFrenchOutputLanguage() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withOutputLanguage(Language.FR)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc")), Charset.forName("UTF-8")))
|
||||||
|
.contains("== Sch\u00E9ma d'URI");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2AsciiDocExtensions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(AsciidocConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
||||||
|
.withExtension(new DynamicDefinitionsContentExtension(Paths.get("src/docs/asciidoc/extensions")))
|
||||||
|
.withExtension(new DynamicOperationsContentExtension(Paths.get("src/docs/asciidoc/extensions")))
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.withExtensionRegistry(registry)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.adoc")))).contains(
|
||||||
|
"Pet update request extension");
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")))).contains(
|
||||||
|
"Pet extension");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Robert Winkler
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package io.github.robwin.swagger2markup;
|
||||||
|
|
||||||
|
import io.github.robwin.swagger2markup.config.Swagger2MarkupConfig;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
public class GeneralConverterTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigDefaultPaths() throws URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(GeneralConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withDefinitionDescriptions()
|
||||||
|
.withOperationDescriptions()
|
||||||
|
.withSchemas()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter converterBuilder = Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//Then
|
||||||
|
URI baseUri = io.github.robwin.swagger2markup.utils.IOUtils.uriParent(converterBuilder.globalContext.swaggerLocation);
|
||||||
|
assertThat(converterBuilder.globalContext.config.getDefinitionDescriptionsUri()).isEqualTo(baseUri);
|
||||||
|
assertThat(converterBuilder.globalContext.config.getOperationDescriptionsUri()).isEqualTo(baseUri);
|
||||||
|
assertThat(converterBuilder.globalContext.config.getSchemasUri()).isEqualTo(baseUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigDefaultPathsWithUri() throws MalformedURLException {
|
||||||
|
//Given
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withDefinitionDescriptions()
|
||||||
|
.withOperationDescriptions()
|
||||||
|
.withSchemas()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Swagger2MarkupConverter converterBuilder = Swagger2MarkupConverter.from(URI.create("http://petstore.swagger.io/v2/swagger.json").toURL())
|
||||||
|
.withConfig(config)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//Then
|
||||||
|
assertThat(converterBuilder.globalContext.config.getDefinitionDescriptionsUri()).isNull();
|
||||||
|
assertThat(converterBuilder.globalContext.config.getOperationDescriptionsUri()).isNull();
|
||||||
|
assertThat(converterBuilder.globalContext.config.getSchemasUri()).isNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDefaultPathsWithoutFile() {
|
||||||
|
//Given
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withDefinitionDescriptions()
|
||||||
|
.build();
|
||||||
|
|
||||||
|
//Then
|
||||||
|
Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(new Swagger())
|
||||||
|
.withConfig(config)
|
||||||
|
.build();
|
||||||
|
assertThat(converter.globalContext.config.isDefinitionDescriptionsEnabled()).isFalse();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Robert Winkler
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package io.github.robwin.swagger2markup;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import io.github.robwin.markup.builder.LineSeparator;
|
||||||
|
import io.github.robwin.markup.builder.MarkupLanguage;
|
||||||
|
import io.github.robwin.swagger2markup.assertions.DiffUtils;
|
||||||
|
import io.github.robwin.swagger2markup.config.Swagger2MarkupConfig;
|
||||||
|
import io.github.robwin.swagger2markup.extension.Swagger2MarkupExtensionRegistry;
|
||||||
|
import io.github.robwin.swagger2markup.extension.repository.DynamicDefinitionsContentExtension;
|
||||||
|
import io.github.robwin.swagger2markup.extension.repository.DynamicOperationsContentExtension;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
import static org.assertj.core.api.Assertions.fail;
|
||||||
|
import static org.assertj.core.api.BDDAssertions.assertThat;
|
||||||
|
|
||||||
|
public class MarkdownConverterTest {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(MarkdownConverterTest.class);
|
||||||
|
|
||||||
|
private static final String[] EXPECTED_FILES = new String[]{"definitions.md", "overview.md", "paths.md", "security.md"};
|
||||||
|
private List<String> expectedFiles;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp(){
|
||||||
|
expectedFiles = new ArrayList<>(asList(EXPECTED_FILES));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2MarkdownConversion() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
||||||
|
.withLineSeparator(LineSeparator.WINDOWS)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path expectedFilesDirectory = Paths.get(AsciidocConverterTest.class.getResource("/results/markdown/default").toURI());
|
||||||
|
DiffUtils.assertThatAllFilesAreEqual(outputDirectory, expectedFilesDirectory, "testSwagger2AsciiDocConversion.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2MarkdownConversionWithDescriptions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withDefinitionDescriptions(Paths.get("src/docs/markdown/definitions"))
|
||||||
|
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
assertThat(files).hasSize(4).containsAll(expectedFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2MarkdownConversionWithSeparatedDefinitions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withSeparatedDefinitions()
|
||||||
|
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
expectedFiles.add("definitions");
|
||||||
|
assertThat(files).hasSize(5).containsAll(expectedFiles);
|
||||||
|
|
||||||
|
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
||||||
|
String[] definitions = definitionsDirectory.toFile().list();
|
||||||
|
assertThat(definitions).hasSize(5).containsAll(
|
||||||
|
asList("Category.md", "Order.md", "Pet.md", "Tag.md", "User.md"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2MarkdownConversionHandlesComposition() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withSeparatedDefinitions()
|
||||||
|
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
// Then
|
||||||
|
String[] files = outputDirectory.toFile().list();
|
||||||
|
expectedFiles.add("definitions");
|
||||||
|
assertThat(files).hasSize(5).containsAll(expectedFiles);
|
||||||
|
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
||||||
|
verifyMarkdownContainsFieldsInTables(
|
||||||
|
definitionsDirectory.resolve("User.md").toFile(),
|
||||||
|
ImmutableMap.<String, Set<String>>builder()
|
||||||
|
.put("User", ImmutableSet.of("id", "username", "firstName",
|
||||||
|
"lastName", "email", "password", "phone", "userStatus"))
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSwagger2MarkdownExtensions() throws IOException, URISyntaxException {
|
||||||
|
//Given
|
||||||
|
Path file = Paths.get(MarkdownConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
||||||
|
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
||||||
|
FileUtils.deleteQuietly(outputDirectory.toFile());
|
||||||
|
|
||||||
|
//When
|
||||||
|
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
||||||
|
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
||||||
|
.withExtension(new DynamicDefinitionsContentExtension(Paths.get("src/docs/markdown/extensions")))
|
||||||
|
.withExtension(new DynamicOperationsContentExtension(Paths.get("src/docs/markdown/extensions")))
|
||||||
|
.build();
|
||||||
|
Swagger2MarkupConverter.from(file)
|
||||||
|
.withConfig(config)
|
||||||
|
.withExtensionRegistry(registry)
|
||||||
|
.build()
|
||||||
|
.intoFolder(outputDirectory);
|
||||||
|
|
||||||
|
//Then
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.md")))).contains(
|
||||||
|
"Pet update request extension");
|
||||||
|
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.md")))).contains(
|
||||||
|
"Pet extension");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a markdown document to search, this checks to see if the specified tables
|
||||||
|
* have all of the expected fields listed.
|
||||||
|
*
|
||||||
|
* @param doc markdown document file to inspect
|
||||||
|
* @param fieldsByTable map of table name (header) to field names expected
|
||||||
|
* to be found in that table.
|
||||||
|
* @throws IOException if the markdown document could not be read
|
||||||
|
*/
|
||||||
|
private static void verifyMarkdownContainsFieldsInTables(File doc, Map<String, Set<String>> fieldsByTable) throws IOException {
|
||||||
|
final List<String> lines = Files.readAllLines(doc.toPath(), Charset.defaultCharset());
|
||||||
|
final Map<String, Set<String>> fieldsLeftByTable = Maps.newHashMap();
|
||||||
|
for (Map.Entry<String, Set<String>> entry : fieldsByTable.entrySet()) {
|
||||||
|
fieldsLeftByTable.put(entry.getKey(), Sets.newHashSet(entry.getValue()));
|
||||||
|
}
|
||||||
|
String inTable = null;
|
||||||
|
for (String line : lines) {
|
||||||
|
// If we've found every field we care about, quit early
|
||||||
|
if (fieldsLeftByTable.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transition to a new table if we encounter a header
|
||||||
|
final String currentHeader = getTableHeader(line);
|
||||||
|
if (inTable == null || currentHeader != null) {
|
||||||
|
inTable = currentHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're in a table that we care about, inspect this potential table row
|
||||||
|
if (inTable != null && fieldsLeftByTable.containsKey(inTable)) {
|
||||||
|
// If we're still in a table, read the row and check for the field name
|
||||||
|
// NOTE: If there was at least one pipe, then there's at least 2 fields
|
||||||
|
String[] parts = line.split("\\|");
|
||||||
|
if (parts.length > 1) {
|
||||||
|
final String fieldName = parts[1];
|
||||||
|
final Set<String> fieldsLeft = fieldsLeftByTable.get(inTable);
|
||||||
|
// Mark the field as found and if this table has no more fields to find,
|
||||||
|
// remove it from the "fieldsLeftByTable" map to mark the table as done
|
||||||
|
if (fieldsLeft.remove(fieldName) && fieldsLeft.isEmpty()) {
|
||||||
|
fieldsLeftByTable.remove(inTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// After reading the file, if there were still types, fail
|
||||||
|
if (!fieldsLeftByTable.isEmpty()) {
|
||||||
|
fail(String.format("Markdown file '%s' did not contain expected fields (by table): %s",
|
||||||
|
doc, fieldsLeftByTable));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getTableHeader(String line) {
|
||||||
|
return line.startsWith("###")
|
||||||
|
? line.replace("###", "").trim()
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,837 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 Robert Winkler
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package io.github.robwin.swagger2markup;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import io.github.robwin.markup.builder.MarkupLanguage;
|
|
||||||
import io.github.robwin.swagger2markup.assertions.DiffAssertions;
|
|
||||||
import io.github.robwin.swagger2markup.config.Swagger2MarkupConfig;
|
|
||||||
import io.github.robwin.swagger2markup.extension.Swagger2MarkupExtensionRegistry;
|
|
||||||
import io.github.robwin.swagger2markup.extension.repository.DynamicDefinitionsContentExtension;
|
|
||||||
import io.github.robwin.swagger2markup.extension.repository.DynamicOperationsContentExtension;
|
|
||||||
import io.github.robwin.swagger2markup.extension.repository.SchemaExtension;
|
|
||||||
import io.github.robwin.swagger2markup.extension.repository.SpringRestDocsExtension;
|
|
||||||
import io.swagger.models.Swagger;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
import static org.assertj.core.api.Assertions.fail;
|
|
||||||
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
|
|
||||||
import static org.assertj.core.api.BDDAssertions.assertThat;
|
|
||||||
|
|
||||||
public class Swagger2MarkupConverterTest {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Swagger2MarkupConverterTest.class);
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionFromString() throws IOException {
|
|
||||||
//Given
|
|
||||||
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/yaml/swagger_petstore.yaml"));
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConverter.from(swaggerJsonString).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithSpringRestDocsExtension() throws IOException {
|
|
||||||
//Given
|
|
||||||
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/yaml/swagger_petstore.yaml"));
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
|
||||||
.withExtension(new SpringRestDocsExtension(Paths.get("src/docs/asciidoc/paths").toUri()).withDefaultSnippets())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter.from(swaggerJsonString)
|
|
||||||
.withConfig(config)
|
|
||||||
.withExtensionRegistry(registry)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.adoc"))))
|
|
||||||
.contains("==== HTTP request", "==== HTTP response", "==== Curl request", "===== curl-request");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithExamples() throws IOException {
|
|
||||||
//Given
|
|
||||||
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/json/swagger_examples.json"));
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter.from(swaggerJsonString)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
String orderExample = "----\n" +
|
|
||||||
"{\n" +
|
|
||||||
" \"id\" : 99,\n" +
|
|
||||||
" \"petId\" : 122,\n" +
|
|
||||||
" \"quantity\" : 2,\n" +
|
|
||||||
" \"shipDate\" : \"2016-02-22T23:02:05Z\",\n" +
|
|
||||||
" \"status\" : \"PENDING\",\n" +
|
|
||||||
" \"complete\" : true\n" +
|
|
||||||
"}\n" +
|
|
||||||
"----\n";
|
|
||||||
String petResponseExample = "----\n" +
|
|
||||||
"{\n" +
|
|
||||||
" \"application/json\" : {\n" +
|
|
||||||
" \"name\" : \"Puma\",\n" +
|
|
||||||
" \"type\" : 22,\n" +
|
|
||||||
" \"color\" : \"Black\",\n" +
|
|
||||||
" \"gender\" : \"Female\",\n" +
|
|
||||||
" \"breed\" : \"Mixed\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
"}\n" +
|
|
||||||
"----\n";
|
|
||||||
|
|
||||||
String pathsDocument = new String(Files.readAllBytes(outputDirectory.resolve("paths.adoc")));
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Response 405\n" + petResponseExample);
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Request body\n" + orderExample);
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Response 200\n" + orderExample);
|
|
||||||
|
|
||||||
String definitionsDocument = new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")));
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("|name||true|string||\"doggie\"");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("|id||false|integer(int64)||77");
|
|
||||||
assertThat(definitionsDocument).contains("|pictures||false|string(byte) array||");
|
|
||||||
assertThat(definitionsDocument).contains("|shipDate||false|string(date-time)||");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.doesNotContain("99");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithGeneratedExamples() throws IOException {
|
|
||||||
//Given
|
|
||||||
String swaggerJsonString = IOUtils.toString(getClass().getResourceAsStream("/json/swagger_examples.json"));
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withGeneratedExamples()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter.from(swaggerJsonString)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
String petGeneratedExample = "----\n" +
|
|
||||||
"{\n" +
|
|
||||||
" \"tags\" : [ {\n" +
|
|
||||||
" \"id\" : 0,\n" +
|
|
||||||
" \"name\" : \"string\"\n" +
|
|
||||||
" } ],\n" +
|
|
||||||
" \"id\" : 0,\n" +
|
|
||||||
" \"nicknames\" : {\n" +
|
|
||||||
" \"string\" : \"string\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"category\" : {\n" +
|
|
||||||
" \"id\" : 123,\n" +
|
|
||||||
" \"name\" : \"Canines\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"weight\" : 0.0,\n" +
|
|
||||||
" \"status\" : \"string\",\n" +
|
|
||||||
" \"name\" : \"doggie\",\n" +
|
|
||||||
" \"photoUrls\" : [ \"string\" ]\n" +
|
|
||||||
"}\n" +
|
|
||||||
"----\n";
|
|
||||||
String petResponseExample = "----\n" +
|
|
||||||
"{\n" +
|
|
||||||
" \"application/json\" : {\n" +
|
|
||||||
" \"name\" : \"Puma\",\n" +
|
|
||||||
" \"type\" : 22,\n" +
|
|
||||||
" \"color\" : \"Black\",\n" +
|
|
||||||
" \"gender\" : \"Female\",\n" +
|
|
||||||
" \"breed\" : \"Mixed\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
"}\n" +
|
|
||||||
"----\n";
|
|
||||||
String pathsDocument = new String(Files.readAllBytes(outputDirectory.resolve("paths.adoc")));
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Request body\n" + petGeneratedExample);
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("== Request path\n" + "----\n" +
|
|
||||||
"\"/pets\"\n" +
|
|
||||||
"----");
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Request query\n" +
|
|
||||||
"----\n" +
|
|
||||||
"{\n" +
|
|
||||||
" \"status\" : \"string\"\n" +
|
|
||||||
"}\n" +
|
|
||||||
"----\n");
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Response 405\n" + petResponseExample);
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Response 200\n" +
|
|
||||||
"----\n" +
|
|
||||||
"\"array\"\n" +
|
|
||||||
"----");
|
|
||||||
assertThat(pathsDocument)
|
|
||||||
.contains("==== Request path\n" +
|
|
||||||
"----\n" +
|
|
||||||
"\"/pets/0\"\n" +
|
|
||||||
"----");
|
|
||||||
|
|
||||||
String definitionsDocument = new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")));
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("|name||true|string||\"doggie\"");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("|id||false|integer(int64)||77");
|
|
||||||
assertThat(definitionsDocument).contains("|pictures||false|string(byte) array||[ \"string\" ]");
|
|
||||||
assertThat(definitionsDocument).contains("|shipDate||false|string(date-time)||\"string\"");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.doesNotContain("99");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("|nicknames||false|object||{\n" +
|
|
||||||
" \"string\" : \"string\"\n" +
|
|
||||||
"}");
|
|
||||||
assertThat(definitionsDocument)
|
|
||||||
.contains("[options=\"header\", cols=\".^1h,.^6,.^1,.^1,.^1,.^1\"]\n" +
|
|
||||||
"|===\n" +
|
|
||||||
"|Name|Description|Required|Schema|Default|Example\n" +
|
|
||||||
"|id||false|integer(int64)||0\n" +
|
|
||||||
"|===\n");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionAsString() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
|
|
||||||
//When
|
|
||||||
String asciiDocAsString = Swagger2MarkupConverter.from(file).build()
|
|
||||||
.asString();
|
|
||||||
//Then
|
|
||||||
assertThat(asciiDocAsString).isNotEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversion() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConverter.from(file).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
|
|
||||||
Path actual = outputDirectory.resolve("overview.adoc");
|
|
||||||
Path expected = Paths.get(Swagger2MarkupConverterTest.class.getResource("/results/asciidoc/default/overview.adoc").toURI());
|
|
||||||
|
|
||||||
DiffAssertions.assertThat(actual)
|
|
||||||
.isEqualTo(expected,"testSwagger2AsciiDocConversion.html");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocWithInlineSchema() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_inlineSchema.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withInlineSchemaDepthLevel(1)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] files = outputDirectory.toFile().list();
|
|
||||||
assertThat(files).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocGroupedByTags() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withPathsGroupedBy(GroupBy.TAGS)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocGroupedByTagsWithMissingTag() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/json/swagger_missing_tag.json").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
//When
|
|
||||||
try {
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withPathsGroupedBy(GroupBy.TAGS)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
// If NullPointerException was not thrown, test would fail the specified message
|
|
||||||
failBecauseExceptionWasNotThrown(NullPointerException.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
assertThat(e).hasMessage("Can't GroupBy.TAGS > Operation 'updatePet' has not tags");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithDefinitionDescriptions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withDefinitionDescriptions(Paths.get("src/docs/asciidoc/definitions"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionDoesNotContainUriScheme() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_should_not_contain_uri_scheme.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConverter.from(file).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc"))))
|
|
||||||
.doesNotContain("=== URI scheme");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionContainsUriScheme() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_should_contain_uri_scheme.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConverter.from(file).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc"))))
|
|
||||||
.contains("=== URI scheme");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkdownConversion() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.md", "overview.md", "paths.md", "security.md"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkdownConversionWithDescriptions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withDefinitionDescriptions(Paths.get("src/docs/markdown/definitions"))
|
|
||||||
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(4).containsAll(
|
|
||||||
asList("definitions.md", "overview.md", "paths.md", "security.md"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithSeparatedDefinitions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withSeparatedDefinitions()
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file).withConfig(config).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(5).containsAll(
|
|
||||||
asList("definitions", "definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
|
|
||||||
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
|
||||||
String[] definitions = definitionsDirectory.toFile().list();
|
|
||||||
assertThat(definitions).hasSize(5).containsAll(
|
|
||||||
asList("Category.adoc", "Order.adoc", "Pet.adoc", "Tag.adoc", "User.adoc"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithSeparatedOperations() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withSeparatedOperations()
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file).withConfig(config).build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(5).containsAll(
|
|
||||||
asList("operations", "definitions.adoc", "overview.adoc", "paths.adoc", "security.adoc"));
|
|
||||||
|
|
||||||
Path pathsDirectory = outputDirectory.resolve("operations");
|
|
||||||
String[] paths = pathsDirectory.toFile().list();
|
|
||||||
assertThat(paths).hasSize(18);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkdownConversionWithSeparatedDefinitions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withSeparatedDefinitions()
|
|
||||||
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(5).containsAll(
|
|
||||||
asList("definitions", "definitions.md", "overview.md", "paths.md", "security.md"));
|
|
||||||
|
|
||||||
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
|
||||||
String[] definitions = definitionsDirectory.toFile().list();
|
|
||||||
assertThat(definitions).hasSize(5).containsAll(
|
|
||||||
asList("Category.md", "Order.md", "Pet.md", "Tag.md", "User.md"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkdownConversionHandlesComposition() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withSeparatedDefinitions()
|
|
||||||
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
// Then
|
|
||||||
String[] directories = outputDirectory.toFile().list();
|
|
||||||
assertThat(directories).hasSize(5).containsAll(
|
|
||||||
asList("definitions", "definitions.md", "overview.md", "paths.md", "security.md"));
|
|
||||||
Path definitionsDirectory = outputDirectory.resolve("definitions");
|
|
||||||
verifyMarkdownContainsFieldsInTables(
|
|
||||||
definitionsDirectory.resolve("User.md").toFile(),
|
|
||||||
ImmutableMap.<String, Set<String>>builder()
|
|
||||||
.put("User", ImmutableSet.of("id", "username", "firstName",
|
|
||||||
"lastName", "email", "password", "phone", "userStatus"))
|
|
||||||
.build()
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithRussianOutputLanguage() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withOutputLanguage(Language.RU)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")), Charset.forName("UTF-8")))
|
|
||||||
.contains("== Определения");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocConversionWithFrenchOutputLanguage() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withOutputLanguage(Language.FR)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("overview.adoc")), Charset.forName("UTF-8")))
|
|
||||||
.contains("== Sch\u00E9ma d'URI");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocDynamicContentExtensions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
|
||||||
.withExtension(new DynamicDefinitionsContentExtension(Paths.get("src/docs/asciidoc/extensions")))
|
|
||||||
.withExtension(new DynamicOperationsContentExtension(Paths.get("src/docs/asciidoc/extensions")))
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.withExtensionRegistry(registry)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.adoc")))).contains(
|
|
||||||
"Pet update request extension");
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")))).contains(
|
|
||||||
"Pet extension");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkdownDynamicContentExtensions() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/markdown/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withMarkupLanguage(MarkupLanguage.MARKDOWN)
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
|
||||||
.withExtension(new DynamicDefinitionsContentExtension(Paths.get("src/docs/markdown/extensions")))
|
|
||||||
.withExtension(new DynamicOperationsContentExtension(Paths.get("src/docs/markdown/extensions")))
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.withExtensionRegistry(registry)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("paths.md")))).contains(
|
|
||||||
"Pet update request extension");
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.md")))).contains(
|
|
||||||
"Pet extension");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkupConfigDefaultPaths() throws URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withDefinitionDescriptions()
|
|
||||||
.withOperationDescriptions()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter converterBuilder = Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
//Then
|
|
||||||
URI baseUri = io.github.robwin.swagger2markup.utils.IOUtils.uriParent(converterBuilder.globalContext.swaggerLocation);
|
|
||||||
assertThat(converterBuilder.globalContext.config.getDefinitionDescriptionsUri()).isEqualTo(baseUri);
|
|
||||||
assertThat(converterBuilder.globalContext.config.getOperationDescriptionsUri()).isEqualTo(baseUri);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkupConfigDefaultPathsWithUri() throws MalformedURLException {
|
|
||||||
//Given
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withDefinitionDescriptions()
|
|
||||||
.withOperationDescriptions()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Swagger2MarkupConverter converterBuilder = Swagger2MarkupConverter.from(URI.create("http://petstore.swagger.io/v2/swagger.json").toURL())
|
|
||||||
.withConfig(config)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(converterBuilder.globalContext.config.getDefinitionDescriptionsUri()).isNull();
|
|
||||||
assertThat(converterBuilder.globalContext.config.getOperationDescriptionsUri()).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2MarkupConfigDefaultPathsWithoutFile() {
|
|
||||||
//Given
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.withDefinitionDescriptions()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
//Then
|
|
||||||
Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(new Swagger())
|
|
||||||
.withConfig(config)
|
|
||||||
.build();
|
|
||||||
assertThat(converter.globalContext.config.isDefinitionDescriptionsEnabled()).isFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSwagger2AsciiDocSchemaExtension() throws IOException, URISyntaxException {
|
|
||||||
//Given
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
Path outputDirectory = Paths.get("build/docs/asciidoc/generated");
|
|
||||||
FileUtils.deleteQuietly(outputDirectory.toFile());
|
|
||||||
|
|
||||||
//When
|
|
||||||
Swagger2MarkupConfig config = Swagger2MarkupConfig.ofDefaults()
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupExtensionRegistry registry = Swagger2MarkupExtensionRegistry.ofEmpty()
|
|
||||||
.withExtension(new SchemaExtension(Paths.get("src/docs/asciidoc/extensions").toUri()))
|
|
||||||
.build();
|
|
||||||
Swagger2MarkupConverter.from(file)
|
|
||||||
.withConfig(config)
|
|
||||||
.withExtensionRegistry(registry)
|
|
||||||
.build()
|
|
||||||
.intoFolder(outputDirectory);
|
|
||||||
|
|
||||||
//Then
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")))).contains(
|
|
||||||
"=== Pet");
|
|
||||||
assertThat(new String(Files.readAllBytes(outputDirectory.resolve("definitions.adoc")))).contains(
|
|
||||||
"==== XML Schema");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a markdown document to search, this checks to see if the specified tables
|
|
||||||
* have all of the expected fields listed.
|
|
||||||
*
|
|
||||||
* @param doc markdown document file to inspect
|
|
||||||
* @param fieldsByTable map of table name (header) to field names expected
|
|
||||||
* to be found in that table.
|
|
||||||
* @throws IOException if the markdown document could not be read
|
|
||||||
*/
|
|
||||||
private static void verifyMarkdownContainsFieldsInTables(File doc, Map<String, Set<String>> fieldsByTable) throws IOException {
|
|
||||||
final List<String> lines = Files.readAllLines(doc.toPath(), Charset.defaultCharset());
|
|
||||||
final Map<String, Set<String>> fieldsLeftByTable = Maps.newHashMap();
|
|
||||||
for (Map.Entry<String, Set<String>> entry : fieldsByTable.entrySet()) {
|
|
||||||
fieldsLeftByTable.put(entry.getKey(), Sets.newHashSet(entry.getValue()));
|
|
||||||
}
|
|
||||||
String inTable = null;
|
|
||||||
for (String line : lines) {
|
|
||||||
// If we've found every field we care about, quit early
|
|
||||||
if (fieldsLeftByTable.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transition to a new table if we encounter a header
|
|
||||||
final String currentHeader = getTableHeader(line);
|
|
||||||
if (inTable == null || currentHeader != null) {
|
|
||||||
inTable = currentHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're in a table that we care about, inspect this potential table row
|
|
||||||
if (inTable != null && fieldsLeftByTable.containsKey(inTable)) {
|
|
||||||
// If we're still in a table, read the row and check for the field name
|
|
||||||
// NOTE: If there was at least one pipe, then there's at least 2 fields
|
|
||||||
String[] parts = line.split("\\|");
|
|
||||||
if (parts.length > 1) {
|
|
||||||
final String fieldName = parts[1];
|
|
||||||
final Set<String> fieldsLeft = fieldsLeftByTable.get(inTable);
|
|
||||||
// Mark the field as found and if this table has no more fields to find,
|
|
||||||
// remove it from the "fieldsLeftByTable" map to mark the table as done
|
|
||||||
if (fieldsLeft.remove(fieldName) && fieldsLeft.isEmpty()) {
|
|
||||||
fieldsLeftByTable.remove(inTable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// After reading the file, if there were still types, fail
|
|
||||||
if (!fieldsLeftByTable.isEmpty()) {
|
|
||||||
fail(String.format("Markdown file '%s' did not contain expected fields (by table): %s",
|
|
||||||
doc, fieldsLeftByTable));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getTableHeader(String line) {
|
|
||||||
return line.startsWith("###")
|
|
||||||
? line.replace("###", "").trim()
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testSwagger2HtmlConversion() throws IOException {
|
|
||||||
Path file = Paths.get(Swagger2MarkupConverterTest.class.getResource("/yaml/swagger_petstore.yaml").toURI());
|
|
||||||
String asciiDoc = Swagger2MarkupConverter.from(file).build().asString();
|
|
||||||
String path = "build/docs/generated/asciidocAsString";
|
|
||||||
Files.createDirectories(Paths.get(path));
|
|
||||||
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "swagger.adoc"), StandardCharsets.UTF_8)){
|
|
||||||
writer.write(asciiDoc); }
|
|
||||||
String asciiDocAsHtml = Asciidoctor.Factory.create().convert(asciiDoc,
|
|
||||||
OptionsBuilder.options().backend("html5").headerFooter(true).safe(SafeMode.UNSAFE).docType("book").attributes(AttributesBuilder.attributes()
|
|
||||||
.tableOfContents(true).tableOfContents(Placement.LEFT).sectionNumbers(true).hardbreaks(true).setAnchors(true).attribute("sectlinks")));
|
|
||||||
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "swagger.html"), StandardCharsets.UTF_8)){
|
|
||||||
writer.write(asciiDocAsHtml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2015 Robert Winkler
|
* Copyright 2016 Robert Winkler
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -28,7 +28,6 @@ import java.io.IOException;
|
|||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@@ -43,17 +42,17 @@ public class DiffAssert extends AbstractAssert<DiffAssert, Path>{
|
|||||||
* Verifies that the content of the actual File is equal to the given one.
|
* Verifies that the content of the actual File is equal to the given one.
|
||||||
*
|
*
|
||||||
* @param expected the given value to compare the actual value to.
|
* @param expected the given value to compare the actual value to.
|
||||||
* @param reportName the name of the report which should be generated if the files differ.
|
* @param reportPath the path to the report which should be generated if the files differ.
|
||||||
* @return {@code this} assertion object.
|
* @return {@code this} assertion object.
|
||||||
* @throws AssertionError if the actual value is not equal to the given one or if the actual value is {@code null}..
|
* @throws AssertionError if the actual value is not equal to the given one or if the actual value is {@code null}..
|
||||||
*/
|
*/
|
||||||
public DiffAssert isEqualTo(Path expected, String reportName) {
|
public DiffAssert isEqualTo(Path expected, Path reportPath) {
|
||||||
LinkedList<DiffMatchPatch.Diff> diffs = diff(actual, expected);
|
LinkedList<DiffMatchPatch.Diff> diffs = diff(actual, expected);
|
||||||
boolean allDiffsAreEqual = assertThatAllDiffsAreEqual(diffs);
|
boolean allDiffsAreEqual = assertThatAllDiffsAreEqual(diffs);
|
||||||
if(!allDiffsAreEqual){
|
if(!allDiffsAreEqual){
|
||||||
writeHtmlReport(reportName, diffs);
|
writeHtmlReport(reportPath, diffs);
|
||||||
}
|
}
|
||||||
assertThat(allDiffsAreEqual).as("The content of the files differ. Check the HTML report for more details.").isTrue();
|
assertThat(allDiffsAreEqual).as("The content of the following files differ. Actual: %s, Expected %s. Check the HTML report for more details: %s", actual.toAbsolutePath(), expected.toAbsolutePath(), reportPath.toAbsolutePath()).isTrue();
|
||||||
return myself;
|
return myself;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,16 +74,15 @@ public class DiffAssert extends AbstractAssert<DiffAssert, Path>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void writeHtmlReport(String reportName, LinkedList<DiffMatchPatch.Diff> diffs){
|
private static void writeHtmlReport(Path reportPath, LinkedList<DiffMatchPatch.Diff> diffs){
|
||||||
DiffMatchPatch differ = new DiffMatchPatch();
|
DiffMatchPatch differ = new DiffMatchPatch();
|
||||||
String reportFolder = "build/diff-report";
|
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(Paths.get(reportFolder));
|
Files.createDirectories(reportPath.getParent());
|
||||||
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(reportFolder, reportName), Charset.forName("UTF-8"))) {
|
try (BufferedWriter writer = Files.newBufferedWriter(reportPath, Charset.forName("UTF-8"))) {
|
||||||
writer.write(differ.diff_prettyHtml(diffs));
|
writer.write(differ.diff_prettyHtml(diffs));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException(String.format("Failed to write report into folder %s", reportFolder), e);
|
throw new RuntimeException(String.format("Failed to write report %s", reportPath.toAbsolutePath()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Copyright 2015 Robert Winkler
|
* Copyright 2016 Robert Winkler
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2016 Robert Winkler
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package io.github.robwin.swagger2markup.assertions;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.DirectoryStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
public class DiffUtils {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(DiffUtils.class);
|
||||||
|
|
||||||
|
public static void assertThatAllFilesAreEqual(Path actualDirectory, Path expectedDirectory, String reportName) {
|
||||||
|
Path reportPath = Paths.get("build/diff-report/", reportName);
|
||||||
|
try {
|
||||||
|
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(actualDirectory)) {
|
||||||
|
for (Path actualFile : directoryStream) {
|
||||||
|
Path expectedFile = expectedDirectory.resolve(actualFile.getFileName());
|
||||||
|
LOGGER.info("Diffing file {} with {}", actualFile, expectedFile);
|
||||||
|
DiffAssertions.assertThat(actualFile).isEqualTo(expectedFile, reportPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Failed to assert that all files are equal", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,8 +46,8 @@ public class Swagger2MarkupConfigTest {
|
|||||||
assertThat(config.getInlineSchemaDepthLevel()).isEqualTo(0);
|
assertThat(config.getInlineSchemaDepthLevel()).isEqualTo(0);
|
||||||
assertThat(config.getInterDocumentCrossReferencesPrefix()).isNull();
|
assertThat(config.getInterDocumentCrossReferencesPrefix()).isNull();
|
||||||
assertThat(config.getMarkupLanguage()).isEqualTo(MarkupLanguage.ASCIIDOC);
|
assertThat(config.getMarkupLanguage()).isEqualTo(MarkupLanguage.ASCIIDOC);
|
||||||
assertThat(config.getOperationOrderBy()).isEqualTo(OrderBy.AS_IS);
|
assertThat(config.getOperationOrderBy()).isEqualTo(OrderBy.NATURAL);
|
||||||
assertThat(config.getOperationOrdering()).isNull();
|
assertThat(config.getOperationOrdering()).isNotNull();
|
||||||
assertThat(config.getOutputLanguage()).isEqualTo(Language.EN);
|
assertThat(config.getOutputLanguage()).isEqualTo(Language.EN);
|
||||||
assertThat(config.getOverviewDocument()).isEqualTo("overview");
|
assertThat(config.getOverviewDocument()).isEqualTo("overview");
|
||||||
assertThat(config.getParameterOrderBy()).isEqualTo(OrderBy.NATURAL);
|
assertThat(config.getParameterOrderBy()).isEqualTo(OrderBy.NATURAL);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Required|Schema|Default|Example
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|id||false|integer(int64)||0
|
|id||false|integer(int64)||
|
||||||
|name||false|string||string
|
|name||false|string||
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Required|Schema|Default|Example
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|complete||false|boolean||true
|
|complete||false|boolean||
|
||||||
|id||false|integer(int64)||0
|
|id||false|integer(int64)||
|
||||||
|petId||false|integer(int64)||0
|
|petId||false|integer(int64)||
|
||||||
|quantity||false|integer(int32)||0
|
|quantity||false|integer(int32)||
|
||||||
|shipDate||false|string(date-time)||string
|
|shipDate||false|string(date-time)||
|
||||||
|status|Order Status|false|string||string
|
|status|Order Status|false|string||
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -31,12 +31,12 @@
|
|||||||
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Required|Schema|Default|Example
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|category||false|<<_category,Category>>||<<_category>>
|
|category||false|<<_category,Category>>||
|
||||||
|id||false|integer(int64)||0
|
|id||false|integer(int64)||
|
||||||
|name||true|string||doggie
|
|name||true|string||"doggie"
|
||||||
|photoUrls||true|string array||[ string ]
|
|photoUrls||true|string array||
|
||||||
|status|pet status in the store|false|string||string
|
|status|pet status in the store|false|string||
|
||||||
|tags||false|<<_tag,Tag>> array||[ <<_tag>> ]
|
|tags||false|<<_tag,Tag>> array||
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Required|Schema|Default|Example
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|id||false|integer(int64)||0
|
|id||false|integer(int64)||
|
||||||
|name||false|string||string
|
|name||false|string||
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -55,14 +55,14 @@
|
|||||||
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Name|Description|Required|Schema|Default|Example
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|email||false|string||string
|
|email||false|string||
|
||||||
|firstName||false|string||string
|
|firstName||false|string||
|
||||||
|id||false|integer(int64)||0
|
|id||false|integer(int64)||
|
||||||
|lastName||false|string||string
|
|lastName||false|string||
|
||||||
|password||false|string||string
|
|password||false|string||
|
||||||
|phone||false|string||string
|
|phone||false|string||
|
||||||
|userStatus|User Status|false|integer(int32)||0
|
|userStatus|User Status|false|integer(int32)||
|
||||||
|username||false|string||string
|
|username||false|string||
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -204,51 +204,6 @@ Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3
|
|||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
=== Deletes a pet
|
|
||||||
----
|
|
||||||
DELETE /pets/{petId}
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
==== Parameters
|
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
|
||||||
|===
|
|
||||||
|Type|Name|Description|Required|Schema|Default
|
|
||||||
|Header|api_key||true|string|
|
|
||||||
|Path|petId|Pet id to delete|true|integer(int64)|
|
|
||||||
|===
|
|
||||||
|
|
||||||
|
|
||||||
==== Responses
|
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
|
||||||
|===
|
|
||||||
|HTTP Code|Description|Headers|Schema
|
|
||||||
|400|Invalid pet value|No Content
|
|
||||||
|===
|
|
||||||
|
|
||||||
|
|
||||||
==== Produces
|
|
||||||
|
|
||||||
* application/json
|
|
||||||
* application/xml
|
|
||||||
|
|
||||||
|
|
||||||
==== Tags
|
|
||||||
|
|
||||||
* pet
|
|
||||||
|
|
||||||
|
|
||||||
==== Security
|
|
||||||
|
|
||||||
[options="header", cols=".^1,.^1h,.^6"]
|
|
||||||
|===
|
|
||||||
|Type|Name|Scopes
|
|
||||||
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
|
||||||
|===
|
|
||||||
|
|
||||||
|
|
||||||
=== Updates a pet in the store with form data
|
=== Updates a pet in the store with form data
|
||||||
----
|
----
|
||||||
POST /pets/{petId}
|
POST /pets/{petId}
|
||||||
@@ -352,6 +307,51 @@ Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error cond
|
|||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Deletes a pet
|
||||||
|
----
|
||||||
|
DELETE /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Header|api_key||true|string|
|
||||||
|
|Path|petId|Pet id to delete|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid pet value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
=== Place an order for a pet
|
=== Place an order for a pet
|
||||||
----
|
----
|
||||||
POST /stores/order
|
POST /stores/order
|
||||||
@@ -388,47 +388,6 @@ POST /stores/order
|
|||||||
* store
|
* store
|
||||||
|
|
||||||
|
|
||||||
=== Delete purchase order by ID
|
|
||||||
----
|
|
||||||
DELETE /stores/order/{orderId}
|
|
||||||
----
|
|
||||||
|
|
||||||
|
|
||||||
==== Description
|
|
||||||
[%hardbreaks]
|
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
|
|
||||||
|
|
||||||
==== Parameters
|
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
|
||||||
|===
|
|
||||||
|Type|Name|Description|Required|Schema|Default
|
|
||||||
|Path|orderId|ID of the order that needs to be deleted|true|string|
|
|
||||||
|===
|
|
||||||
|
|
||||||
|
|
||||||
==== Responses
|
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
|
||||||
|===
|
|
||||||
|HTTP Code|Description|Headers|Schema
|
|
||||||
|400|Invalid ID supplied|No Content
|
|
||||||
|404|Order not found|No Content
|
|
||||||
|===
|
|
||||||
|
|
||||||
|
|
||||||
==== Produces
|
|
||||||
|
|
||||||
* application/json
|
|
||||||
* application/xml
|
|
||||||
|
|
||||||
|
|
||||||
==== Tags
|
|
||||||
|
|
||||||
* store
|
|
||||||
|
|
||||||
|
|
||||||
=== Find purchase order by ID
|
=== Find purchase order by ID
|
||||||
----
|
----
|
||||||
GET /stores/order/{orderId}
|
GET /stores/order/{orderId}
|
||||||
@@ -471,6 +430,47 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
|
|||||||
* store
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
=== Delete purchase order by ID
|
||||||
|
----
|
||||||
|
DELETE /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of the order that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
=== Create user
|
=== Create user
|
||||||
----
|
----
|
||||||
POST /users
|
POST /users
|
||||||
@@ -644,23 +644,18 @@ GET /users/logout
|
|||||||
* user
|
* user
|
||||||
|
|
||||||
|
|
||||||
=== Delete user
|
=== Get user by user name
|
||||||
----
|
----
|
||||||
DELETE /users/{username}
|
GET /users/{username}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
==== Description
|
|
||||||
[%hardbreaks]
|
|
||||||
This can only be done by the logged in user.
|
|
||||||
|
|
||||||
|
|
||||||
==== Parameters
|
==== Parameters
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Type|Name|Description|Required|Schema|Default
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|Path|username|The name that needs to be deleted|true|string|
|
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -669,6 +664,7 @@ This can only be done by the logged in user.
|
|||||||
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|===
|
|===
|
||||||
|HTTP Code|Description|Headers|Schema
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_user,User>>
|
||||||
|400|Invalid username supplied|No Content
|
|400|Invalid username supplied|No Content
|
||||||
|404|User not found|No Content
|
|404|User not found|No Content
|
||||||
|===
|
|===
|
||||||
@@ -727,18 +723,23 @@ This can only be done by the logged in user.
|
|||||||
* user
|
* user
|
||||||
|
|
||||||
|
|
||||||
=== Get user by user name
|
=== Delete user
|
||||||
----
|
----
|
||||||
GET /users/{username}
|
DELETE /users/{username}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
==== Parameters
|
==== Parameters
|
||||||
|
|
||||||
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|===
|
|===
|
||||||
|Type|Name|Description|Required|Schema|Default
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string|
|
|Path|username|The name that needs to be deleted|true|string|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|
||||||
@@ -747,7 +748,6 @@ GET /users/{username}
|
|||||||
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|===
|
|===
|
||||||
|HTTP Code|Description|Headers|Schema
|
|HTTP Code|Description|Headers|Schema
|
||||||
|200|successful operation|<<_user,User>>
|
|
||||||
|400|Invalid username supplied|No Content
|
|400|Invalid username supplied|No Content
|
||||||
|404|User not found|No Content
|
|404|User not found|No Content
|
||||||
|===
|
|===
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
[[_definitions]]
|
||||||
|
== Definitions
|
||||||
|
|
||||||
|
=== Category
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||123
|
||||||
|
|name||false|string||"Canines"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Identified
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Order
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|complete||false|boolean||
|
||||||
|
|id||false|integer(int64)||77
|
||||||
|
|petId||false|integer(int64)||
|
||||||
|
|quantity||false|integer(int32)||
|
||||||
|
|shipDate||false|string(date-time)||
|
||||||
|
|status|Order Status|false|string||"DONE"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Pet
|
||||||
|
[%hardbreaks]
|
||||||
|
Test description
|
||||||
|
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|category||false|<<_category,Category>>||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||true|string||"doggie"
|
||||||
|
|nicknames||false|object||
|
||||||
|
|photoUrls||true|string array||
|
||||||
|
|status|pet status in the store|false|string||
|
||||||
|
|tags||false|<<_tag,Tag>> array||
|
||||||
|
|weight|the weight of the pet|false|number||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Tag
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== User
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|email||false|string||
|
||||||
|
|firstName||false|string||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|lastName||false|string||
|
||||||
|
|password||false|string||
|
||||||
|
|phone||false|string||
|
||||||
|
|pictures||false|string(byte) array||
|
||||||
|
|userStatus|User Status|false|integer(int32)||
|
||||||
|
|username||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
36
src/test/resources/results/asciidoc/examples/overview.adoc
Normal file
36
src/test/resources/results/asciidoc/examples/overview.adoc
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
= Swagger Petstore API
|
||||||
|
|
||||||
|
|
||||||
|
[[_overview]]
|
||||||
|
== Overview
|
||||||
|
This is a sample server Petstore server.
|
||||||
|
|
||||||
|
[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net.
|
||||||
|
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||||
|
|
||||||
|
|
||||||
|
=== Version information
|
||||||
|
Version : 1.0.0
|
||||||
|
|
||||||
|
=== Contact information
|
||||||
|
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/
|
||||||
|
|
||||||
|
=== URI scheme
|
||||||
|
Host : petstore.swagger.wordnik.com
|
||||||
|
BasePath : /v2
|
||||||
|
Schemes : HTTP
|
||||||
|
|
||||||
|
=== Tags
|
||||||
|
|
||||||
|
* pet : Pet resource
|
||||||
|
* store : Store resource
|
||||||
|
* user : User resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
828
src/test/resources/results/asciidoc/examples/paths.adoc
Normal file
828
src/test/resources/results/asciidoc/examples/paths.adoc
Normal file
@@ -0,0 +1,828 @@
|
|||||||
|
|
||||||
|
[[_paths]]
|
||||||
|
== Paths
|
||||||
|
|
||||||
|
=== Add a new pet to the store
|
||||||
|
----
|
||||||
|
POST /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Example HTTP response
|
||||||
|
|
||||||
|
==== Response 405
|
||||||
|
----
|
||||||
|
{
|
||||||
|
"application/json" : {
|
||||||
|
"name" : "Puma",
|
||||||
|
"type" : 22,
|
||||||
|
"color" : "Black",
|
||||||
|
"gender" : "Female",
|
||||||
|
"breed" : "Mixed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
=== Update an existing pet
|
||||||
|
----
|
||||||
|
PUT /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|405|Validation exception|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Finds Pets by status
|
||||||
|
----
|
||||||
|
GET /pets/findByStatus
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|status|Status values that need to be considered for filter|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid status value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Finds Pets by tags
|
||||||
|
----
|
||||||
|
GET /pets/findByTags
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|tags|Tags to filter by|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid tag value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Updates a pet in the store with form data
|
||||||
|
----
|
||||||
|
POST /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of pet that needs to be updated|true|string|
|
||||||
|
|FormData|name|Updated name of the pet|true|string|
|
||||||
|
|FormData|status|Updated status of the pet|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Find pet by ID
|
||||||
|
----
|
||||||
|
GET /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of the pet|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|apiKey|<<_api_key,api_key>>|
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Deletes a pet
|
||||||
|
----
|
||||||
|
DELETE /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Header|api_key||true|string|
|
||||||
|
|Path|petId|Pet id to delete|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid pet value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Place an order for a pet
|
||||||
|
----
|
||||||
|
POST /stores/order
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|order placed for purchasing the pet|false|<<_order,Order>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid Order|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
==== Example HTTP request
|
||||||
|
|
||||||
|
==== Request body
|
||||||
|
----
|
||||||
|
{
|
||||||
|
"id" : 99,
|
||||||
|
"petId" : 122,
|
||||||
|
"quantity" : 2,
|
||||||
|
"shipDate" : "2016-02-22T23:02:05Z",
|
||||||
|
"status" : "PENDING",
|
||||||
|
"complete" : true
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Example HTTP response
|
||||||
|
|
||||||
|
==== Response 200
|
||||||
|
----
|
||||||
|
{
|
||||||
|
"id" : 99,
|
||||||
|
"petId" : 122,
|
||||||
|
"quantity" : 2,
|
||||||
|
"shipDate" : "2016-02-22T23:02:05Z",
|
||||||
|
"status" : "PENDING",
|
||||||
|
"complete" : true
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
=== Find purchase order by ID
|
||||||
|
----
|
||||||
|
GET /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of pet that needs to be fetched|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
==== Example HTTP response
|
||||||
|
|
||||||
|
==== Response 200
|
||||||
|
----
|
||||||
|
{
|
||||||
|
"id" : 99,
|
||||||
|
"petId" : 122,
|
||||||
|
"quantity" : 2,
|
||||||
|
"shipDate" : "2016-02-22T23:02:05Z",
|
||||||
|
"status" : "PENDING",
|
||||||
|
"complete" : true
|
||||||
|
}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
=== Delete purchase order by ID
|
||||||
|
----
|
||||||
|
DELETE /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of the order that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
=== Create user
|
||||||
|
----
|
||||||
|
POST /users
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Created user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithArray
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithList
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Logs user into the system
|
||||||
|
----
|
||||||
|
GET /users/login
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|password|The password for login in clear text|false|string|testPassword
|
||||||
|
|Query|username|The user name for login|false|string|testUser
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|string
|
||||||
|
|400|Invalid username/password supplied|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Logs out current logged in user session
|
||||||
|
----
|
||||||
|
GET /users/logout
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Get user by user name
|
||||||
|
----
|
||||||
|
GET /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string|testUser
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_user,User>>
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Updated user
|
||||||
|
----
|
||||||
|
PUT /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|name that need to be deleted|true|string|
|
||||||
|
|Body|body|Updated user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid user supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Delete user
|
||||||
|
----
|
||||||
|
DELETE /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
src/test/resources/results/asciidoc/examples/security.adoc
Normal file
23
src/test/resources/results/asciidoc/examples/security.adoc
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
[[_security]]
|
||||||
|
== Security
|
||||||
|
|
||||||
|
=== api_key
|
||||||
|
Type : apiKey
|
||||||
|
Name : api_key
|
||||||
|
In : HEADER
|
||||||
|
|
||||||
|
=== petstore_auth
|
||||||
|
Type : oauth2
|
||||||
|
Flow : implicit
|
||||||
|
Token URL : http://petstore.swagger.wordnik.com/api/oauth/dialog
|
||||||
|
|
||||||
|
[options="header", cols="1,6"]
|
||||||
|
|===
|
||||||
|
|Name|Description
|
||||||
|
|write_pets|modify pets in your account
|
||||||
|
|read_pets|read your pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
|
||||||
|
[[_definitions]]
|
||||||
|
== Definitions
|
||||||
|
|
||||||
|
=== Category
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||123
|
||||||
|
|name||false|string||"Canines"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Identified
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||0
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Order
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|complete||false|boolean||true
|
||||||
|
|id||false|integer(int64)||77
|
||||||
|
|petId||false|integer(int64)||0
|
||||||
|
|quantity||false|integer(int32)||0
|
||||||
|
|shipDate||false|string(date-time)||"string"
|
||||||
|
|status|Order Status|false|string||"DONE"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Pet
|
||||||
|
[%hardbreaks]
|
||||||
|
Test description
|
||||||
|
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|category||false|<<_category,Category>>||"<<_category>>"
|
||||||
|
|id||false|integer(int64)||0
|
||||||
|
|name||true|string||"doggie"
|
||||||
|
|nicknames||false|object||{
|
||||||
|
"string" : "string"
|
||||||
|
}
|
||||||
|
|photoUrls||true|string array||[ "string" ]
|
||||||
|
|status|pet status in the store|false|string||"string"
|
||||||
|
|tags||false|<<_tag,Tag>> array||[ "<<_tag>>" ]
|
||||||
|
|weight|the weight of the pet|false|number||0.0
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Tag
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||0
|
||||||
|
|name||false|string||"string"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== User
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|email||false|string||"string"
|
||||||
|
|firstName||false|string||"string"
|
||||||
|
|id||false|integer(int64)||0
|
||||||
|
|lastName||false|string||"string"
|
||||||
|
|password||false|string||"string"
|
||||||
|
|phone||false|string||"string"
|
||||||
|
|pictures||false|string(byte) array||[ "string" ]
|
||||||
|
|userStatus|User Status|false|integer(int32)||0
|
||||||
|
|username||false|string||"string"
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
= Swagger Petstore API
|
||||||
|
|
||||||
|
|
||||||
|
[[_overview]]
|
||||||
|
== Overview
|
||||||
|
This is a sample server Petstore server.
|
||||||
|
|
||||||
|
[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net.
|
||||||
|
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||||
|
|
||||||
|
|
||||||
|
=== Version information
|
||||||
|
Version : 1.0.0
|
||||||
|
|
||||||
|
=== Contact information
|
||||||
|
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/
|
||||||
|
|
||||||
|
=== URI scheme
|
||||||
|
Host : petstore.swagger.wordnik.com
|
||||||
|
BasePath : /v2
|
||||||
|
Schemes : HTTP
|
||||||
|
|
||||||
|
=== Tags
|
||||||
|
|
||||||
|
* pet : Pet resource
|
||||||
|
* store : Store resource
|
||||||
|
* user : User resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1184
src/test/resources/results/asciidoc/generated_examples/paths.adoc
Normal file
1184
src/test/resources/results/asciidoc/generated_examples/paths.adoc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
[[_security]]
|
||||||
|
== Security
|
||||||
|
|
||||||
|
=== api_key
|
||||||
|
Type : apiKey
|
||||||
|
Name : api_key
|
||||||
|
In : HEADER
|
||||||
|
|
||||||
|
=== petstore_auth
|
||||||
|
Type : oauth2
|
||||||
|
Flow : implicit
|
||||||
|
Token URL : http://petstore.swagger.wordnik.com/api/oauth/dialog
|
||||||
|
|
||||||
|
[options="header", cols="1,6"]
|
||||||
|
|===
|
||||||
|
|Name|Description
|
||||||
|
|write_pets|modify pets in your account
|
||||||
|
|read_pets|read your pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
[[_definitions]]
|
||||||
|
== Definitions
|
||||||
|
|
||||||
|
=== Category
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Order
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|complete||false|boolean||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|petId||false|integer(int64)||
|
||||||
|
|quantity||false|integer(int32)||
|
||||||
|
|shipDate||false|string(date-time)||
|
||||||
|
|status|Order Status|false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Pet
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|category||false|<<_category,Category>>||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||true|string||"doggie"
|
||||||
|
|photoUrls||true|string array||
|
||||||
|
|status|pet status in the store|false|string||
|
||||||
|
|tags||false|<<_tag,Tag>> array||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Tag
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== User
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|email||false|string||
|
||||||
|
|firstName||false|string||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|lastName||false|string||
|
||||||
|
|password||false|string||
|
||||||
|
|phone||false|string||
|
||||||
|
|userStatus|User Status|false|integer(int32)||
|
||||||
|
|username||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
= Swagger Petstore
|
||||||
|
|
||||||
|
|
||||||
|
[[_overview]]
|
||||||
|
== Overview
|
||||||
|
This is a sample server Petstore server.
|
||||||
|
|
||||||
|
[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.
|
||||||
|
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||||
|
|
||||||
|
|
||||||
|
=== Version information
|
||||||
|
Version : 1.0.0
|
||||||
|
|
||||||
|
=== Contact information
|
||||||
|
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/
|
||||||
|
|
||||||
|
=== URI scheme
|
||||||
|
Host : petstore.swagger.io
|
||||||
|
BasePath : /v2
|
||||||
|
Schemes : HTTP
|
||||||
|
|
||||||
|
=== Tags
|
||||||
|
|
||||||
|
* pet : Pet resource
|
||||||
|
* store : Store resource
|
||||||
|
* user : User resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
692
src/test/resources/results/asciidoc/group_by_tags/paths.adoc
Normal file
692
src/test/resources/results/asciidoc/group_by_tags/paths.adoc
Normal file
@@ -0,0 +1,692 @@
|
|||||||
|
|
||||||
|
[[_paths]]
|
||||||
|
== Resources
|
||||||
|
|
||||||
|
=== Pet
|
||||||
|
[%hardbreaks]
|
||||||
|
Pet resource
|
||||||
|
|
||||||
|
|
||||||
|
==== Add a new pet to the store
|
||||||
|
----
|
||||||
|
POST /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Update an existing pet
|
||||||
|
----
|
||||||
|
PUT /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|405|Validation exception|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Finds Pets by status
|
||||||
|
----
|
||||||
|
GET /pets/findByStatus
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|status|Status values that need to be considered for filter|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid status value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Finds Pets by tags
|
||||||
|
----
|
||||||
|
GET /pets/findByTags
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|tags|Tags to filter by|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid tag value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Updates a pet in the store with form data
|
||||||
|
----
|
||||||
|
POST /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of pet that needs to be updated|true|string|
|
||||||
|
|FormData|name|Updated name of the pet|true|string|
|
||||||
|
|FormData|status|Updated status of the pet|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Consumes
|
||||||
|
|
||||||
|
* application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Find pet by ID
|
||||||
|
----
|
||||||
|
GET /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of pet that needs to be fetched|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|apiKey|<<_api_key,api_key>>|
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Deletes a pet
|
||||||
|
----
|
||||||
|
DELETE /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Header|api_key||true|string|
|
||||||
|
|Path|petId|Pet id to delete|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid pet value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
===== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Store
|
||||||
|
[%hardbreaks]
|
||||||
|
Store resource
|
||||||
|
|
||||||
|
|
||||||
|
==== Place an order for a pet
|
||||||
|
----
|
||||||
|
POST /stores/order
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|order placed for purchasing the pet|false|<<_order,Order>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid Order|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Find purchase order by ID
|
||||||
|
----
|
||||||
|
GET /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of pet that needs to be fetched|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Delete purchase order by ID
|
||||||
|
----
|
||||||
|
DELETE /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of the order that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
=== User
|
||||||
|
[%hardbreaks]
|
||||||
|
User resource
|
||||||
|
|
||||||
|
|
||||||
|
==== Create user
|
||||||
|
----
|
||||||
|
POST /users
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Created user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithArray
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithList
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Logs user into the system
|
||||||
|
----
|
||||||
|
GET /users/login
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|password|The password for login in clear text|false|string|
|
||||||
|
|Query|username|The user name for login|false|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|string
|
||||||
|
|400|Invalid username/password supplied|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Logs out current logged in user session
|
||||||
|
----
|
||||||
|
GET /users/logout
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Get user by user name
|
||||||
|
----
|
||||||
|
GET /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_user,User>>
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Updated user
|
||||||
|
----
|
||||||
|
PUT /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|name that need to be deleted|true|string|
|
||||||
|
|Body|body|Updated user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid user supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Delete user
|
||||||
|
----
|
||||||
|
DELETE /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
===== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
===== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
===== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
[[_security]]
|
||||||
|
== Security
|
||||||
|
|
||||||
|
=== api_key
|
||||||
|
Type : apiKey
|
||||||
|
Name : api_key
|
||||||
|
In : HEADER
|
||||||
|
|
||||||
|
=== petstore_auth
|
||||||
|
Type : oauth2
|
||||||
|
Flow : implicit
|
||||||
|
Token URL : http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
|
||||||
|
[options="header", cols="1,6"]
|
||||||
|
|===
|
||||||
|
|Name|Description
|
||||||
|
|write_pets|modify pets in your account
|
||||||
|
|read_pets|read your pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
|
||||||
|
[[_definitions]]
|
||||||
|
== Definitions
|
||||||
|
|
||||||
|
=== Category
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Order
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|complete||false|boolean||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|petId||false|integer(int64)||
|
||||||
|
|quantity||false|integer(int32)||
|
||||||
|
|shipDate||false|string(date-time)||
|
||||||
|
|status|Order Status|false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Pet
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|category||false|<<_category,Category>>||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||true|string||"doggie"
|
||||||
|
|photoUrls||true|string array||
|
||||||
|
|status|pet status in the store|false|string||
|
||||||
|
|tags||false|<<_tag,Tag>> array||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Tag
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|name||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== User
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^6,.^1,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Name|Description|Required|Schema|Default|Example
|
||||||
|
|email||false|string||
|
||||||
|
|firstName||false|string||
|
||||||
|
|id||false|integer(int64)||
|
||||||
|
|lastName||false|string||
|
||||||
|
|password||false|string||
|
||||||
|
|phone||false|string||
|
||||||
|
|userStatus|User Status|false|integer(int32)||
|
||||||
|
|username||false|string||
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
= Swagger Petstore
|
||||||
|
|
||||||
|
|
||||||
|
[[_overview]]
|
||||||
|
== Overview
|
||||||
|
This is a sample server Petstore server.
|
||||||
|
|
||||||
|
[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.
|
||||||
|
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||||
|
|
||||||
|
|
||||||
|
=== Version information
|
||||||
|
Version : 1.0.0
|
||||||
|
|
||||||
|
=== Contact information
|
||||||
|
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/
|
||||||
|
|
||||||
|
=== URI scheme
|
||||||
|
Host : petstore.swagger.io
|
||||||
|
BasePath : /v2
|
||||||
|
Schemes : HTTP
|
||||||
|
|
||||||
|
=== Tags
|
||||||
|
|
||||||
|
* pet : Pet resource
|
||||||
|
* store : Store resource
|
||||||
|
* user : User resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
806
src/test/resources/results/asciidoc/spring_rest_docs/paths.adoc
Normal file
806
src/test/resources/results/asciidoc/spring_rest_docs/paths.adoc
Normal file
@@ -0,0 +1,806 @@
|
|||||||
|
|
||||||
|
[[_paths]]
|
||||||
|
== Paths
|
||||||
|
|
||||||
|
=== Add a new pet to the store
|
||||||
|
----
|
||||||
|
POST /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== HTTP request
|
||||||
|
|
||||||
|
|
||||||
|
[source,http]
|
||||||
|
----
|
||||||
|
POST /api/pet/ HTTP/1.1
|
||||||
|
Content-Type: application/json
|
||||||
|
Content-Length: 111
|
||||||
|
|
||||||
|
{"id":1,"category":{"id":1,"name":"Hund"},"name":"Wuffy","photoUrls":[],"tags":[],"status":null,"identifier":1}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
==== HTTP response
|
||||||
|
|
||||||
|
|
||||||
|
[source,http]
|
||||||
|
----
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Content-Type: application/json
|
||||||
|
Content-Length: 7
|
||||||
|
|
||||||
|
SUCCESS
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
==== Curl request
|
||||||
|
|
||||||
|
===== curl-request
|
||||||
|
|
||||||
|
[source,bash]
|
||||||
|
----
|
||||||
|
$ curl 'http://localhost:8080/api/pet/' -i -X POST -H 'Content-Type: application/json' -H 'Content-Length: 111' -d '{"id":1,"category":{"id":1,"name":"Hund"},"name":"Wuffy","photoUrls":[],"tags":[],"status":null,"identifier":1}'
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=== Update an existing pet
|
||||||
|
----
|
||||||
|
PUT /pets
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|<<_pet,Pet>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|405|Validation exception|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Finds Pets by status
|
||||||
|
----
|
||||||
|
GET /pets/findByStatus
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|status|Status values that need to be considered for filter|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid status value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Finds Pets by tags
|
||||||
|
----
|
||||||
|
GET /pets/findByTags
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|tags|Tags to filter by|false|multi string array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>> array
|
||||||
|
|400|Invalid tag value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Updates a pet in the store with form data
|
||||||
|
----
|
||||||
|
POST /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of pet that needs to be updated|true|string|
|
||||||
|
|FormData|name|Updated name of the pet|true|string|
|
||||||
|
|FormData|status|Updated status of the pet|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|405|Invalid input|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Consumes
|
||||||
|
|
||||||
|
* application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Find pet by ID
|
||||||
|
----
|
||||||
|
GET /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|petId|ID of pet that needs to be fetched|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_pet,Pet>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Pet not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|apiKey|<<_api_key,api_key>>|
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Deletes a pet
|
||||||
|
----
|
||||||
|
DELETE /pets/{petId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Header|api_key||true|string|
|
||||||
|
|Path|petId|Pet id to delete|true|integer(int64)|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid pet value|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
==== Security
|
||||||
|
|
||||||
|
[options="header", cols=".^1,.^1h,.^6"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Scopes
|
||||||
|
|oauth2|<<_petstore_auth,petstore_auth>>|write_pets,read_pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
=== Place an order for a pet
|
||||||
|
----
|
||||||
|
POST /stores/order
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|order placed for purchasing the pet|false|<<_order,Order>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid Order|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
=== Find purchase order by ID
|
||||||
|
----
|
||||||
|
GET /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of pet that needs to be fetched|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_order,Order>>
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
=== Delete purchase order by ID
|
||||||
|
----
|
||||||
|
DELETE /stores/order/{orderId}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|orderId|ID of the order that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid ID supplied|No Content
|
||||||
|
|404|Order not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
=== Create user
|
||||||
|
----
|
||||||
|
POST /users
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|Created user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithArray
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Creates list of users with given input array
|
||||||
|
----
|
||||||
|
POST /users/createWithList
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Body|body|List of user object|false|<<_user,User>> array|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Logs user into the system
|
||||||
|
----
|
||||||
|
GET /users/login
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Query|password|The password for login in clear text|false|string|
|
||||||
|
|Query|username|The user name for login|false|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|string
|
||||||
|
|400|Invalid username/password supplied|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Logs out current logged in user session
|
||||||
|
----
|
||||||
|
GET /users/logout
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|default|successful operation|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Get user by user name
|
||||||
|
----
|
||||||
|
GET /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|200|successful operation|<<_user,User>>
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Updated user
|
||||||
|
----
|
||||||
|
PUT /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|name that need to be deleted|true|string|
|
||||||
|
|Body|body|Updated user object|false|<<_user,User>>|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid user supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
=== Delete user
|
||||||
|
----
|
||||||
|
DELETE /users/{username}
|
||||||
|
----
|
||||||
|
|
||||||
|
|
||||||
|
==== Description
|
||||||
|
[%hardbreaks]
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
==== Parameters
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^1h,.^6,.^1,.^1,.^1"]
|
||||||
|
|===
|
||||||
|
|Type|Name|Description|Required|Schema|Default
|
||||||
|
|Path|username|The name that needs to be deleted|true|string|
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Responses
|
||||||
|
|
||||||
|
[options="header", cols=".^1h,.^3,.^3,.^1"]
|
||||||
|
|===
|
||||||
|
|HTTP Code|Description|Headers|Schema
|
||||||
|
|400|Invalid username supplied|No Content
|
||||||
|
|404|User not found|No Content
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
==== Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
==== Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
[[_security]]
|
||||||
|
== Security
|
||||||
|
|
||||||
|
=== api_key
|
||||||
|
Type : apiKey
|
||||||
|
Name : api_key
|
||||||
|
In : HEADER
|
||||||
|
|
||||||
|
=== petstore_auth
|
||||||
|
Type : oauth2
|
||||||
|
Flow : implicit
|
||||||
|
Token URL : http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
|
||||||
|
[options="header", cols="1,6"]
|
||||||
|
|===
|
||||||
|
|Name|Description
|
||||||
|
|write_pets|modify pets in your account
|
||||||
|
|read_pets|read your pets
|
||||||
|
|===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
59
src/test/resources/results/markdown/default/definitions.md
Normal file
59
src/test/resources/results/markdown/default/definitions.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
<a name="definitions"></a>
|
||||||
|
## Definitions
|
||||||
|
|
||||||
|
### Category
|
||||||
|
|
||||||
|
|Name|Description|Required|Schema|Default|Example|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|id||false|integer(int64)|||
|
||||||
|
|name||false|string|||
|
||||||
|
|
||||||
|
|
||||||
|
### Order
|
||||||
|
|
||||||
|
|Name|Description|Required|Schema|Default|Example|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|complete||false|boolean|||
|
||||||
|
|id||false|integer(int64)|||
|
||||||
|
|petId||false|integer(int64)|||
|
||||||
|
|quantity||false|integer(int32)|||
|
||||||
|
|shipDate||false|string(date-time)|||
|
||||||
|
|status|Order Status|false|string|||
|
||||||
|
|
||||||
|
|
||||||
|
### Pet
|
||||||
|
|
||||||
|
|Name|Description|Required|Schema|Default|Example|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|category||false|[Category](#category)|||
|
||||||
|
|id||false|integer(int64)|||
|
||||||
|
|name||true|string||"doggie"|
|
||||||
|
|photoUrls||true|string array|||
|
||||||
|
|status|pet status in the store|false|string|||
|
||||||
|
|tags||false|[Tag](#tag) array|||
|
||||||
|
|
||||||
|
|
||||||
|
### Tag
|
||||||
|
|
||||||
|
|Name|Description|Required|Schema|Default|Example|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|id||false|integer(int64)|||
|
||||||
|
|name||false|string|||
|
||||||
|
|
||||||
|
|
||||||
|
### User
|
||||||
|
|
||||||
|
|Name|Description|Required|Schema|Default|Example|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|email||false|string|||
|
||||||
|
|firstName||false|string|||
|
||||||
|
|id||false|integer(int64)|||
|
||||||
|
|lastName||false|string|||
|
||||||
|
|password||false|string|||
|
||||||
|
|phone||false|string|||
|
||||||
|
|userStatus|User Status|false|integer(int32)|||
|
||||||
|
|username||false|string|||
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
36
src/test/resources/results/markdown/default/overview.md
Normal file
36
src/test/resources/results/markdown/default/overview.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Swagger Petstore
|
||||||
|
|
||||||
|
|
||||||
|
<a name="overview"></a>
|
||||||
|
## Overview
|
||||||
|
This is a sample server Petstore server.
|
||||||
|
|
||||||
|
[Learn about Swagger](http://swagger.io) or join the IRC channel `#swagger` on irc.freenode.net.
|
||||||
|
|
||||||
|
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||||
|
|
||||||
|
|
||||||
|
### Version information
|
||||||
|
Version : 1.0.0
|
||||||
|
|
||||||
|
### Contact information
|
||||||
|
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/
|
||||||
|
|
||||||
|
### URI scheme
|
||||||
|
Host : petstore.swagger.io
|
||||||
|
BasePath : /v2
|
||||||
|
Schemes : HTTP
|
||||||
|
|
||||||
|
### Tags
|
||||||
|
|
||||||
|
* pet : Pet resource
|
||||||
|
* store : Store resource
|
||||||
|
* user : User resource
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
675
src/test/resources/results/markdown/default/paths.md
Normal file
675
src/test/resources/results/markdown/default/paths.md
Normal file
@@ -0,0 +1,675 @@
|
|||||||
|
|
||||||
|
<a name="paths"></a>
|
||||||
|
## Paths
|
||||||
|
|
||||||
|
### Add a new pet to the store
|
||||||
|
```
|
||||||
|
POST /pets
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|[Pet](#pet)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|405|Invalid input|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Update an existing pet
|
||||||
|
```
|
||||||
|
PUT /pets
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|Pet object that needs to be added to the store|false|[Pet](#pet)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|400|Invalid ID supplied|No Content|
|
||||||
|
|404|Pet not found|No Content|
|
||||||
|
|405|Validation exception|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Consumes
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Finds Pets by status
|
||||||
|
```
|
||||||
|
GET /pets/findByStatus
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
Multiple status values can be provided with comma seperated strings
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Query|status|Status values that need to be considered for filter|false|multi string array||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[Pet](#pet) array|
|
||||||
|
|400|Invalid status value|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Finds Pets by tags
|
||||||
|
```
|
||||||
|
GET /pets/findByTags
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Query|tags|Tags to filter by|false|multi string array||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[Pet](#pet) array|
|
||||||
|
|400|Invalid tag value|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Updates a pet in the store with form data
|
||||||
|
```
|
||||||
|
POST /pets/{petId}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|petId|ID of pet that needs to be updated|true|string||
|
||||||
|
|FormData|name|Updated name of the pet|true|string||
|
||||||
|
|FormData|status|Updated status of the pet|true|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|405|Invalid input|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Consumes
|
||||||
|
|
||||||
|
* application/x-www-form-urlencoded
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Find pet by ID
|
||||||
|
```
|
||||||
|
GET /pets/{petId}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|petId|ID of pet that needs to be fetched|true|integer(int64)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[Pet](#pet)|
|
||||||
|
|400|Invalid ID supplied|No Content|
|
||||||
|
|404|Pet not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|apiKey|[api_key](#api_key)||
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Deletes a pet
|
||||||
|
```
|
||||||
|
DELETE /pets/{petId}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Header|api_key||true|string||
|
||||||
|
|Path|petId|Pet id to delete|true|integer(int64)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|400|Invalid pet value|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* pet
|
||||||
|
|
||||||
|
|
||||||
|
#### Security
|
||||||
|
|
||||||
|
|Type|Name|Scopes|
|
||||||
|
|---|---|---|
|
||||||
|
|oauth2|[petstore_auth](#petstore_auth)|write_pets,read_pets|
|
||||||
|
|
||||||
|
|
||||||
|
### Place an order for a pet
|
||||||
|
```
|
||||||
|
POST /stores/order
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|order placed for purchasing the pet|false|[Order](#order)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[Order](#order)|
|
||||||
|
|400|Invalid Order|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
### Find purchase order by ID
|
||||||
|
```
|
||||||
|
GET /stores/order/{orderId}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|orderId|ID of pet that needs to be fetched|true|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[Order](#order)|
|
||||||
|
|400|Invalid ID supplied|No Content|
|
||||||
|
|404|Order not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
### Delete purchase order by ID
|
||||||
|
```
|
||||||
|
DELETE /stores/order/{orderId}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|orderId|ID of the order that needs to be deleted|true|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|400|Invalid ID supplied|No Content|
|
||||||
|
|404|Order not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* store
|
||||||
|
|
||||||
|
|
||||||
|
### Create user
|
||||||
|
```
|
||||||
|
POST /users
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|Created user object|false|[User](#user)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|default|successful operation|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Creates list of users with given input array
|
||||||
|
```
|
||||||
|
POST /users/createWithArray
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|List of user object|false|[User](#user) array||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|default|successful operation|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Creates list of users with given input array
|
||||||
|
```
|
||||||
|
POST /users/createWithList
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Body|body|List of user object|false|[User](#user) array||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|default|successful operation|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Logs user into the system
|
||||||
|
```
|
||||||
|
GET /users/login
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Query|password|The password for login in clear text|false|string||
|
||||||
|
|Query|username|The user name for login|false|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|string|
|
||||||
|
|400|Invalid username/password supplied|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Logs out current logged in user session
|
||||||
|
```
|
||||||
|
GET /users/logout
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|default|successful operation|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Get user by user name
|
||||||
|
```
|
||||||
|
GET /users/{username}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|username|The name that needs to be fetched. Use user1 for testing.|true|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|200|successful operation|[User](#user)|
|
||||||
|
|400|Invalid username supplied|No Content|
|
||||||
|
|404|User not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Updated user
|
||||||
|
```
|
||||||
|
PUT /users/{username}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|username|name that need to be deleted|true|string||
|
||||||
|
|Body|body|Updated user object|false|[User](#user)||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|400|Invalid user supplied|No Content|
|
||||||
|
|404|User not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
### Delete user
|
||||||
|
```
|
||||||
|
DELETE /users/{username}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Description
|
||||||
|
This can only be done by the logged in user.
|
||||||
|
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
|
||||||
|
|Type|Name|Description|Required|Schema|Default|
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
|Path|username|The name that needs to be deleted|true|string||
|
||||||
|
|
||||||
|
|
||||||
|
#### Responses
|
||||||
|
|
||||||
|
|HTTP Code|Description|Headers|Schema|
|
||||||
|
|---|---|---|---|
|
||||||
|
|400|Invalid username supplied|No Content|
|
||||||
|
|404|User not found|No Content|
|
||||||
|
|
||||||
|
|
||||||
|
#### Produces
|
||||||
|
|
||||||
|
* application/json
|
||||||
|
* application/xml
|
||||||
|
|
||||||
|
|
||||||
|
#### Tags
|
||||||
|
|
||||||
|
* user
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
21
src/test/resources/results/markdown/default/security.md
Normal file
21
src/test/resources/results/markdown/default/security.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
<a name="security"></a>
|
||||||
|
## Security
|
||||||
|
|
||||||
|
### api_key
|
||||||
|
Type : apiKey
|
||||||
|
Name : api_key
|
||||||
|
In : HEADER
|
||||||
|
|
||||||
|
### petstore_auth
|
||||||
|
Type : oauth2
|
||||||
|
Flow : implicit
|
||||||
|
Token URL : http://petstore.swagger.io/api/oauth/dialog
|
||||||
|
|
||||||
|
|Name|Description|
|
||||||
|
|---|---|
|
||||||
|
|write_pets|modify pets in your account|
|
||||||
|
|read_pets|read your pets|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user