Update html, dynamic-html petstore, fix example value for form parameters (#122)

* update dynamic-html samples with oas2

* update dynamic-html oas3 (no change)

* update html petstore (oas2)

* update html petstore with oas3

* fix example value for form parameters

* fix javadoc string
This commit is contained in:
William Cheng 2018-04-18 17:42:38 +08:00 committed by GitHub
parent 391c75b5b3
commit 05f5c5798b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 299 additions and 314 deletions

31
bin/openapi3/dynamic-html.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l dynamic-html -o samples/dynamic-html"
java $JAVA_OPTS -jar $executable $ags

31
bin/openapi3/html-petstore.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l html -o samples/html"
java $JAVA_OPTS -jar $executable $ags

31
bin/openapi3/html2-petstore.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l html2 -o samples/html2 --additional-properties hideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1022,9 +1022,40 @@ public class DefaultCodegen implements CodegenConfig {
/**
* Return the example value of the parameter.
*
* @param p Codegen parameter
* @param codegenParameter Codegen parameter
*/
public void setParameterExampleValue(CodegenParameter p) {
public void setParameterExampleValue(CodegenParameter codegenParameter) {
// set the example value
// if not specified in x-example, generate a default value
// TODO need to revise how to obtain the example value
if (codegenParameter.vendorExtensions != null && codegenParameter.vendorExtensions.containsKey("x-example")) {
codegenParameter.example = Json.pretty(codegenParameter.vendorExtensions.get("x-example"));
} else if (Boolean.TRUE.equals(codegenParameter.isBoolean)) {
codegenParameter.example = "true";
} else if (Boolean.TRUE.equals(codegenParameter.isLong)) {
codegenParameter.example = "789";
} else if (Boolean.TRUE.equals(codegenParameter.isInteger)) {
codegenParameter.example = "56";
} else if (Boolean.TRUE.equals(codegenParameter.isFloat)) {
codegenParameter.example = "3.4";
} else if (Boolean.TRUE.equals(codegenParameter.isDouble)) {
codegenParameter.example = "1.2";
} else if (Boolean.TRUE.equals(codegenParameter.isBinary)) {
codegenParameter.example = "BINARY_DATA_HERE";
} else if (Boolean.TRUE.equals(codegenParameter.isByteArray)) {
codegenParameter.example = "BYTE_ARRAY_DATA_HERE";
} else if (Boolean.TRUE.equals(codegenParameter.isFile)) {
codegenParameter.example = "/path/to/file.txt";
} else if (Boolean.TRUE.equals(codegenParameter.isDate)) {
codegenParameter.example = "2013-10-20";
} else if (Boolean.TRUE.equals(codegenParameter.isDateTime)) {
codegenParameter.example = "2013-10-20T19:20:30+01:00";
} else if (Boolean.TRUE.equals(codegenParameter.isUuid)) {
codegenParameter.example = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
} else if (Boolean.TRUE.equals(codegenParameter.isString)) {
codegenParameter.example = codegenParameter.paramName + "_example";
}
}
@ -2683,39 +2714,6 @@ public class DefaultCodegen implements CodegenConfig {
LOGGER.warn("Unknown parameter type: " + parameter.getName());
}
// set the example value
// if not specified in x-example, generate a default value
// TODO need to revise how to obtain the example value
if (codegenParameter.vendorExtensions != null && codegenParameter.vendorExtensions.containsKey("x-example")) {
codegenParameter.example = Json.pretty(codegenParameter.vendorExtensions.get("x-example"));
} else if (Boolean.TRUE.equals(codegenParameter.isString)) {
codegenParameter.example = codegenParameter.paramName + "_example";
} else if (Boolean.TRUE.equals(codegenParameter.isBoolean)) {
codegenParameter.example = "true";
} else if (Boolean.TRUE.equals(codegenParameter.isLong)) {
codegenParameter.example = "789";
} else if (Boolean.TRUE.equals(codegenParameter.isInteger)) {
codegenParameter.example = "56";
} else if (Boolean.TRUE.equals(codegenParameter.isFloat)) {
codegenParameter.example = "3.4";
} else if (Boolean.TRUE.equals(codegenParameter.isDouble)) {
codegenParameter.example = "1.2";
} else if (Boolean.TRUE.equals(codegenParameter.isBinary)) {
codegenParameter.example = "BINARY_DATA_HERE";
} else if (Boolean.TRUE.equals(codegenParameter.isByteArray)) {
codegenParameter.example = "B";
} else if (Boolean.TRUE.equals(codegenParameter.isFile)) {
codegenParameter.example = "/path/to/file.txt";
} else if (Boolean.TRUE.equals(codegenParameter.isDate)) {
codegenParameter.example = "2013-10-20";
} else if (Boolean.TRUE.equals(codegenParameter.isDateTime)) {
codegenParameter.example = "2013-10-20T19:20:30+01:00";
} else if (Boolean.TRUE.equals(codegenParameter.isUuid)) {
codegenParameter.example = "38400000-8cf0-11bd-b23e-10b96e4ef00d";
} else if (Boolean.TRUE.equals(codegenParameter.isFile)) {
codegenParameter.example = "/path/to/file.txt";
}
// set the parameter excample value
// should be overridden by lang codegen
setParameterExampleValue(codegenParameter);

View File

@ -202,7 +202,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi
/**
* Parse Markdown to HTML for the main "Description" attribute
*
* @param swagger The base object containing the global description through "Info" class
* @param openAPI The base object containing the global description through "Info" class
* @return Void
*/
private void preparHtmlForGlobalDescription(OpenAPI openAPI) {

View File

@ -1 +1 @@
2.2.3-SNAPSHOT
3.0.0-SNAPSHOT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -5,7 +5,7 @@
<h2><a name="addPet"></a>addPet</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/pet</code>
<h3 class="section">HTTP Method</h3>
@ -20,7 +20,7 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-name">Pet</span>
<span class="param-type">Pet(Pet)</span>
<p class="param-description">Pet object that needs to be added to the store</p>
@ -29,7 +29,7 @@
<h2><a name="deletePet"></a>deletePet</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/pet/{petId}</code>
<h3 class="section">HTTP Method</h3>
@ -136,7 +136,7 @@
<h2><a name="updatePet"></a>updatePet</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/pet</code>
<h3 class="section">HTTP Method</h3>
@ -151,7 +151,7 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-name">Pet</span>
<span class="param-type">Pet(Pet)</span>
<p class="param-description">Pet object that needs to be added to the store</p>
@ -160,7 +160,7 @@
<h2><a name="updatePetWithForm"></a>updatePetWithForm</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/pet/{petId}</code>
<h3 class="section">HTTP Method</h3>
@ -187,7 +187,7 @@
<span class="param-name">name</span>
<span class="param-type">String</span>
<span class="param-type">String(string)</span>
<p class="param-description">Updated name of the pet</p>
</li>
@ -198,7 +198,7 @@
<span class="param-name">status</span>
<span class="param-type">String</span>
<span class="param-type">String(string)</span>
<p class="param-description">Updated status of the pet</p>
</li>
@ -206,7 +206,7 @@
<h2><a name="uploadFile"></a>uploadFile</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/pet/{petId}/uploadImage</code>
<h3 class="section">HTTP Method</h3>
@ -233,7 +233,7 @@
<span class="param-name">additionalMetadata</span>
<span class="param-type">String</span>
<span class="param-type">String(string)</span>
<p class="param-description">Additional data to pass to server</p>
</li>
@ -244,7 +244,7 @@
<span class="param-name">file</span>
<span class="param-type">File</span>
<span class="param-type">File(file)</span>
<p class="param-description">file to upload</p>
</li>

View File

@ -66,7 +66,7 @@
<h2><a name="placeOrder"></a>placeOrder</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/store/order</code>
<h3 class="section">HTTP Method</h3>
@ -81,7 +81,7 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-name">Order</span>
<span class="param-type">Order(Order)</span>
<p class="param-description">order placed for purchasing the pet</p>

View File

@ -20,7 +20,7 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-name">User</span>
<span class="param-type">User(User)</span>
<p class="param-description">Created user object</p>
@ -29,7 +29,7 @@
<h2><a name="createUsersWithArrayInput"></a>createUsersWithArrayInput</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/user/createWithArray</code>
<h3 class="section">HTTP Method</h3>
@ -44,8 +44,8 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-type">List(User)</span>
<span class="param-name">array</span>
<span class="param-type">List(array)</span>
<p class="param-description">List of user object</p>
</li>
@ -53,7 +53,7 @@
<h2><a name="createUsersWithListInput"></a>createUsersWithListInput</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/user/createWithList</code>
<h3 class="section">HTTP Method</h3>
@ -68,8 +68,8 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-type">List(User)</span>
<span class="param-name">array</span>
<span class="param-type">List(array)</span>
<p class="param-description">List of user object</p>
</li>
@ -101,7 +101,7 @@
<h2><a name="getUserByName"></a>getUserByName</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/user/{username}</code>
<h3 class="section">HTTP Method</h3>
@ -125,7 +125,7 @@
<h2><a name="loginUser"></a>loginUser</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/user/login</code>
<h3 class="section">HTTP Method</h3>
@ -160,7 +160,7 @@
<h2><a name="logoutUser"></a>logoutUser</h2>
<hr>
<p></p>
<p></p>
<h3 class="section">URL</h3>
<code>http://petstore.swagger.io/v2/user/logout</code>
<h3 class="section">HTTP Method</h3>
@ -199,7 +199,7 @@
<span class="param-in">Body: </span>
<span class="param-name">body</span>
<span class="param-name">User</span>
<span class="param-type">User(User)</span>
<p class="param-description">Updated user object</p>

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -237,18 +237,12 @@ font-style: italic;
<div class="method-notes"></div>
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>application/json</code></li>
<li><code>application/xml</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#Pet">Pet</a> (required)</div>
<div class="param">Pet <a href="#Pet">Pet</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; Pet object that needs to be added to the store </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -259,13 +253,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">405</h4>
@ -300,13 +287,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">400</h4>
@ -341,6 +321,25 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>
@ -353,41 +352,6 @@ font-style: italic;
</tags>
<status>aeiou</status>
</Pet></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -433,6 +397,25 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>
@ -445,41 +428,6 @@ font-style: italic;
</tags>
<status>aeiou</status>
</Pet></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
}, {
"photoUrls" : [ "photoUrls", "photoUrls" ],
"name" : "doggie",
"id" : 0,
"category" : {
"name" : "name",
"id" : 6
},
"tags" : [ {
"name" : "name",
"id" : 1
}, {
"name" : "name",
"id" : 1
} ],
"status" : "available"
} ]</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -525,18 +473,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
@ -556,6 +492,18 @@ font-style: italic;
} ],
"status" : "available"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>
<id>123456789</id>
<name>doggie</name>
<photoUrls>
<photoUrls>aeiou</photoUrls>
</photoUrls>
<tags>
</tags>
<status>aeiou</status>
</Pet></code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -585,18 +533,12 @@ font-style: italic;
<div class="method-notes"></div>
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>application/json</code></li>
<li><code>application/xml</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#Pet">Pet</a> (required)</div>
<div class="param">Pet <a href="#Pet">Pet</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; Pet object that needs to be added to the store </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -607,13 +549,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">400</h4>
@ -663,13 +598,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">405</h4>
@ -706,7 +634,7 @@ font-style: italic;
<div class="param-desc"><span class="param-type">Form Parameter</span> &mdash; Additional data to pass to server </div><div class="param">file (optional)</div>
<div class="param-desc"><span class="param-type">Form Parameter</span> &mdash; file to upload </div>
<div class="param-desc"><span class="param-type">Form Parameter</span> &mdash; file to upload format: binary</div>
</div> <!-- field-items -->
<h3 class="field-label">Return type</h3>
@ -762,13 +690,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">400</h4>
@ -846,16 +767,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
@ -866,6 +777,16 @@ font-style: italic;
"complete" : false,
"status" : "placed"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order></code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -895,12 +816,17 @@ font-style: italic;
<div class="method-notes"></div>
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#Order">Order</a> (required)</div>
<div class="param">Order <a href="#Order">Order</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; order placed for purchasing the pet </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -915,16 +841,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
@ -935,6 +851,16 @@ font-style: italic;
"complete" : false,
"status" : "placed"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>
<id>123456789</id>
<petId>123456789</petId>
<quantity>123</quantity>
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
<status>aeiou</status>
<complete>true</complete>
</Order></code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -962,12 +888,17 @@ font-style: italic;
<div class="method-notes">This can only be done by the logged in user.</div>
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#User">User</a> (required)</div>
<div class="param">User <a href="#User">User</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; Created user object </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -978,13 +909,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">default</h4>
@ -1003,9 +927,9 @@ font-style: italic;
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#User">User</a> (required)</div>
<div class="param">array <a href="#array">array</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; List of user object </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -1016,13 +940,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">default</h4>
@ -1041,9 +958,9 @@ font-style: italic;
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#User">User</a> (required)</div>
<div class="param">array <a href="#array">array</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; List of user object </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -1054,13 +971,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">default</h4>
@ -1091,13 +1001,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">400</h4>
@ -1135,18 +1038,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><User>
<id>123456789</id>
<username>aeiou</username>
<firstName>aeiou</firstName>
<lastName>aeiou</lastName>
<email>aeiou</email>
<password>aeiou</password>
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User></code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{
@ -1159,6 +1050,18 @@ font-style: italic;
"email" : "email",
"username" : "username"
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><User>
<id>123456789</id>
<username>aeiou</username>
<firstName>aeiou</firstName>
<lastName>aeiou</lastName>
<email>aeiou</email>
<password>aeiou</password>
<phone>aeiou</phone>
<userStatus>123</userStatus>
</User></code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -1209,12 +1112,12 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>aeiou</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>""</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>aeiou</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
@ -1250,13 +1153,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">default</h4>
@ -1278,12 +1174,17 @@ font-style: italic;
<div class="param-desc"><span class="param-type">Path Parameter</span> &mdash; name that need to be deleted </div>
</div> <!-- field-items -->
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">body <a href="#User">User</a> (required)</div>
<div class="param">User <a href="#User">User</a> (required)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; Updated user object </div>
<div class="param-desc"><span class="param-type">Body Parameter</span> &mdash; </div>
</div> <!-- field-items -->
@ -1294,13 +1195,6 @@ font-style: italic;
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/xml</code></li>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">400</h4>

View File

@ -1 +1 @@
2.3.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -16,7 +16,7 @@ trait DataAccessor {
*
* @return A Unit
*/
def Pet_addPet(body: Pet): Either[CommonError,Unit] = ???
def Pet_addPet(pet: Pet): Either[CommonError,Unit] = ???
/**
*
@ -46,7 +46,7 @@ trait DataAccessor {
*
* @return A Unit
*/
def Pet_updatePet(body: Pet): Either[CommonError,Unit] = ???
def Pet_updatePet(pet: Pet): Either[CommonError,Unit] = ???
/**
*
@ -82,25 +82,25 @@ trait DataAccessor {
*
* @return A Order
*/
def Store_placeOrder(body: Order): Either[CommonError,Order] = ???
def Store_placeOrder(order: Order): Either[CommonError,Order] = ???
/**
*
* @return A Unit
*/
def User_createUser(body: User): Either[CommonError,Unit] = ???
def User_createUser(user: User): Either[CommonError,Unit] = ???
/**
*
* @return A Unit
*/
def User_createUsersWithArrayInput(body: Seq[User]): Either[CommonError,Unit] = ???
def User_createUsersWithArrayInput(seq: Seq[User]): Either[CommonError,Unit] = ???
/**
*
* @return A Unit
*/
def User_createUsersWithListInput(body: Seq[User]): Either[CommonError,Unit] = ???
def User_createUsersWithListInput(seq: Seq[User]): Either[CommonError,Unit] = ???
/**
*
@ -130,6 +130,6 @@ trait DataAccessor {
*
* @return A Unit
*/
def User_updateUser(username: String, body: User): Either[CommonError,Unit] = ???
def User_updateUser(username: String, user: User): Either[CommonError,Unit] = ???
}

View File

@ -60,8 +60,8 @@ object PetApi {
* @return An endpoint representing a Unit
*/
private def addPet(da: DataAccessor): Endpoint[Unit] =
post("pet" :: jsonBody[Pet]) { (body: Pet) =>
da.Pet_addPet(body) match {
post("pet" :: jsonBody[Pet]) { (pet: Pet) =>
da.Pet_addPet(pet) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}
@ -130,8 +130,8 @@ object PetApi {
* @return An endpoint representing a Unit
*/
private def updatePet(da: DataAccessor): Endpoint[Unit] =
put("pet" :: jsonBody[Pet]) { (body: Pet) =>
da.Pet_updatePet(body) match {
put("pet" :: jsonBody[Pet]) { (pet: Pet) =>
da.Pet_updatePet(pet) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}

View File

@ -96,8 +96,8 @@ object StoreApi {
* @return An endpoint representing a Order
*/
private def placeOrder(da: DataAccessor): Endpoint[Order] =
post("store" :: "order" :: jsonBody[Order]) { (body: Order) =>
da.Store_placeOrder(body) match {
post("store" :: "order" :: jsonBody[Order]) { (order: Order) =>
da.Store_placeOrder(order) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}

View File

@ -59,8 +59,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def createUser(da: DataAccessor): Endpoint[Unit] =
post("user" :: jsonBody[User]) { (body: User) =>
da.User_createUser(body) match {
post("user" :: jsonBody[User]) { (user: User) =>
da.User_createUser(user) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}
@ -73,8 +73,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def createUsersWithArrayInput(da: DataAccessor): Endpoint[Unit] =
post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (body: Seq[User]) =>
da.User_createUsersWithArrayInput(body) match {
post("user" :: "createWithArray" :: jsonBody[Seq[User]]) { (seq: Seq[User]) =>
da.User_createUsersWithArrayInput(seq) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}
@ -87,8 +87,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def createUsersWithListInput(da: DataAccessor): Endpoint[Unit] =
post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (body: Seq[User]) =>
da.User_createUsersWithListInput(body) match {
post("user" :: "createWithList" :: jsonBody[Seq[User]]) { (seq: Seq[User]) =>
da.User_createUsersWithListInput(seq) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}
@ -157,8 +157,8 @@ object UserApi {
* @return An endpoint representing a Unit
*/
private def updateUser(da: DataAccessor): Endpoint[Unit] =
put("user" :: string :: jsonBody[User]) { (username: String, body: User) =>
da.User_updateUser(username, body) match {
put("user" :: string :: jsonBody[User]) { (username: String, user: User) =>
da.User_updateUser(username, user) match {
case Left(error) => checkError(error)
case Right(data) => Ok(data)
}