Compare commits

...

29 Commits

Author SHA1 Message Date
Robert Winkler
8d4bc8c0bc == Version 0.4.0
* Updated Swagger-Parser from 1.0.0 to 1.0.5
* Updated commons-lang to commons-lang3
* Swagger2MarkupConverter generates three documents now: overview, paths and definitions
* Support for enums in HeaderParameter, QueryParameter, FormParameter and QueryParameter
* Support for global consumes, produces and tags
2015-04-20 15:35:37 +02:00
Robert Winkler
76df322bb4 Updated documentation 2015-04-18 20:35:41 +02:00
Robert Winkler
36cdd3cebb Updated documentation 2015-04-18 20:08:36 +02:00
Robert Winkler
ca4587cb29 Updated documentation 2015-04-18 20:05:11 +02:00
Robert Winkler
ce958ba798 Updated documentation 2015-04-18 20:02:49 +02:00
Robert Winkler
7c5c0fea8c Updated documentation 2015-04-18 13:39:57 +02:00
Robert Winkler
5bc557a5d2 Updated documentation 2015-04-18 13:38:02 +02:00
Robert Winkler
e23a649c17 Updated documentation 2015-04-18 13:36:56 +02:00
Robert Winkler
a5300ceab5 Updated documentation 2015-04-18 13:22:49 +02:00
Robert Winkler
fdb405e52a Updated documentation 2015-04-18 13:03:25 +02:00
Robert Winkler
79cdd26ef0 Updated documentation 2015-04-18 12:52:49 +02:00
Robert Winkler
87c24c8f31 Updated documentation 2015-04-18 11:03:17 +02:00
Robert Winkler
6216165515 Updated documentation 2015-04-18 10:59:51 +02:00
Robert Winkler
77640d21be Updates documentation 2015-04-18 08:28:10 +02:00
Robert Winkler
57282f4933 Updated documentation 2015-04-17 14:19:41 +02:00
Robert Winkler
1a12e0dc11 Updated documentation 2015-04-17 14:16:21 +02:00
Robert Winkler
2b0317d1f6 Updated documentation 2015-04-17 14:10:41 +02:00
Robert Winkler
8fce706f31 Updated documentation 2015-04-17 14:06:08 +02:00
Robert Winkler
ae0f3ab31d Updated documentation 2015-04-17 14:01:27 +02:00
Robert Winkler
34cb438757 Updated documentation 2015-04-17 13:58:29 +02:00
Robert Winkler
8747ba2c1d Updated documentation 2015-04-17 13:57:10 +02:00
Robert Winkler
bef4e3c735 Updated documentation 2015-04-17 13:55:14 +02:00
Robert Winkler
6396b8fdb7 * Support of YAML or JSON String as input. 2015-04-17 13:25:26 +02:00
Robert Winkler
e27ba4304d * Fixed issue #8: logback.xml on the classpath
* Fixed issue #13: unknown format not supported for properties
2015-04-16 12:17:40 +02:00
Robert Winkler
4c86e73c4e * Fixed issue #8: logback.xml on the classpath
* Fixed issue #13: unknown format not supported for properties
2015-04-16 12:15:37 +02:00
Robert Winkler
9f9fa8c444 Added springfox 2015-04-15 17:03:37 +02:00
Robert Winkler
9647116572 Added springfox 2015-04-15 17:01:45 +02:00
Robert Winkler
736891fbdd Merge branch 'master' of https://github.com/RobWin/swagger2markup 2015-04-15 16:40:58 +02:00
Robert Winkler
edf9ba01bd Merge pull request #12 from RobWin/develop
Added Gitter badge
2015-04-08 08:42:29 +02:00
30 changed files with 7942 additions and 383 deletions

View File

@@ -1,6 +1,6 @@
= Swagger2Markup
:author: Robert Winkler
:version: 0.2.3
:version: 0.4.0
:hardbreaks:
image:https://travis-ci.org/RobWin/swagger2markup.svg["Build Status", link="https://travis-ci.org/RobWin/swagger2markup"] image:https://coveralls.io/repos/RobWin/swagger2markup/badge.svg["Coverage Status", link="https://coveralls.io/r/RobWin/swagger2markup"] image:https://api.bintray.com/packages/robwin/maven/swagger2markup/images/download.svg[link="https://bintray.com/robwin/maven/swagger2markup/_latestVersion"] image:http://img.shields.io/badge/license-ASF2-blue.svg["Apache License 2", link="http://www.apache.org/licenses/LICENSE-2.0.txt"]
@@ -8,10 +8,15 @@ image:https://badges.gitter.im/Join%20Chat.svg[link="https://gitter.im/RobWin/sw
== Overview
This project is a Swagger to Markup (AsciiDoc and Markdown) converter. The *Swagger2MarkupConverter* takes a swagger.json or swagger.yaml file as source and converts it into an AsciiDoc or Markdown document. The Swagger source file can be located locally or remotely accessible via HTTP. The Swagger2MarkupConverter supports the Swagger 1.2 and 2.0 specification. Internally it uses the _official_ https://github.com/swagger-api/swagger-parser[swagger-parser] and my https://github.com/RobWin/markup-document-builder[markup-document-builder].
The primary goal of this project is to simplify the documentation of a RESTful API by combining documentation that's been hand-written with auto-generated API documentation produced by https://github.com/swagger-api[Swagger]. The result is intended to be an easy-to-read, on- and offline user guide, comparable to https://developer.github.com/v3/[GitHub's API documentation].
The primary goal of this project is to simplify the documentation of RESTful APIs. The result is intended to be an easy-to-read, on- and offline user guide, comparable to https://developer.github.com/v3/[GitHub's API documentation].
Swagger2Markup can be used together with https://github.com/spring-projects/spring-restdocs[spring-restdocs]. See <<integration-with-spring-restdocs, Integration with spring-restdocs>>.
This project is a Swagger to Markup (AsciiDoc and GitHub Flavored Markdown) converter. The *Swagger2MarkupConverter* takes a swagger.json or swagger.yaml file as source and converts it into three documents (Overview, Paths and Definitions) which can be combined with hand-written documentation. The Swagger source file can be located locally or remotely via HTTP. The Swagger2MarkupConverter supports the Swagger 1.2 and 2.0 specification. Internally it uses the _official_ https://github.com/swagger-api/swagger-parser[swagger-parser] and my https://github.com/RobWin/markup-document-builder[markup-document-builder].
http://asciidoctor.org/docs/asciidoc-writers-guide/[AsciiDoc] is a text document format for writing documentation, articles, books, ebooks, slideshows, web pages and blogs. AsciiDoc files can be converted to many formats including HTML, PDF and EPUB. You write an AsciiDoc document the same way you would write a normal text document.
You can use Swagger2Markup to convert your design-first Swagger YAML file into a human-readable format and combine it with hand-written documentation. As an alternative, you can choose the implementation-first approach and use Swagger2Markup together with https://github.com/swagger-api/swagger-core/tree/master/samples/java-jersey2[Swagger JAX-RS], https://github.com/springfox/springfox[springfox] or https://github.com/spring-projects/spring-restdocs[spring-restdocs]. See usage guide below and <<integration-with-spring-restdocs, Integration with spring-restdocs>>.
You can generate your HTML5 and PDF documentation via https://github.com/asciidoctor/asciidoctorj[asciidoctorj] or even better via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin] or https://github.com/aalmiray/markdown-gradle-plugin[markdown-gradle-plugin]. You can also use https://github.com/jbake-org/jbake[JBake], https://github.com/tomchristie/mkdocs[MkDocs], https://github.com/rtfd/readthedocs.org[ReadTheDocs] or https://github.com/tripit/slate[slate] to publish your AsciiDoc or Markdown documentation.
The project requires at least JDK 7.
@@ -38,7 +43,7 @@ The project is published in JCenter and Maven Central.
<dependency>
<groupId>io.github.robwin</groupId>
<artifactId>swagger2markup</artifactId>
<version>0.2.3</version>
<version>0.4.0</version>
</dependency>
----
@@ -50,96 +55,160 @@ repositories {
jcenter()
}
compile "io.github.robwin:swagger2markup:0.2.3"
compile "io.github.robwin:swagger2markup:0.4.0"
----
=== Using Swagger2Markup
Using the Swagger2MarkupConverter is simple. For instance, you can generate your AsciiDoc/Markdown documentation using https://github.com/spring-projects/spring-boot[Spring Boot] and https://github.com/martypitt/swagger-springmvc[swagger-springmvc] as follows.
See demo project https://github.com/RobWin/spring-swagger2markup-demo[spring-swagger2markup-demo].
Using the Swagger2MarkupConverter is simple. For example, you can generate your AsciiDoc or Markdown documentation using https://github.com/spring-projects/spring-boot[Spring Boot] and https://github.com/springfox/springfox[springfox] during the unit or integration test phase, copy the documentation into the Jar file and serve it as static content.
The quickest way to get started is to look at the demo project https://github.com/RobWin/spring-swagger2markup-demo[spring-swagger2markup-demo]. The demo shows how to generate static docs (HTML5 and PDF) with Swagger2Markup and serve them as static content in a Spring Boot App under http://localhost:9080/docs/index.html and http://localhost:9080/docs/index.pdf.
==== Integration Test
Swagger2MarkupConverter can be used to make a request to a Swagger endpoint during an integration test. The Swagger2MarkupConverter writes the documents into the folder "src/docs/asciidoc".
[source,java]
----
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringBootSwaggerConfig.class)
@SpringApplicationConfiguration(classes = Application.class)
@IntegrationTest
@WebAppConfiguration
public class Swagger2MarkupTest {
@Test
public void convertSwaggerToMarkup() {
//Remote Swagger source
//Markdown
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").
withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder("src/docs/markdown");
public void convertRemoteSwaggerToAsciiDoc() {
//Remote Swagger source
//Default is AsciiDoc
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").build()
Swagger2MarkupConverter.from("http://localhost:8080/v2/api-docs").build()
.intoFolder("src/docs/asciidoc");
}
@Test
public void convertRemoteSwaggerToMarkdown() {
//Remote Swagger source
//Markdown
Swagger2MarkupConverter.from("http://localhost:8080/v2/api-docs").
withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder("src/docs/markdown");
}
@Test
public void convertLocalSwaggerToAsciiDoc() {
//Local Swagger source
//Default is AsciiDoc
File file = new File(Swagger2MarkupTest.class.getResource("/json/swagger.json").getFile());
Swagger2MarkupConverter.from(file.getAbsolutePath()).build()
.intoFolder("src/docs/asciidoc");
}
}
----
==== Unit Test
Spring's MVC Test framework can also be used to make a request to a https://github.com/springfox/springfox[springfox] Swagger endpoint during an unit test. A custom ResultHandler is used to automatically convert the Swagger JSON response into an AsciiDoc document.
That way you verify that your Swagger endpoint is working, too. The test cycle is much faster then.
[source,java]
----
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Application.class, loader = SpringApplicationContextLoader.class)
public class Swagger2MarkupTest {
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void testSwagger2HtmlConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
String asciiDoc = Swagger2MarkupConverter.from(file.getAbsolutePath()).build().asString();
String path = "src/docs/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);
}
public void convertSwaggerToAsciiDoc() throws Exception {
this.mockMvc.perform(get("/v2/api-docs")
.accept(MediaType.APPLICATION_JSON))
.andDo(Swagger2MarkupDocumentation.document("swagger_adoc"))
.andExpect(status().isOk());
}
}
----
==== Springfox configuration
The following is a complete https://github.com/springfox/springfox[springfox] configuration to use Swagger in a Spring Boot Application.
[source,java]
----
@SpringBootApplication
@EnableSwagger
public class SpringBootSwaggerConfig {
@EnableSwagger2
public class Application {
public static void main(String[] args) {
SpringApplication.run(SpringBootTestConfig.class, args);
SpringApplication.run(Application.class, args);
}
@Autowired
private SpringSwaggerConfig springSwaggerConfig;
@Bean
public SwaggerSpringMvcPlugin customImplementation(){
return new SwaggerSpringMvcPlugin(this.springSwaggerConfig)
.apiInfo(apiInfo()).excludeAnnotations(Controller.class);
public Docket restApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(ant("/api/**"))
.build();
}
private ApiInfo apiInfo() {
ApiInfo apiInfo = new ApiInfo(
"My Apps API Title",
"My Apps API Description",
"My Apps API terms of service",
"My Apps API Contact Email",
"My Apps API Licence Type",
"My Apps API License URL"
);
return apiInfo;
return new ApiInfoBuilder()
.title("Petstore API Title")
.description("Petstore API Description")
.contact("Petstore API Contact Email")
.version("1.0.0")
.build();
}
}
----
You can generate your HTML5 and PDF documentation via https://github.com/asciidoctor/asciidoctorj[asciidoctorj] or even better via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin] or https://github.com/aalmiray/markdown-gradle-plugin[markdown-gradle-plugin].
You can also use https://github.com/tomchristie/mkdocs[MkDocs] and https://github.com/rtfd/readthedocs.org[ReadTheDocs] to publish your Markdown documentation.
See http://spring-swagger2markup-demo.readthedocs.org/[ReadTheDocs-demo]
==== Combine generated documentation with your hand-written documentation
The following shows how you can combine the generated documentation with your hand-written documentation with AsciiDoc.
image::images/generated_docs.PNG[generated_docs]
You can generate your HTML5 and PDF documentation via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin]. The following shows how to configure the asciidoctor-gradle-plugin. By default it searches for AsciiDoc files in "src/docs/asciidoc" and puts the HTML and PDF output into "build/asciidoc/html5" and "build/asciidoc/pdf".
[source]
----
asciidoctor {
sources {
include 'index.adoc'
}
backends = ['html5', 'pdf']
attributes = [
doctype: 'book',
toc: 'left',
toclevels: '2',
numbered: '',
sectlinks: '',
sectanchors: ''
]
}
----
You can copy the output into your Jar file and serve the documentation as static content.
[source]
----
jar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
from ("${asciidoctor.outputDir}/pdf") {
into 'static/docs'
}
}
----
== Examples
== Swagger source file
@@ -154,9 +223,6 @@ image::images/markdown.PNG[markdown]
=== Generated HTML using AsciidoctorJ
image::images/asciidoc_html.PNG[asciidoc_html]
=== Generated HTML using Mkdocs
image::images/mkdocs_html.PNG[mkdocs_html]
=== Generated PDF using AsciidoctorJ
image::images/asciidoc_pdf.PNG[asciidoc_pdf]

