diff --git a/bin/openapi3/dynamic-html.sh b/bin/openapi3/dynamic-html.sh new file mode 100755 index 00000000000..8912d7917cc --- /dev/null +++ b/bin/openapi3/dynamic-html.sh @@ -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 diff --git a/bin/openapi3/html-petstore.sh b/bin/openapi3/html-petstore.sh new file mode 100755 index 00000000000..b67ac005e84 --- /dev/null +++ b/bin/openapi3/html-petstore.sh @@ -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 diff --git a/bin/openapi3/html2-petstore.sh b/bin/openapi3/html2-petstore.sh new file mode 100755 index 00000000000..eb796be4a15 --- /dev/null +++ b/bin/openapi3/html2-petstore.sh @@ -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 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 7f2d35fd160..bdd5f7f68cf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -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"; + } } @@ -1360,7 +1391,7 @@ public class DefaultCodegen implements CodegenConfig { allProperties = new LinkedHashMap(); allRequired = new ArrayList(); m.allVars = new ArrayList(); - if(composed.getAllOf() != null) { + if (composed.getAllOf() != null) { int modelImplCnt = 0; // only one inline object allowed in a ComposedModel for (Schema innerModel : composed.getAllOf()) { if (m.discriminator == null) { @@ -2345,7 +2376,7 @@ public class DefaultCodegen implements CodegenConfig { ArraySchema as = (ArraySchema) responseSchema; CodegenProperty innerProperty = fromProperty("response", as.getItems()); CodegenProperty innerCp = innerProperty; - while(innerCp != null) { + while (innerCp != null) { r.baseType = innerCp.baseType; innerCp = innerCp.items; } @@ -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); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java index 19319738245..231d5ab1a17 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java @@ -60,7 +60,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); - + additionalProperties.put("appName", "Swagger Sample"); additionalProperties.put("appDescription", "A sample swagger server"); additionalProperties.put("infoUrl", "https://helloreverb.com"); @@ -123,8 +123,8 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi List operationList = (List) operations.get("operation"); for (CodegenOperation op : operationList) { op.httpMethod = op.httpMethod.toLowerCase(); - for (CodegenResponse response : op.responses){ - if ("0".equals(response.code)){ + for (CodegenResponse response : op.responses) { + if ("0".equals(response.code)) { response.code = "default"; } } @@ -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) { @@ -213,7 +213,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi String currentDescription = openAPI.getInfo().getDescription(); if (currentDescription != null && !currentDescription.isEmpty()) { Markdown markInstance = new Markdown(); - openAPI.getInfo().setDescription( markInstance.toHtml(currentDescription) ); + openAPI.getInfo().setDescription(markInstance.toHtml(currentDescription)); } else { LOGGER.error("OpenAPI object description is empty [" + openAPI.getInfo().getTitle() + "]"); } @@ -227,7 +227,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi */ public List postProcessParameterEnum(List parameterList) { String enumFormatted = ""; - for(CodegenParameter parameter : parameterList) { + for (CodegenParameter parameter : parameterList) { if (parameter.isEnum) { for (int i = 0; i < parameter._enum.size(); i++) { String spacer = (i == (parameter._enum.size() - 1)) ? " " : ", "; @@ -268,5 +268,5 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi public String escapeUnsafeCharacters(String input) { // just return the original string return input; - } + } } diff --git a/samples/dynamic-html/.swagger-codegen/VERSION b/samples/dynamic-html/.swagger-codegen/VERSION index 7fea99011a6..096bf47efe3 100644 --- a/samples/dynamic-html/.swagger-codegen/VERSION +++ b/samples/dynamic-html/.swagger-codegen/VERSION @@ -1 +1 @@ -2.2.3-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/dynamic-html/docs/assets/images/logo.png b/samples/dynamic-html/docs/assets/images/logo.png index 209e5a473fc..6b704e25f99 100644 Binary files a/samples/dynamic-html/docs/assets/images/logo.png and b/samples/dynamic-html/docs/assets/images/logo.png differ diff --git a/samples/dynamic-html/docs/operations/PetApi.html b/samples/dynamic-html/docs/operations/PetApi.html index b1fd0c7d62c..75a5fda414f 100644 --- a/samples/dynamic-html/docs/operations/PetApi.html +++ b/samples/dynamic-html/docs/operations/PetApi.html @@ -5,7 +5,7 @@

addPet


-

+

URL

http://petstore.swagger.io/v2/pet

HTTP Method

@@ -20,7 +20,7 @@ Body: - body + Pet Pet(Pet)

Pet object that needs to be added to the store

@@ -29,7 +29,7 @@

deletePet


-

+

URL

http://petstore.swagger.io/v2/pet/{petId}

HTTP Method

@@ -136,7 +136,7 @@

updatePet


-

+

URL

http://petstore.swagger.io/v2/pet

HTTP Method

@@ -151,7 +151,7 @@ Body: - body + Pet Pet(Pet)

Pet object that needs to be added to the store

@@ -160,7 +160,7 @@

updatePetWithForm


-

+

URL

http://petstore.swagger.io/v2/pet/{petId}

HTTP Method

@@ -187,7 +187,7 @@ name - String + String(string)

Updated name of the pet

@@ -198,7 +198,7 @@ status - String + String(string)

Updated status of the pet

@@ -206,7 +206,7 @@

uploadFile


-

+

URL

http://petstore.swagger.io/v2/pet/{petId}/uploadImage

HTTP Method

@@ -233,7 +233,7 @@ additionalMetadata - String + String(string)

Additional data to pass to server

@@ -244,7 +244,7 @@ file - File + File(file)

file to upload

diff --git a/samples/dynamic-html/docs/operations/StoreApi.html b/samples/dynamic-html/docs/operations/StoreApi.html index 4d4c7eeed50..cb880712d31 100644 --- a/samples/dynamic-html/docs/operations/StoreApi.html +++ b/samples/dynamic-html/docs/operations/StoreApi.html @@ -66,7 +66,7 @@

placeOrder


-

+

URL

http://petstore.swagger.io/v2/store/order

HTTP Method

@@ -81,7 +81,7 @@ Body: - body + Order Order(Order)

order placed for purchasing the pet

diff --git a/samples/dynamic-html/docs/operations/UserApi.html b/samples/dynamic-html/docs/operations/UserApi.html index cdd84feedac..bd2447afcd6 100644 --- a/samples/dynamic-html/docs/operations/UserApi.html +++ b/samples/dynamic-html/docs/operations/UserApi.html @@ -20,7 +20,7 @@ Body: - body + User User(User)

Created user object

@@ -29,7 +29,7 @@

createUsersWithArrayInput


-

+

URL

http://petstore.swagger.io/v2/user/createWithArray

HTTP Method

@@ -44,8 +44,8 @@ Body: - body - List(User) + array + List(array)

List of user object

@@ -53,7 +53,7 @@

createUsersWithListInput


-

+

URL

http://petstore.swagger.io/v2/user/createWithList

HTTP Method

@@ -68,8 +68,8 @@ Body: - body - List(User) + array + List(array)

List of user object

@@ -101,7 +101,7 @@

getUserByName


-

+

URL

http://petstore.swagger.io/v2/user/{username}

HTTP Method

@@ -119,13 +119,13 @@ username String -

The name that needs to be fetched. Use user1 for testing.

+

The name that needs to be fetched. Use user1 for testing.

loginUser


-

+

URL

http://petstore.swagger.io/v2/user/login

HTTP Method

@@ -160,7 +160,7 @@

logoutUser


-

+

URL

http://petstore.swagger.io/v2/user/logout

HTTP Method

@@ -199,7 +199,7 @@ Body: - body + User User(User)

Updated user object

diff --git a/samples/html/.swagger-codegen/VERSION b/samples/html/.swagger-codegen/VERSION index 855ff9501eb..096bf47efe3 100644 --- a/samples/html/.swagger-codegen/VERSION +++ b/samples/html/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/html/index.html b/samples/html/index.html index b38b66a92d3..8ad459e8c73 100644 --- a/samples/html/index.html +++ b/samples/html/index.html @@ -237,18 +237,12 @@ font-style: italic;
-