View File

@@ -9,5 +9,22 @@
=== Version 0.2.1
* Signed jar files and published in Maven Central
=== Version 0.2.1
* Fixed wrong dependency version to io.github.robwin:markup-document-builder
=== Version 0.2.2
* Fixed wrong dependency version to io.github.robwin:markup-document-builder
=== Version 0.2.3
* Fixed issue #7: @ApiModelProperty metadata are ignored for definitions file
=== Version 0.2.4
* Fixed issue #8: logback.xml on the classpath
* Fixed issue #13: unknown format not supported for properties
== Version 0.3.0
* Support of YAML or JSON String as input.
== Version 0.4.0
* Updated Swagger-Parser from 1.0.0 to 1.0.5
* Updated commons-lang to commons-lang3
* Swagger2MarkupConverter generates three documents now: overview, paths and definitions
* Support for enums in HeaderParameter, QueryParameter, FormParameter and QueryParameter
* Support for global consumes, produces and tags

View File

@@ -6,14 +6,14 @@ buildscript {
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6'
classpath 'io.spring.gradle:dependency-management-plugin:0.4.0.RELEASE'
classpath 'io.spring.gradle:dependency-management-plugin:0.5.0.RELEASE'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'org.asciidoctor:asciidoctorj:1.5.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
description = 'swagger2markup Build'
version = '0.2.3'
version = '0.4.0'
group = 'io.github.robwin'
apply plugin: 'java'
@@ -44,22 +44,22 @@ dependencies {
compile 'io.swagger:swagger-compat-spec-parser'
compile 'commons-collections:commons-collections'
compile 'commons-io:commons-io'
compile 'ch.qos.logback:logback-classic'
compile 'org.slf4j:slf4j-api'
testCompile 'junit:junit'
testCompile 'org.asciidoctor:asciidoctorj:1.5.2'
testCompile 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.6'
testCompile 'ch.qos.logback:logback-classic'
}
dependencyManagement {
dependencies {
"io.github.robwin:markup-document-builder" "0.1.2"
"io.swagger:swagger-compat-spec-parser" "1.0.0"
"commons-collections:commons-collections" "3.2.1"
"commons-io:commons-io" "2.4"
"com.mangofactory:swagger-springmvc" "0.9.5"
"com.jayway.restassured:spring-mock-mvc" "2.4.0"
"ch.qos.logback:logback-classic" "1.1.2"
"junit:junit" "4.11"
dependency "io.github.robwin:markup-document-builder:0.1.3"
dependency "io.swagger:swagger-compat-spec-parser:1.0.5"
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"
}
}
@@ -79,12 +79,17 @@ artifacts {
}
asciidoctor {
sources {
include 'index.adoc'
}
backends = ['html5', 'pdf']
attributes = [
doctype: 'book',
toc: 'left',
toclevels: '2',
numbered: ''
numbered: '',
sectlinks: '',
sectanchors: ''
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 138 KiB

BIN
images/generated_docs.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,27 @@
= Swagger Petstore API
== 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

View File

@@ -1,21 +1,3 @@
= Swagger Petstore
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: 1.0.0
Contact: apiteam@wordnik.com
License: Apache 2.0
License URL: http://www.apache.org/licenses/LICENSE-2.0.html
Terms of service: http://helloreverb.com/terms/
Host: petstore.swagger.wordnik.com
BasePath: /v2
Schemes: HTTP
== Paths
=== Update an existing pet
----

View File

@@ -0,0 +1,13 @@
:doctype: book
:toc: left
:toclevels: 2
:numbered:
:sectlinks:
:sectanchors:
:hardbreaks:
include::generated/overview.adoc[]
include::manual_content1.adoc[]
include::manual_content2.adoc[]
include::generated/paths.adoc[]
include::generated/definitions.adoc[]

View File

@@ -0,0 +1,9 @@
== Chapter of manual content 1
This is some dummy text
=== Sub chapter
Dummy text of sub chapter

View File

@@ -0,0 +1,4 @@
== Chapter of manual content 2
This is some dummy text

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,26 @@
= Swagger Petstore
= Swagger Petstore API
== 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

View File

@@ -5,7 +5,7 @@
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.2">
<title>Swagger Petstore</title>
<title>Swagger Petstore API</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400">
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
@@ -411,46 +411,55 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
</head>
<body class="book toc2 toc-left">
<div id="header">
<h1>Swagger Petstore</h1>
<h1>Swagger Petstore API</h1>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#_paths">1. Paths</a>
<li><a href="#_overview">1. Overview</a>
<ul class="sectlevel2">
<li><a href="#_update_an_existing_pet">1.1. Update an existing pet</a></li>
<li><a href="#_add_a_new_pet_to_the_store">1.2. Add a new pet to the store</a></li>
<li><a href="#_finds_pets_by_status">1.3. Finds Pets by status</a></li>
<li><a href="#_finds_pets_by_tags">1.4. Finds Pets by tags</a></li>
<li><a href="#_find_pet_by_id">1.5. Find pet by ID</a></li>
<li><a href="#_deletes_a_pet">1.6. Deletes a pet</a></li>
<li><a href="#_updates_a_pet_in_the_store_with_form_data">1.7. Updates a pet in the store with form data</a></li>
<li><a href="#_place_an_order_for_a_pet">1.8. Place an order for a pet</a></li>
<li><a href="#_find_purchase_order_by_id">1.9. Find purchase order by ID</a></li>
<li><a href="#_delete_purchase_order_by_id">1.10. Delete purchase order by ID</a></li>
<li><a href="#_create_user">1.11. Create user</a></li>
<li><a href="#_creates_list_of_users_with_given_input_array">1.12. Creates list of users with given input array</a></li>
<li><a href="#_creates_list_of_users_with_given_input_array_2">1.13. Creates list of users with given input array</a></li>
<li><a href="#_logs_user_into_the_system">1.14. Logs user into the system</a></li>
<li><a href="#_logs_out_current_logged_in_user_session">1.15. Logs out current logged in user session</a></li>
<li><a href="#_get_user_by_user_name">1.16. Get user by user name</a></li>
<li><a href="#_updated_user">1.17. Updated user</a></li>
<li><a href="#_delete_user">1.18. Delete user</a></li>
<li><a href="#_version_information">1.1. Version information</a></li>
<li><a href="#_contact_information">1.2. Contact information</a></li>
<li><a href="#_license_information">1.3. License information</a></li>
<li><a href="#_uri_scheme">1.4. URI scheme</a></li>
</ul>
</li>
<li><a href="#_definitions">2. Definitions</a>
<li><a href="#_paths">2. Paths</a>
<ul class="sectlevel2">
<li><a href="#_user">2.1. User</a></li>
<li><a href="#_category">2.2. Category</a></li>
<li><a href="#_pet">2.3. Pet</a></li>
<li><a href="#_tag">2.4. Tag</a></li>
<li><a href="#_order">2.5. Order</a></li>
<li><a href="#_update_an_existing_pet">2.1. Update an existing pet</a></li>
<li><a href="#_add_a_new_pet_to_the_store">2.2. Add a new pet to the store</a></li>
<li><a href="#_finds_pets_by_status">2.3. Finds Pets by status</a></li>
<li><a href="#_finds_pets_by_tags">2.4. Finds Pets by tags</a></li>
<li><a href="#_find_pet_by_id">2.5. Find pet by ID</a></li>
<li><a href="#_deletes_a_pet">2.6. Deletes a pet</a></li>
<li><a href="#_updates_a_pet_in_the_store_with_form_data">2.7. Updates a pet in the store with form data</a></li>
<li><a href="#_place_an_order_for_a_pet">2.8. Place an order for a pet</a></li>
<li><a href="#_find_purchase_order_by_id">2.9. Find purchase order by ID</a></li>
<li><a href="#_delete_purchase_order_by_id">2.10. Delete purchase order by ID</a></li>
<li><a href="#_create_user">2.11. Create user</a></li>
<li><a href="#_creates_list_of_users_with_given_input_array">2.12. Creates list of users with given input array</a></li>
<li><a href="#_creates_list_of_users_with_given_input_array_2">2.13. Creates list of users with given input array</a></li>
<li><a href="#_logs_user_into_the_system">2.14. Logs user into the system</a></li>
<li><a href="#_logs_out_current_logged_in_user_session">2.15. Logs out current logged in user session</a></li>
<li><a href="#_get_user_by_user_name">2.16. Get user by user name</a></li>
<li><a href="#_updated_user">2.17. Updated user</a></li>
<li><a href="#_delete_user">2.18. Delete user</a></li>
</ul>
</li>
<li><a href="#_definitions">3. Definitions</a>
<ul class="sectlevel2">
<li><a href="#_user">3.1. User</a></li>
<li><a href="#_category">3.2. Category</a></li>
<li><a href="#_pet">3.3. Pet</a></li>
<li><a href="#_tag">3.4. Tag</a></li>
<li><a href="#_order">3.5. Order</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sect1">
<h2 id="_overview"><a class="anchor" href="#_overview"></a>1. Overview</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This is a sample server Petstore server.</p>
@@ -461,13 +470,30 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
<div class="paragraph">
<p>For this sample, you can use the api key <code>special-key</code> to test the authorization filters</p>
</div>
<div class="sect2">
<h3 id="_version_information"><a class="anchor" href="#_version_information"></a>1.1. Version information</h3>
<div class="paragraph">
<p>Version: 1.0.0<br>
Contact: <a href="mailto:apiteam@wordnik.com">apiteam@wordnik.com</a><br>
License: Apache 2.0<br>
License URL: <a href="http://www.apache.org/licenses/LICENSE-2.0.html" class="bare">http://www.apache.org/licenses/LICENSE-2.0.html</a><br>
Terms of service: <a href="http://helloreverb.com/terms/" class="bare">http://helloreverb.com/terms/</a></p>
<p>Version: 1.0.0</p>
</div>
</div>
<div class="sect2">
<h3 id="_contact_information"><a class="anchor" href="#_contact_information"></a>1.2. Contact information</h3>
<div class="paragraph">
<p>Contact: <a href="mailto:apiteam@wordnik.com">apiteam@wordnik.com</a></p>
</div>
</div>
<div class="sect2">
<h3 id="_license_information"><a class="anchor" href="#_license_information"></a>1.3. License information</h3>
<div class="paragraph">
<p>License: Apache 2.0<br>
License URL: <a href="http://www.apache.org/licenses/LICENSE-2.0.html" class="bare">http://www.apache.org/licenses/LICENSE-2.0.html</a></p>
</div>
<div class="paragraph">
<p>Terms of service: <a href="http://helloreverb.com/terms/" class="bare">http://helloreverb.com/terms/</a></p>
</div>
</div>
<div class="sect2">
<h3 id="_uri_scheme"><a class="anchor" href="#_uri_scheme"></a>1.4. URI scheme</h3>
<div class="paragraph">
<p>Host: petstore.swagger.wordnik.com<br>
BasePath: /v2<br>
@@ -475,18 +501,19 @@ Schemes: HTTP</p>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_paths"><a class="anchor" href="#_paths"></a>1. Paths</h2>
<h2 id="_paths"><a class="anchor" href="#_paths"></a>2. Paths</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_update_an_existing_pet"><a class="anchor" href="#_update_an_existing_pet"></a>1.1. Update an existing pet</h3>
<h3 id="_update_an_existing_pet"><a class="anchor" href="#_update_an_existing_pet"></a>2.1. Update an existing pet</h3>
<div class="listingblock">
<div class="content">
<pre>PUT /pets</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters"><a class="anchor" href="#_parameters"></a>1.1.1. Parameters</h4>
<h4 id="_parameters"><a class="anchor" href="#_parameters"></a>2.1.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -516,7 +543,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses"><a class="anchor" href="#_responses"></a>1.1.2. Responses</h4>
<h4 id="_responses"><a class="anchor" href="#_responses"></a>2.1.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -550,7 +577,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_consumes"><a class="anchor" href="#_consumes"></a>1.1.3. Consumes</h4>
<h4 id="_consumes"><a class="anchor" href="#_consumes"></a>2.1.3. Consumes</h4>
<div class="ulist">
<ul>
<li>
@@ -563,7 +590,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_produces"><a class="anchor" href="#_produces"></a>1.1.4. Produces</h4>
<h4 id="_produces"><a class="anchor" href="#_produces"></a>2.1.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -576,7 +603,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags"><a class="anchor" href="#_tags"></a>1.1.5. Tags</h4>
<h4 id="_tags"><a class="anchor" href="#_tags"></a>2.1.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -587,14 +614,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_add_a_new_pet_to_the_store"><a class="anchor" href="#_add_a_new_pet_to_the_store"></a>1.2. Add a new pet to the store</h3>
<h3 id="_add_a_new_pet_to_the_store"><a class="anchor" href="#_add_a_new_pet_to_the_store"></a>2.2. Add a new pet to the store</h3>
<div class="listingblock">
<div class="content">
<pre>POST /pets</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a>1.2.1. Parameters</h4>
<h4 id="_parameters_2"><a class="anchor" href="#_parameters_2"></a>2.2.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -624,7 +651,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a>1.2.2. Responses</h4>
<h4 id="_responses_2"><a class="anchor" href="#_responses_2"></a>2.2.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -648,7 +675,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_consumes_2"><a class="anchor" href="#_consumes_2"></a>1.2.3. Consumes</h4>
<h4 id="_consumes_2"><a class="anchor" href="#_consumes_2"></a>2.2.3. Consumes</h4>
<div class="ulist">
<ul>
<li>
@@ -661,7 +688,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_produces_2"><a class="anchor" href="#_produces_2"></a>1.2.4. Produces</h4>
<h4 id="_produces_2"><a class="anchor" href="#_produces_2"></a>2.2.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -674,7 +701,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_2"><a class="anchor" href="#_tags_2"></a>1.2.5. Tags</h4>
<h4 id="_tags_2"><a class="anchor" href="#_tags_2"></a>2.2.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -685,20 +712,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_finds_pets_by_status"><a class="anchor" href="#_finds_pets_by_status"></a>1.3. Finds Pets by status</h3>
<h3 id="_finds_pets_by_status"><a class="anchor" href="#_finds_pets_by_status"></a>2.3. Finds Pets by status</h3>
<div class="listingblock">
<div class="content">
<pre>GET /pets/findByStatus</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description"><a class="anchor" href="#_description"></a>1.3.1. Description</h4>
<h4 id="_description"><a class="anchor" href="#_description"></a>2.3.1. Description</h4>
<div class="paragraph">
<p>Multiple status values can be provided with comma seperated strings</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a>1.3.2. Parameters</h4>
<h4 id="_parameters_3"><a class="anchor" href="#_parameters_3"></a>2.3.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -728,7 +755,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a>1.3.3. Responses</h4>
<h4 id="_responses_3"><a class="anchor" href="#_responses_3"></a>2.3.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -757,7 +784,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_3"><a class="anchor" href="#_produces_3"></a>1.3.4. Produces</h4>
<h4 id="_produces_3"><a class="anchor" href="#_produces_3"></a>2.3.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -770,7 +797,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_3"><a class="anchor" href="#_tags_3"></a>1.3.5. Tags</h4>
<h4 id="_tags_3"><a class="anchor" href="#_tags_3"></a>2.3.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -781,20 +808,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_finds_pets_by_tags"><a class="anchor" href="#_finds_pets_by_tags"></a>1.4. Finds Pets by tags</h3>
<h3 id="_finds_pets_by_tags"><a class="anchor" href="#_finds_pets_by_tags"></a>2.4. Finds Pets by tags</h3>
<div class="listingblock">
<div class="content">
<pre>GET /pets/findByTags</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_2"><a class="anchor" href="#_description_2"></a>1.4.1. Description</h4>
<h4 id="_description_2"><a class="anchor" href="#_description_2"></a>2.4.1. Description</h4>
<div class="paragraph">
<p>Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a>1.4.2. Parameters</h4>
<h4 id="_parameters_4"><a class="anchor" href="#_parameters_4"></a>2.4.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -824,7 +851,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_4"><a class="anchor" href="#_responses_4"></a>1.4.3. Responses</h4>
<h4 id="_responses_4"><a class="anchor" href="#_responses_4"></a>2.4.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -853,7 +880,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_4"><a class="anchor" href="#_produces_4"></a>1.4.4. Produces</h4>
<h4 id="_produces_4"><a class="anchor" href="#_produces_4"></a>2.4.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -866,7 +893,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_4"><a class="anchor" href="#_tags_4"></a>1.4.5. Tags</h4>
<h4 id="_tags_4"><a class="anchor" href="#_tags_4"></a>2.4.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -877,20 +904,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_find_pet_by_id"><a class="anchor" href="#_find_pet_by_id"></a>1.5. Find pet by ID</h3>
<h3 id="_find_pet_by_id"><a class="anchor" href="#_find_pet_by_id"></a>2.5. Find pet by ID</h3>
<div class="listingblock">
<div class="content">
<pre>GET /pets/{petId}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_3"><a class="anchor" href="#_description_3"></a>1.5.1. Description</h4>
<h4 id="_description_3"><a class="anchor" href="#_description_3"></a>2.5.1. Description</h4>
<div class="paragraph">
<p>Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a>1.5.2. Parameters</h4>
<h4 id="_parameters_5"><a class="anchor" href="#_parameters_5"></a>2.5.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -920,7 +947,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_5"><a class="anchor" href="#_responses_5"></a>1.5.3. Responses</h4>
<h4 id="_responses_5"><a class="anchor" href="#_responses_5"></a>2.5.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -954,7 +981,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_5"><a class="anchor" href="#_produces_5"></a>1.5.4. Produces</h4>
<h4 id="_produces_5"><a class="anchor" href="#_produces_5"></a>2.5.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -967,7 +994,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_5"><a class="anchor" href="#_tags_5"></a>1.5.5. Tags</h4>
<h4 id="_tags_5"><a class="anchor" href="#_tags_5"></a>2.5.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -978,14 +1005,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_deletes_a_pet"><a class="anchor" href="#_deletes_a_pet"></a>1.6. Deletes a pet</h3>
<h3 id="_deletes_a_pet"><a class="anchor" href="#_deletes_a_pet"></a>2.6. Deletes a pet</h3>
<div class="listingblock">
<div class="content">
<pre>DELETE /pets/{petId}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a>1.6.1. Parameters</h4>
<h4 id="_parameters_6"><a class="anchor" href="#_parameters_6"></a>2.6.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1022,7 +1049,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a>1.6.2. Responses</h4>
<h4 id="_responses_6"><a class="anchor" href="#_responses_6"></a>2.6.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1046,7 +1073,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_6"><a class="anchor" href="#_produces_6"></a>1.6.3. Produces</h4>
<h4 id="_produces_6"><a class="anchor" href="#_produces_6"></a>2.6.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1059,7 +1086,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_6"><a class="anchor" href="#_tags_6"></a>1.6.4. Tags</h4>
<h4 id="_tags_6"><a class="anchor" href="#_tags_6"></a>2.6.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1070,14 +1097,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_updates_a_pet_in_the_store_with_form_data"><a class="anchor" href="#_updates_a_pet_in_the_store_with_form_data"></a>1.7. Updates a pet in the store with form data</h3>
<h3 id="_updates_a_pet_in_the_store_with_form_data"><a class="anchor" href="#_updates_a_pet_in_the_store_with_form_data"></a>2.7. Updates a pet in the store with form data</h3>
<div class="listingblock">
<div class="content">
<pre>POST /pets/{petId}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a>1.7.1. Parameters</h4>
<h4 id="_parameters_7"><a class="anchor" href="#_parameters_7"></a>2.7.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1121,7 +1148,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_7"><a class="anchor" href="#_responses_7"></a>1.7.2. Responses</h4>
<h4 id="_responses_7"><a class="anchor" href="#_responses_7"></a>2.7.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1145,7 +1172,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_consumes_3"><a class="anchor" href="#_consumes_3"></a>1.7.3. Consumes</h4>
<h4 id="_consumes_3"><a class="anchor" href="#_consumes_3"></a>2.7.3. Consumes</h4>
<div class="ulist">
<ul>
<li>
@@ -1155,7 +1182,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_produces_7"><a class="anchor" href="#_produces_7"></a>1.7.4. Produces</h4>
<h4 id="_produces_7"><a class="anchor" href="#_produces_7"></a>2.7.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1168,7 +1195,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_7"><a class="anchor" href="#_tags_7"></a>1.7.5. Tags</h4>
<h4 id="_tags_7"><a class="anchor" href="#_tags_7"></a>2.7.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1179,14 +1206,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_place_an_order_for_a_pet"><a class="anchor" href="#_place_an_order_for_a_pet"></a>1.8. Place an order for a pet</h3>
<h3 id="_place_an_order_for_a_pet"><a class="anchor" href="#_place_an_order_for_a_pet"></a>2.8. Place an order for a pet</h3>
<div class="listingblock">
<div class="content">
<pre>POST /stores/order</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a>1.8.1. Parameters</h4>
<h4 id="_parameters_8"><a class="anchor" href="#_parameters_8"></a>2.8.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1216,7 +1243,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_8"><a class="anchor" href="#_responses_8"></a>1.8.2. Responses</h4>
<h4 id="_responses_8"><a class="anchor" href="#_responses_8"></a>2.8.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1245,7 +1272,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_8"><a class="anchor" href="#_produces_8"></a>1.8.3. Produces</h4>
<h4 id="_produces_8"><a class="anchor" href="#_produces_8"></a>2.8.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1258,7 +1285,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_8"><a class="anchor" href="#_tags_8"></a>1.8.4. Tags</h4>
<h4 id="_tags_8"><a class="anchor" href="#_tags_8"></a>2.8.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1269,20 +1296,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_find_purchase_order_by_id"><a class="anchor" href="#_find_purchase_order_by_id"></a>1.9. Find purchase order by ID</h3>
<h3 id="_find_purchase_order_by_id"><a class="anchor" href="#_find_purchase_order_by_id"></a>2.9. Find purchase order by ID</h3>
<div class="listingblock">
<div class="content">
<pre>GET /stores/order/{orderId}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_4"><a class="anchor" href="#_description_4"></a>1.9.1. Description</h4>
<h4 id="_description_4"><a class="anchor" href="#_description_4"></a>2.9.1. Description</h4>
<div class="paragraph">
<p>For valid response try integer IDs with value &#8656; 5 or &gt; 10. Other values will generated exceptions</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a>1.9.2. Parameters</h4>
<h4 id="_parameters_9"><a class="anchor" href="#_parameters_9"></a>2.9.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1312,7 +1339,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_9"><a class="anchor" href="#_responses_9"></a>1.9.3. Responses</h4>
<h4 id="_responses_9"><a class="anchor" href="#_responses_9"></a>2.9.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1346,7 +1373,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_9"><a class="anchor" href="#_produces_9"></a>1.9.4. Produces</h4>
<h4 id="_produces_9"><a class="anchor" href="#_produces_9"></a>2.9.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1359,7 +1386,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_9"><a class="anchor" href="#_tags_9"></a>1.9.5. Tags</h4>
<h4 id="_tags_9"><a class="anchor" href="#_tags_9"></a>2.9.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1370,20 +1397,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_delete_purchase_order_by_id"><a class="anchor" href="#_delete_purchase_order_by_id"></a>1.10. Delete purchase order by ID</h3>
<h3 id="_delete_purchase_order_by_id"><a class="anchor" href="#_delete_purchase_order_by_id"></a>2.10. Delete purchase order by ID</h3>
<div class="listingblock">
<div class="content">
<pre>DELETE /stores/order/{orderId}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_5"><a class="anchor" href="#_description_5"></a>1.10.1. Description</h4>
<h4 id="_description_5"><a class="anchor" href="#_description_5"></a>2.10.1. Description</h4>
<div class="paragraph">
<p>For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a>1.10.2. Parameters</h4>
<h4 id="_parameters_10"><a class="anchor" href="#_parameters_10"></a>2.10.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1413,7 +1440,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_10"><a class="anchor" href="#_responses_10"></a>1.10.3. Responses</h4>
<h4 id="_responses_10"><a class="anchor" href="#_responses_10"></a>2.10.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1442,7 +1469,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_10"><a class="anchor" href="#_produces_10"></a>1.10.4. Produces</h4>
<h4 id="_produces_10"><a class="anchor" href="#_produces_10"></a>2.10.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1455,7 +1482,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_10"><a class="anchor" href="#_tags_10"></a>1.10.5. Tags</h4>
<h4 id="_tags_10"><a class="anchor" href="#_tags_10"></a>2.10.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1466,20 +1493,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_create_user"><a class="anchor" href="#_create_user"></a>1.11. Create user</h3>
<h3 id="_create_user"><a class="anchor" href="#_create_user"></a>2.11. Create user</h3>
<div class="listingblock">
<div class="content">
<pre>POST /users</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_6"><a class="anchor" href="#_description_6"></a>1.11.1. Description</h4>
<h4 id="_description_6"><a class="anchor" href="#_description_6"></a>2.11.1. Description</h4>
<div class="paragraph">
<p>This can only be done by the logged in user.</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a>1.11.2. Parameters</h4>
<h4 id="_parameters_11"><a class="anchor" href="#_parameters_11"></a>2.11.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1509,7 +1536,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_11"><a class="anchor" href="#_responses_11"></a>1.11.3. Responses</h4>
<h4 id="_responses_11"><a class="anchor" href="#_responses_11"></a>2.11.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1533,7 +1560,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_11"><a class="anchor" href="#_produces_11"></a>1.11.4. Produces</h4>
<h4 id="_produces_11"><a class="anchor" href="#_produces_11"></a>2.11.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1546,7 +1573,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_11"><a class="anchor" href="#_tags_11"></a>1.11.5. Tags</h4>
<h4 id="_tags_11"><a class="anchor" href="#_tags_11"></a>2.11.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1557,14 +1584,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_creates_list_of_users_with_given_input_array"><a class="anchor" href="#_creates_list_of_users_with_given_input_array"></a>1.12. Creates list of users with given input array</h3>
<h3 id="_creates_list_of_users_with_given_input_array"><a class="anchor" href="#_creates_list_of_users_with_given_input_array"></a>2.12. Creates list of users with given input array</h3>
<div class="listingblock">
<div class="content">
<pre>POST /users/createWithArray</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a>1.12.1. Parameters</h4>
<h4 id="_parameters_12"><a class="anchor" href="#_parameters_12"></a>2.12.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1594,7 +1621,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a>1.12.2. Responses</h4>
<h4 id="_responses_12"><a class="anchor" href="#_responses_12"></a>2.12.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1618,7 +1645,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_12"><a class="anchor" href="#_produces_12"></a>1.12.3. Produces</h4>
<h4 id="_produces_12"><a class="anchor" href="#_produces_12"></a>2.12.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1631,7 +1658,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_12"><a class="anchor" href="#_tags_12"></a>1.12.4. Tags</h4>
<h4 id="_tags_12"><a class="anchor" href="#_tags_12"></a>2.12.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1642,14 +1669,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_creates_list_of_users_with_given_input_array_2"><a class="anchor" href="#_creates_list_of_users_with_given_input_array_2"></a>1.13. Creates list of users with given input array</h3>
<h3 id="_creates_list_of_users_with_given_input_array_2"><a class="anchor" href="#_creates_list_of_users_with_given_input_array_2"></a>2.13. Creates list of users with given input array</h3>
<div class="listingblock">
<div class="content">
<pre>POST /users/createWithList</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a>1.13.1. Parameters</h4>
<h4 id="_parameters_13"><a class="anchor" href="#_parameters_13"></a>2.13.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1679,7 +1706,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_13"><a class="anchor" href="#_responses_13"></a>1.13.2. Responses</h4>
<h4 id="_responses_13"><a class="anchor" href="#_responses_13"></a>2.13.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1703,7 +1730,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_13"><a class="anchor" href="#_produces_13"></a>1.13.3. Produces</h4>
<h4 id="_produces_13"><a class="anchor" href="#_produces_13"></a>2.13.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1716,7 +1743,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_13"><a class="anchor" href="#_tags_13"></a>1.13.4. Tags</h4>
<h4 id="_tags_13"><a class="anchor" href="#_tags_13"></a>2.13.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1727,14 +1754,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_logs_user_into_the_system"><a class="anchor" href="#_logs_user_into_the_system"></a>1.14. Logs user into the system</h3>
<h3 id="_logs_user_into_the_system"><a class="anchor" href="#_logs_user_into_the_system"></a>2.14. Logs user into the system</h3>
<div class="listingblock">
<div class="content">
<pre>GET /users/login</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a>1.14.1. Parameters</h4>
<h4 id="_parameters_14"><a class="anchor" href="#_parameters_14"></a>2.14.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1771,7 +1798,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_14"><a class="anchor" href="#_responses_14"></a>1.14.2. Responses</h4>
<h4 id="_responses_14"><a class="anchor" href="#_responses_14"></a>2.14.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1800,7 +1827,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_14"><a class="anchor" href="#_produces_14"></a>1.14.3. Produces</h4>
<h4 id="_produces_14"><a class="anchor" href="#_produces_14"></a>2.14.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1813,7 +1840,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_14"><a class="anchor" href="#_tags_14"></a>1.14.4. Tags</h4>
<h4 id="_tags_14"><a class="anchor" href="#_tags_14"></a>2.14.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1824,14 +1851,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_logs_out_current_logged_in_user_session"><a class="anchor" href="#_logs_out_current_logged_in_user_session"></a>1.15. Logs out current logged in user session</h3>
<h3 id="_logs_out_current_logged_in_user_session"><a class="anchor" href="#_logs_out_current_logged_in_user_session"></a>2.15. Logs out current logged in user session</h3>
<div class="listingblock">
<div class="content">
<pre>GET /users/logout</pre>
</div>
</div>
<div class="sect3">
<h4 id="_responses_15"><a class="anchor" href="#_responses_15"></a>1.15.1. Responses</h4>
<h4 id="_responses_15"><a class="anchor" href="#_responses_15"></a>2.15.1. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1855,7 +1882,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_15"><a class="anchor" href="#_produces_15"></a>1.15.2. Produces</h4>
<h4 id="_produces_15"><a class="anchor" href="#_produces_15"></a>2.15.2. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1868,7 +1895,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_15"><a class="anchor" href="#_tags_15"></a>1.15.3. Tags</h4>
<h4 id="_tags_15"><a class="anchor" href="#_tags_15"></a>2.15.3. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1879,14 +1906,14 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_get_user_by_user_name"><a class="anchor" href="#_get_user_by_user_name"></a>1.16. Get user by user name</h3>
<h3 id="_get_user_by_user_name"><a class="anchor" href="#_get_user_by_user_name"></a>2.16. Get user by user name</h3>
<div class="listingblock">
<div class="content">
<pre>GET /users/{username}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a>1.16.1. Parameters</h4>
<h4 id="_parameters_15"><a class="anchor" href="#_parameters_15"></a>2.16.1. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -1916,7 +1943,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_16"><a class="anchor" href="#_responses_16"></a>1.16.2. Responses</h4>
<h4 id="_responses_16"><a class="anchor" href="#_responses_16"></a>2.16.2. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -1950,7 +1977,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_16"><a class="anchor" href="#_produces_16"></a>1.16.3. Produces</h4>
<h4 id="_produces_16"><a class="anchor" href="#_produces_16"></a>2.16.3. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -1963,7 +1990,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_16"><a class="anchor" href="#_tags_16"></a>1.16.4. Tags</h4>
<h4 id="_tags_16"><a class="anchor" href="#_tags_16"></a>2.16.4. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -1974,20 +2001,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_updated_user"><a class="anchor" href="#_updated_user"></a>1.17. Updated user</h3>
<h3 id="_updated_user"><a class="anchor" href="#_updated_user"></a>2.17. Updated user</h3>
<div class="listingblock">
<div class="content">
<pre>PUT /users/{username}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_7"><a class="anchor" href="#_description_7"></a>1.17.1. Description</h4>
<h4 id="_description_7"><a class="anchor" href="#_description_7"></a>2.17.1. Description</h4>
<div class="paragraph">
<p>This can only be done by the logged in user.</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a>1.17.2. Parameters</h4>
<h4 id="_parameters_16"><a class="anchor" href="#_parameters_16"></a>2.17.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -2024,7 +2051,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_17"><a class="anchor" href="#_responses_17"></a>1.17.3. Responses</h4>
<h4 id="_responses_17"><a class="anchor" href="#_responses_17"></a>2.17.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -2053,7 +2080,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_17"><a class="anchor" href="#_produces_17"></a>1.17.4. Produces</h4>
<h4 id="_produces_17"><a class="anchor" href="#_produces_17"></a>2.17.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -2066,7 +2093,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_17"><a class="anchor" href="#_tags_17"></a>1.17.5. Tags</h4>
<h4 id="_tags_17"><a class="anchor" href="#_tags_17"></a>2.17.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -2077,20 +2104,20 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect2">
<h3 id="_delete_user"><a class="anchor" href="#_delete_user"></a>1.18. Delete user</h3>
<h3 id="_delete_user"><a class="anchor" href="#_delete_user"></a>2.18. Delete user</h3>
<div class="listingblock">
<div class="content">
<pre>DELETE /users/{username}</pre>
</div>
</div>
<div class="sect3">
<h4 id="_description_8"><a class="anchor" href="#_description_8"></a>1.18.1. Description</h4>
<h4 id="_description_8"><a class="anchor" href="#_description_8"></a>2.18.1. Description</h4>
<div class="paragraph">
<p>This can only be done by the logged in user.</p>
</div>
</div>
<div class="sect3">
<h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a>1.18.2. Parameters</h4>
<h4 id="_parameters_17"><a class="anchor" href="#_parameters_17"></a>2.18.2. Parameters</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 20%;">
@@ -2120,7 +2147,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_responses_18"><a class="anchor" href="#_responses_18"></a>1.18.3. Responses</h4>
<h4 id="_responses_18"><a class="anchor" href="#_responses_18"></a>2.18.3. Responses</h4>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 33%;">
@@ -2149,7 +2176,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect3">
<h4 id="_produces_18"><a class="anchor" href="#_produces_18"></a>1.18.4. Produces</h4>
<h4 id="_produces_18"><a class="anchor" href="#_produces_18"></a>2.18.4. Produces</h4>
<div class="ulist">
<ul>
<li>
@@ -2162,7 +2189,7 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect3">
<h4 id="_tags_18"><a class="anchor" href="#_tags_18"></a>1.18.5. Tags</h4>
<h4 id="_tags_18"><a class="anchor" href="#_tags_18"></a>2.18.5. Tags</h4>
<div class="ulist">
<ul>
<li>
@@ -2175,10 +2202,10 @@ Schemes: HTTP</p>
</div>
</div>
<div class="sect1">
<h2 id="_definitions"><a class="anchor" href="#_definitions"></a>2. Definitions</h2>
<h2 id="_definitions"><a class="anchor" href="#_definitions"></a>3. Definitions</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_user"><a class="anchor" href="#_user"></a>2.1. User</h3>
<h3 id="_user"><a class="anchor" href="#_user"></a>3.1. User</h3>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
@@ -2247,7 +2274,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect2">
<h3 id="_category"><a class="anchor" href="#_category"></a>2.2. Category</h3>
<h3 id="_category"><a class="anchor" href="#_category"></a>3.2. Category</h3>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
@@ -2280,7 +2307,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect2">
<h3 id="_pet"><a class="anchor" href="#_pet"></a>2.3. Pet</h3>
<h3 id="_pet"><a class="anchor" href="#_pet"></a>3.3. Pet</h3>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
@@ -2337,7 +2364,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect2">
<h3 id="_tag"><a class="anchor" href="#_tag"></a>2.4. Tag</h3>
<h3 id="_tag"><a class="anchor" href="#_tag"></a>3.4. Tag</h3>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
@@ -2370,7 +2397,7 @@ Schemes: HTTP</p>
</table>
</div>
<div class="sect2">
<h3 id="_order"><a class="anchor" href="#_order"></a>2.5. Order</h3>
<h3 id="_order"><a class="anchor" href="#_order"></a>3.5. Order</h3>
<table class="tableblock frame-all grid-all spread">
<colgroup>
<col style="width: 25%;">
@@ -2431,7 +2458,7 @@ Schemes: HTTP</p>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2015-04-15 16:23:53 MESZ
Last updated 2015-04-20 13:43:56 MESZ
</div>
</div>
</body>

View File

@@ -0,0 +1,27 @@
# Swagger Petstore API
## 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

View File

@@ -1,21 +1,3 @@
# Swagger Petstore
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: 1.0.0
Contact: apiteam@wordnik.com
License: Apache 2.0
License URL: http://www.apache.org/licenses/LICENSE-2.0.html
Terms of service: http://helloreverb.com/terms/
Host: petstore.swagger.wordnik.com
BasePath: /v2
Schemes: HTTP
## Paths
### Update an existing pet
```

View File

@@ -1,11 +1,16 @@
package io.github.robwin.swagger2markup;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.wordnik.swagger.models.Swagger;
import com.wordnik.swagger.util.Json;
import com.wordnik.swagger.util.Yaml;
import io.github.robwin.markup.builder.MarkupLanguage;
import io.github.robwin.swagger2markup.builder.document.DefinitionsDocument;
import io.github.robwin.swagger2markup.builder.document.OverviewDocument;
import io.github.robwin.swagger2markup.builder.document.PathsDocument;
import io.swagger.parser.SwaggerParser;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,6 +27,7 @@ public class Swagger2MarkupConverter {
private final MarkupLanguage markupLanguage;
private final String examplesFolderPath;
private final String schemasFolderPath;
private static final String OVERVIEW_DOCUMENT = "overview";
private static final String PATHS_DOCUMENT = "paths";
private static final String DEFINITIONS_DOCUMENT = "definitions";
@@ -41,12 +47,12 @@ public class Swagger2MarkupConverter {
/**
* Creates a Swagger2MarkupConverter.Builder using a given Swagger source.
*
* @param swaggerSource the Swagger source. Can be a HTTP url or a path to a local file.
* @param swaggerLocation the Swagger location. Can be a HTTP url or a path to a local file.
* @return a Swagger2MarkupConverter
*/
public static Builder from(String swaggerSource){
Validate.notEmpty(swaggerSource, "swaggerSource must not be empty!");
return new Builder(swaggerSource);
public static Builder from(String swaggerLocation){
Validate.notEmpty(swaggerLocation, "swaggerLocation must not be empty!");
return new Builder(swaggerLocation);
}
/**
@@ -60,6 +66,30 @@ public class Swagger2MarkupConverter {
return new Builder(swagger);
}
/**
* Creates a Swagger2MarkupConverter.Builder from a given Swagger YAML or JSON String.
*
* @param swagger the Swagger YAML or JSON String.
* @return a Swagger2MarkupConverter
*/
public static Builder fromString(String swagger) throws IOException {
Validate.notEmpty(swagger, "swagger must not be null!");
ObjectMapper mapper;
if(swagger.trim().startsWith("{")) {
mapper = Json.mapper();
}else {
mapper = Yaml.mapper();
}
JsonNode rootNode = mapper.readTree(swagger);
// must have swagger node set
JsonNode swaggerNode = rootNode.get("swagger");
if(swaggerNode == null)
throw new IllegalArgumentException("Swagger String is in the wrong format");
return new Builder(mapper.convertValue(rootNode, Swagger.class));
}
/**
* Builds the document with the given markup language and stores
* the files in the given folder.
@@ -88,6 +118,7 @@ public class Swagger2MarkupConverter {
* @throws IOException if a file cannot be written
*/
private void buildDocuments(String directory) throws IOException {
new OverviewDocument(swagger, markupLanguage).build().writeToFile(directory, OVERVIEW_DOCUMENT, StandardCharsets.UTF_8);
new PathsDocument(swagger, markupLanguage, examplesFolderPath).build().writeToFile(directory, PATHS_DOCUMENT, StandardCharsets.UTF_8);
new DefinitionsDocument(swagger, markupLanguage, schemasFolderPath).build().writeToFile(directory, DEFINITIONS_DOCUMENT, StandardCharsets.UTF_8);
}
@@ -98,8 +129,9 @@ public class Swagger2MarkupConverter {
* @return a the document as a String
*/
private String buildDocuments() throws IOException {
return new PathsDocument(swagger, markupLanguage, examplesFolderPath).build().toString()
.concat(new DefinitionsDocument(swagger, markupLanguage, schemasFolderPath).build().toString());
return new OverviewDocument(swagger, markupLanguage).build().toString().concat(
new PathsDocument(swagger, markupLanguage, examplesFolderPath).build().toString()
.concat(new DefinitionsDocument(swagger, markupLanguage, schemasFolderPath).build().toString()));
}
@@ -112,10 +144,10 @@ public class Swagger2MarkupConverter {
/**
* Creates a Builder using a given Swagger source.
*
* @param swaggerSource the Swagger source. Can be a HTTP url or a path to a local file.
* @param swaggerLocation the Swagger location. Can be a HTTP url or a path to a local file.
*/
Builder(String swaggerSource){
swagger = new SwaggerParser().read(swaggerSource);
Builder(String swaggerLocation){
swagger = new SwaggerParser().read(swaggerLocation);
}
/**
@@ -127,8 +159,6 @@ public class Swagger2MarkupConverter {
this.swagger = swagger;
}
public Swagger2MarkupConverter build(){
return new Swagger2MarkupConverter(markupLanguage, swagger, examplesFolderPath, schemasFolderPath);
}

View File

@@ -8,7 +8,7 @@ import io.github.robwin.markup.builder.MarkupLanguage;
import io.github.robwin.swagger2markup.utils.PropertyUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -107,19 +107,21 @@ public class DefinitionsDocument extends MarkupDocument {
List<String> headerAndContent = new ArrayList<>();
List<String> header = Arrays.asList(NAME_COLUMN, DESCRIPTION_COLUMN, SCHEMA_COLUMN, REQUIRED_COLUMN);
headerAndContent.add(StringUtils.join(header, DELIMITER));
for (Map.Entry<String, Property> propertyEntry : properties.entrySet()) {
Property property = propertyEntry.getValue();
String description = "";
if(property instanceof AbstractProperty){
if(StringUtils.isNotBlank(property.getDescription())){
description = property.getDescription();
if(MapUtils.isNotEmpty(properties)){
for (Map.Entry<String, Property> propertyEntry : properties.entrySet()) {
Property property = propertyEntry.getValue();
String description = "";
if(property instanceof AbstractProperty){
if(StringUtils.isNotBlank(property.getDescription())){
description = property.getDescription();
}
}
String type = PropertyUtils.getType(property, markupLanguage);
List<String> content = Arrays.asList(propertyEntry.getKey(), description, type, Boolean.toString(property.getRequired()));
headerAndContent.add(StringUtils.join(content, DELIMITER));
}
String type = PropertyUtils.getType(property, markupLanguage);
List<String> content = Arrays.asList(propertyEntry.getKey(), description, type, Boolean.toString(property.getRequired()));
headerAndContent.add(StringUtils.join(content, DELIMITER));
this.markupDocBuilder.tableWithHeaderRow(headerAndContent);
}
this.markupDocBuilder.tableWithHeaderRow(headerAndContent);
}
private void definitionSchema(String definitionName) throws IOException {

View File

@@ -21,6 +21,9 @@ public abstract class MarkupDocument {
protected static final String NAME_COLUMN = "Name";
protected static final String DESCRIPTION_COLUMN = "Description";
protected static final String DESCRIPTION = DESCRIPTION_COLUMN;
protected static final String PRODUCES = "Produces";
protected static final String CONSUMES = "Consumes";
protected static final String TAGS = "Tags";
protected Logger logger = LoggerFactory.getLogger(getClass());
protected Swagger swagger;
protected MarkupLanguage markupLanguage;

View File

@@ -0,0 +1,135 @@
package io.github.robwin.swagger2markup.builder.document;
import com.wordnik.swagger.models.*;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class OverviewDocument extends MarkupDocument {
private static final String OVERVIEW = "Overview";
private static final String CURRENT_VERSION = "Version information";
private static final String VERSION = "Version: ";
private static final String CONTACT_INFORMATION = "Contact information";
private static final String CONTACT_NAME = "Contact: ";
private static final String CONTACT_EMAIL = "Contact Email: ";
private static final String LICENSE_INFORMATION = "License information";
private static final String LICENSE = "License: ";
private static final String LICENSE_URL = "License URL: ";
private static final String TERMS_OF_SERVICE = "Terms of service: ";
private static final String URI_SCHEME = "URI scheme";
private static final String HOST = "Host: ";
private static final String BASE_PATH = "BasePath: ";
private static final String SCHEMES = "Schemes: ";
public OverviewDocument(Swagger swagger, MarkupLanguage markupLanguage){
super(swagger, markupLanguage);
}
/**
* Builds the MarkupDocument.
*
* @return the built MarkupDocument
* @throws java.io.IOException if the files to include are not readable
*/
@Override
public MarkupDocument build() throws IOException {
overview();
return this;
}
/**
* Builds the document header of the swagger model
*/
private void overview() {
Info info = swagger.getInfo();
this.markupDocBuilder.documentTitle(info.getTitle());
this.markupDocBuilder.sectionTitleLevel1(OVERVIEW);
if(StringUtils.isNotBlank(info.getDescription())){
this.markupDocBuilder.textLine(info.getDescription());
this.markupDocBuilder.newLine();
}
if(StringUtils.isNotBlank(info.getVersion())){
this.markupDocBuilder.sectionTitleLevel2(CURRENT_VERSION);
this.markupDocBuilder.textLine(VERSION + info.getVersion());
this.markupDocBuilder.newLine();
}
Contact contact = info.getContact();
if(contact != null){
this.markupDocBuilder.sectionTitleLevel2(CONTACT_INFORMATION);
if(StringUtils.isNotBlank(contact.getName())){
this.markupDocBuilder.textLine(CONTACT_NAME + contact.getName());
}
if(StringUtils.isNotBlank(contact.getEmail())){
this.markupDocBuilder.textLine(CONTACT_EMAIL + contact.getEmail());
}
this.markupDocBuilder.newLine();
}
License license = info.getLicense();
if(license != null) {
this.markupDocBuilder.sectionTitleLevel2(LICENSE_INFORMATION);
if (StringUtils.isNotBlank(license.getName())) {
this.markupDocBuilder.textLine(LICENSE + license.getName());
}
if (StringUtils.isNotBlank(license.getUrl())) {
this.markupDocBuilder.textLine(LICENSE_URL + license.getUrl());
}
this.markupDocBuilder.newLine();
}
if(StringUtils.isNotBlank(info.getTermsOfService())){
this.markupDocBuilder.textLine(TERMS_OF_SERVICE + info.getTermsOfService());
this.markupDocBuilder.newLine();
}
this.markupDocBuilder.sectionTitleLevel2(URI_SCHEME);
if(StringUtils.isNotBlank(swagger.getHost())){
this.markupDocBuilder.textLine(HOST + swagger.getHost());
}
if(StringUtils.isNotBlank(swagger.getBasePath())){
this.markupDocBuilder.textLine(BASE_PATH + swagger.getBasePath());
}
if(CollectionUtils.isNotEmpty(swagger.getSchemes())){
List<String> schemes = new ArrayList<>();
for(Scheme scheme : swagger.getSchemes()){
schemes.add(scheme.toString());
}
this.markupDocBuilder.textLine(SCHEMES + StringUtils.join(schemes, ", "));
}
this.markupDocBuilder.newLine();
if(CollectionUtils.isNotEmpty(swagger.getTags())){
this.markupDocBuilder.sectionTitleLevel2(TAGS);
List<String> tags = new ArrayList<>();
for(Tag tag : swagger.getTags()){
String name = tag.getName();
String description = tag.getDescription();
if(StringUtils.isNoneBlank(description)){
tags.add(name + ": " + description);
}
tags.add(name);
}
this.markupDocBuilder.unorderedList(tags);
this.markupDocBuilder.newLine();
}
if(CollectionUtils.isNotEmpty(swagger.getConsumes())){
this.markupDocBuilder.sectionTitleLevel2(CONSUMES);
this.markupDocBuilder.unorderedList(swagger.getConsumes());
this.markupDocBuilder.newLine();
}
if(CollectionUtils.isNotEmpty(swagger.getProduces())){
this.markupDocBuilder.sectionTitleLevel2(PRODUCES);
this.markupDocBuilder.unorderedList(swagger.getProduces());
this.markupDocBuilder.newLine();
}
}
}

View File

@@ -1,6 +1,9 @@
package io.github.robwin.swagger2markup.builder.document;
import com.wordnik.swagger.models.*;
import com.wordnik.swagger.models.Operation;
import com.wordnik.swagger.models.Path;
import com.wordnik.swagger.models.Response;
import com.wordnik.swagger.models.Swagger;
import com.wordnik.swagger.models.parameters.Parameter;
import com.wordnik.swagger.models.properties.Property;
import io.github.robwin.markup.builder.MarkupLanguage;
@@ -9,8 +12,8 @@ import io.github.robwin.swagger2markup.utils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -27,26 +30,15 @@ import java.util.Map;
public class PathsDocument extends MarkupDocument {
private static final String PATHS = "Paths";
private static final String VERSION = "Version: ";
private static final String CONTACT_NAME = "Contact: ";
private static final String CONTACT_EMAIL = "Contact Email: ";
private static final String LICENSE = "License: ";
private static final String LICENSE_URL = "License URL: ";
private static final String TERMS_OF_SERVICE = "Terms of service: ";
private static final String HOST = "Host: ";
private static final String BASE_PATH = "BasePath: ";
private static final String SCHEMES = "Schemes: ";
private static final String PARAMETERS = "Parameters";
private static final String PRODUCES = "Produces";
private static final String CONSUMES = "Consumes";
private static final String TAGS = "Tags";
private static final String RESPONSES = "Responses";
private static final String EXAMPLE_REQUEST = "Example request";
private static final String EXAMPLE_RESPONSE = "Example response";
private static final String TYPE_COLUMN = "Type";
private static final String HTTP_CODE_COLUMN = "HTTP Code";
private static final String REQUEST_EXAMPLE_FILE_NAME = "request";
private static final String RESPONSE_EXAMPLE_FILE_NAME = "response";
private static final String REQUEST_EXAMPLE_FILE_NAME = "http-request";
private static final String RESPONSE_EXAMPLE_FILE_NAME = "http-response";
private boolean examplesEnabled;
private String examplesFolderPath;
@@ -70,62 +62,10 @@ public class PathsDocument extends MarkupDocument {
@Override
public MarkupDocument build() throws IOException {
documentHeader();
paths();
return this;
}
/**
* Builds the document header of the swagger model
*/
private void documentHeader() {
Info info = swagger.getInfo();
this.markupDocBuilder.documentTitle(info.getTitle());
if(StringUtils.isNotBlank(info.getDescription())){
this.markupDocBuilder.textLine(info.getDescription());
}
if(StringUtils.isNotBlank(info.getVersion())){
this.markupDocBuilder.textLine(VERSION + info.getVersion());
}
Contact contact = info.getContact();
if(contact != null){
if(StringUtils.isNotBlank(contact.getName())){
this.markupDocBuilder.textLine(CONTACT_NAME + contact.getName());
}
if(StringUtils.isNotBlank(contact.getEmail())){
this.markupDocBuilder.textLine(CONTACT_EMAIL + contact.getEmail());
}
}
License license = info.getLicense();
if(license != null) {
if (StringUtils.isNotBlank(license.getName())) {
this.markupDocBuilder.textLine(LICENSE + license.getName());
}
if (StringUtils.isNotBlank(license.getUrl())) {
this.markupDocBuilder.textLine(LICENSE_URL + license.getUrl());
}
}
if(StringUtils.isNotBlank(info.getTermsOfService())){
this.markupDocBuilder.textLine(TERMS_OF_SERVICE + info.getTermsOfService());
}
this.markupDocBuilder.newLine();
if(StringUtils.isNotBlank(swagger.getHost())){
this.markupDocBuilder.textLine(HOST + swagger.getHost());
}
if(StringUtils.isNotBlank(swagger.getBasePath())){
this.markupDocBuilder.textLine(BASE_PATH + swagger.getBasePath());
}
if(CollectionUtils.isNotEmpty(swagger.getSchemes())){
List<String> schemes = new ArrayList<>();
for(Scheme scheme : swagger.getSchemes()){
schemes.add(scheme.toString());
}
this.markupDocBuilder.textLine(SCHEMES + StringUtils.join(schemes, ", "));
}
this.markupDocBuilder.newLine();
}
/**
* Builds all paths of the Swagger model
*/
@@ -135,11 +75,13 @@ public class PathsDocument extends MarkupDocument {
this.markupDocBuilder.sectionTitleLevel1(PATHS);
for (Map.Entry<String, Path> entry : paths.entrySet()) {
Path path = entry.getValue();
path("GET", entry.getKey(), path.getGet());
path("PUT", entry.getKey(), path.getPut());
path("DELETE", entry.getKey(), path.getDelete());
path("POST", entry.getKey(), path.getPost());
path("PATCH", entry.getKey(), path.getPatch());
if(path != null) {
path("GET", entry.getKey(), path.getGet());
path("PUT", entry.getKey(), path.getPut());
path("DELETE", entry.getKey(), path.getDelete());
path("POST", entry.getKey(), path.getPost());
path("PATCH", entry.getKey(), path.getPatch());
}
}
}
}

View File

@@ -5,7 +5,7 @@ import com.wordnik.swagger.models.Model;
import com.wordnik.swagger.models.ModelImpl;
import com.wordnik.swagger.models.RefModel;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.Validate;
public final class ModelUtils {

View File

@@ -3,8 +3,12 @@ package io.github.robwin.swagger2markup.utils;
import com.wordnik.swagger.models.Model;
import com.wordnik.swagger.models.parameters.*;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.util.List;
public final class ParameterUtils {
@@ -22,7 +26,12 @@ public final class ParameterUtils {
}
else if(parameter instanceof QueryParameter){
QueryParameter queryParameter = (QueryParameter)parameter;
type = getTypeWithFormat(queryParameter.getType(), queryParameter.getFormat());
List<String> enums = queryParameter.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = getTypeWithFormat(queryParameter.getType(), queryParameter.getFormat());
}
if(type.equals("array")){
String collectionFormat = queryParameter.getCollectionFormat();
type = collectionFormat + " " + PropertyUtils.getType(queryParameter.getItems(), markupLanguage) + " " + type;
@@ -30,15 +39,42 @@ public final class ParameterUtils {
}
else if(parameter instanceof HeaderParameter){
HeaderParameter headerParameter = (HeaderParameter)parameter;
type = getTypeWithFormat(headerParameter.getType(), headerParameter.getFormat());
List<String> enums = headerParameter.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = getTypeWithFormat(headerParameter.getType(), headerParameter.getFormat());
}
if(type.equals("array")){
String collectionFormat = headerParameter.getCollectionFormat();
type = collectionFormat + " " + PropertyUtils.getType(headerParameter.getItems(), markupLanguage) + " " + type;
}
}
else if(parameter instanceof FormParameter){
FormParameter formParameter = (FormParameter)parameter;
type = formParameter.getType();
List<String> enums = formParameter.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = getTypeWithFormat(formParameter.getType(), formParameter.getFormat());
}
if(type.equals("array")){
String collectionFormat = formParameter.getCollectionFormat();
type = collectionFormat + " " + PropertyUtils.getType(formParameter.getItems(), markupLanguage) + " " + type;
}
}
else if(parameter instanceof CookieParameter){
CookieParameter cookieParameter = (CookieParameter)parameter;
type = getTypeWithFormat(cookieParameter.getType(), cookieParameter.getFormat());
List<String> enums = cookieParameter.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = getTypeWithFormat(cookieParameter.getType(), cookieParameter.getFormat());
}
if(type.equals("array")){
String collectionFormat = cookieParameter.getCollectionFormat();
type = collectionFormat + " " + PropertyUtils.getType(cookieParameter.getItems(), markupLanguage) + " " + type;
}
}
else if(parameter instanceof RefParameter){
RefParameter refParameter = (RefParameter)parameter;

View File

@@ -6,8 +6,8 @@ import com.wordnik.swagger.models.properties.RefProperty;
import com.wordnik.swagger.models.properties.StringProperty;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.util.List;

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
</configuration>

View File

@@ -17,25 +17,29 @@ import java.nio.file.Paths;
public class Swagger2MarkupConverterTest {
@Test
public void testSwagger2MarkupConversion() throws IOException {
public void testSwagger2AsciiDocConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
Swagger2MarkupConverter.from(file.getAbsolutePath()).
withExamples("docs").withSchemas("docs/schemas").build()
.intoFolder("src/docs/asciidoc/generated");
}
@Test
public void testSwagger2MarkdownConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
Swagger2MarkupConverter.from(file.getAbsolutePath()).
withMarkupLanguage(MarkupLanguage.MARKDOWN).
withExamples("docs").withSchemas("docs/schemas").build()
.intoFolder("src/docs/markdown");
Swagger2MarkupConverter.from(file.getAbsolutePath()).
withExamples("docs").withSchemas("docs/schemas").build()
.intoFolder("src/docs/asciidoc");
.intoFolder("src/docs/markdown/generated");
}
@Test
public void testSwagger2HtmlConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
String asciiDoc = Swagger2MarkupConverter.from(file.getAbsolutePath()).build().asString();
String path = "src/docs/asciidocAsString";
String path = "src/docs/generated/asciidocAsString";
Files.createDirectories(Paths.get(path));
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "swagger.adoc"), StandardCharsets.UTF_8)){
writer.write(asciiDoc); }
@@ -46,21 +50,20 @@ public class Swagger2MarkupConverterTest {
writer.write(asciiDocAsHtml);
}
}
/*
@Test
public void testSwagger2PdfConversion() throws IOException {
public void testSpica2HtmlConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/spica.json").getFile());
String asciiDoc = Swagger2MarkupConverter.from(file.getAbsolutePath()).build().asString();
String path = "src/docs/asciidocAsString";
String path = "src/docs/generated/asciidocAsString";
Files.createDirectories(Paths.get(path));
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "spica.adoc"), StandardCharsets.UTF_8)){
writer.write(asciiDoc);
}
String asciiDocAsPdf= Asciidoctor.Factory.create().convert(asciiDoc, OptionsBuilder.options().backend("pdf"));
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "spica.pdf"), StandardCharsets.UTF_8)){
writer.write(asciiDocAsPdf);
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, "spica.html"), StandardCharsets.UTF_8)){
writer.write(asciiDocAsHtml);
}
}
*/
}

View File

@@ -3,7 +3,7 @@
"info": {
"description": "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
"version": "1.0.0",
"title": "Swagger Petstore",
"title": "Swagger Petstore API",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "apiteam@wordnik.com"