Consumes

- This API call consumes the following media types via the Content-Type request header: -
    -
  • application/json
  • -
  • application/xml
  • -

Request body

-
body Pet (required)
+
Pet Pet (required)
-
Body Parameter — Pet object that needs to be added to the store
+
Body Parameter
@@ -259,13 +253,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

405

@@ -300,13 +287,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

400

@@ -341,6 +321,25 @@ font-style: italic; +

Example data

+
Content-Type: application/json
+
{
+  "photoUrls" : [ "photoUrls", "photoUrls" ],
+  "name" : "doggie",
+  "id" : 0,
+  "category" : {
+    "name" : "name",
+    "id" : 6
+  },
+  "tags" : [ {
+    "name" : "name",
+    "id" : 1
+  }, {
+    "name" : "name",
+    "id" : 1
+  } ],
+  "status" : "available"
+}

Example data

Content-Type: application/xml

@@ -353,41 +352,6 @@ font-style: italic;
   
   aeiou
 
-

Example data

-
Content-Type: application/json
-
[ {
-  "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"
-} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -433,6 +397,25 @@ font-style: italic; +

Example data

+
Content-Type: application/json
+
{
+  "photoUrls" : [ "photoUrls", "photoUrls" ],
+  "name" : "doggie",
+  "id" : 0,
+  "category" : {
+    "name" : "name",
+    "id" : 6
+  },
+  "tags" : [ {
+    "name" : "name",
+    "id" : 1
+  }, {
+    "name" : "name",
+    "id" : 1
+  } ],
+  "status" : "available"
+}

Example data

Content-Type: application/xml

@@ -445,41 +428,6 @@ font-style: italic;
   
   aeiou
 
-

Example data

-
Content-Type: application/json
-
[ {
-  "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"
-} ]

Produces

This API call produces the following media types according to the Accept request header; @@ -525,18 +473,6 @@ font-style: italic; -

Example data

-
Content-Type: application/xml
-

-  123456789
-  doggie
-  
-    aeiou
-  
-  
-  
-  aeiou
-

Example data

Content-Type: application/json
{
@@ -556,6 +492,18 @@ font-style: italic;
   } ],
   "status" : "available"
 }
+

Example data

+
Content-Type: application/xml
+

+  123456789
+  doggie
+  
+    aeiou
+  
+  
+  
+  aeiou
+

Produces

This API call produces the following media types according to the Accept request header; @@ -585,18 +533,12 @@ font-style: italic;
-

Consumes

- This API call consumes the following media types via the Content-Type request header: -
    -
  • application/json
  • -
  • application/xml
  • -

Request body

-
body Pet (required)
+
Pet Pet (required)
-
Body Parameter — Pet object that needs to be added to the store
+
Body Parameter
@@ -607,13 +549,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

400

@@ -663,13 +598,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

405

@@ -706,7 +634,7 @@ font-style: italic;
Form Parameter — Additional data to pass to server
file (optional)
-
Form Parameter — file to upload
+
Form Parameter — file to upload format: binary

Return type

@@ -762,13 +690,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

400

@@ -846,16 +767,6 @@ font-style: italic; -

Example data

-
Content-Type: application/xml
-

-  123456789
-  123456789
-  123
-  2000-01-23T04:56:07.000Z
-  aeiou
-  true
-

Example data

Content-Type: application/json
{
@@ -866,6 +777,16 @@ font-style: italic;
   "complete" : false,
   "status" : "placed"
 }
+

Example data

+
Content-Type: application/xml
+

+  123456789
+  123456789
+  123
+  2000-01-23T04:56:07.000Z
+  aeiou
+  true
+

Produces

This API call produces the following media types according to the Accept request header; @@ -895,12 +816,17 @@ font-style: italic;
+

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +

Request body

-
body Order (required)
+
Order Order (required)
-
Body Parameter — order placed for purchasing the pet
+
Body Parameter
@@ -915,16 +841,6 @@ font-style: italic; -

Example data

-
Content-Type: application/xml
-

-  123456789
-  123456789
-  123
-  2000-01-23T04:56:07.000Z
-  aeiou
-  true
-

Example data

Content-Type: application/json
{
@@ -935,6 +851,16 @@ font-style: italic;
   "complete" : false,
   "status" : "placed"
 }
+

Example data

+
Content-Type: application/xml
+

+  123456789
+  123456789
+  123
+  2000-01-23T04:56:07.000Z
+  aeiou
+  true
+

Produces

This API call produces the following media types according to the Accept request header; @@ -962,12 +888,17 @@ font-style: italic;
This can only be done by the logged in user.
+

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +

Request body

-
body User (required)
+
User User (required)
-
Body Parameter — Created user object
+
Body Parameter
@@ -978,13 +909,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

default

@@ -1003,9 +927,9 @@ font-style: italic;

Request body

-
body User (required)
+
array array (required)
-
Body Parameter — List of user object
+
Body Parameter
@@ -1016,13 +940,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

default

@@ -1041,9 +958,9 @@ font-style: italic;

Request body

-
body User (required)
+
array array (required)
-
Body Parameter — List of user object
+
Body Parameter
@@ -1054,13 +971,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

default

@@ -1091,13 +1001,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

400

@@ -1135,18 +1038,6 @@ font-style: italic; -

Example data

-
Content-Type: application/xml
-

-  123456789
-  aeiou
-  aeiou
-  aeiou
-  aeiou
-  aeiou
-  aeiou
-  123
-

Example data

Content-Type: application/json
{
@@ -1159,6 +1050,18 @@ font-style: italic;
   "email" : "email",
   "username" : "username"
 }
+

Example data

+
Content-Type: application/xml
+

+  123456789
+  aeiou
+  aeiou
+  aeiou
+  aeiou
+  aeiou
+  aeiou
+  123
+

Produces

This API call produces the following media types according to the Accept request header; @@ -1209,12 +1112,12 @@ font-style: italic; -

Example data

-
Content-Type: application/xml
-
aeiou

Example data

Content-Type: application/json
""
+

Example data

+
Content-Type: application/xml
+
aeiou

Produces

This API call produces the following media types according to the Accept request header; @@ -1250,13 +1153,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

default

@@ -1278,12 +1174,17 @@ font-style: italic;
Path Parameter — name that need to be deleted
+

Consumes

+ This API call consumes the following media types via the Content-Type request header: +
    +
  • application/json
  • +

Request body

-
body User (required)
+
User User (required)
-
Body Parameter — Updated user object
+
Body Parameter
@@ -1294,13 +1195,6 @@ font-style: italic; -

Produces

- This API call produces the following media types according to the Accept request header; - the media type will be conveyed by the Content-Type response header. -
    -
  • application/xml
  • -
  • application/json
  • -

Responses

400

diff --git a/samples/server/petstore/finch/.swagger-codegen/VERSION b/samples/server/petstore/finch/.swagger-codegen/VERSION index f9f7450d135..096bf47efe3 100644 --- a/samples/server/petstore/finch/.swagger-codegen/VERSION +++ b/samples/server/petstore/finch/.swagger-codegen/VERSION @@ -1 +1 @@ -2.3.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/finch/src/main/scala/DataAccessor.scala b/samples/server/petstore/finch/src/main/scala/DataAccessor.scala index 2fcb7429b18..3b07e157576 100644 --- a/samples/server/petstore/finch/src/main/scala/DataAccessor.scala +++ b/samples/server/petstore/finch/src/main/scala/DataAccessor.scala @@ -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] = ??? } \ No newline at end of file diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/PetApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/PetApi.scala index 3f35d7b0123..86711c7fb35 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/PetApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/PetApi.scala @@ -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) } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/StoreApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/StoreApi.scala index c45ef8153fd..d883e2f2c0c 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/StoreApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/StoreApi.scala @@ -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) } diff --git a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/UserApi.scala b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/UserApi.scala index c33effe4417..8928ad2cf54 100644 --- a/samples/server/petstore/finch/src/main/scala/io/swagger/apis/UserApi.scala +++ b/samples/server/petstore/finch/src/main/scala/io/swagger/apis/UserApi.scala @@ -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) }