[scala] Support for Set when array has uniqueItems=true (#4926)

* [scala] Set support for unique arrays

This includes and builds upon community contribution for better Set support in Scala.
It makes property + model work as expected with Set and default values
across all Scala generators. Included tests to account for new changes.

This also reverts the community contribution to remove ListBuffer
imports and change the default for array to ListBuffer. Users should use
the instantiation types map to modify the desired array instantiation
type. Any new default should target a new minor release after community
discussion, as it affects all existing SDKs generated with
openapi-generator.

* [scala] Improve default handling of monadic collection type

* [scala] Regenerate samples

* Update ScalaPlayFrameworkServerCodegen.java

Scala Play defaulted to List and should continue to do so.

Co-authored-by: František Kocun <frantisek.kocun@gmail.com>
This commit is contained in:
Jim Schubert
2020-01-05 09:20:56 -05:00
committed by GitHub
parent 965efdd965
commit 25036e48d5
52 changed files with 757 additions and 547 deletions

View File

@@ -674,7 +674,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
// TODO: collection type here should be fully qualified namespace to avoid model conflicts
// This supports arrays of arrays.
String arrayType = typeMapping.get("array");
if (Boolean.TRUE.equals(arr.getUniqueItems())) {
if (ModelUtils.isSet(arr)) {
arrayType = typeMapping.get("set");
}
StringBuilder instantiationType = new StringBuilder(arrayType);

View File

@@ -23,9 +23,7 @@ import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.Schema;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.openapitools.codegen.CliOption;
import org.openapitools.codegen.CodegenConstants;
import org.openapitools.codegen.DefaultCodegen;
import org.openapitools.codegen.*;
import org.openapitools.codegen.utils.ModelUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -106,6 +104,14 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
"yield"
));
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
// although Seq is a predef, before Scala 2.13, it _could_ refer to a mutable Seq in some cases.
importMapping.put("Seq", "scala.collection.immutable.Seq");
importMapping.put("Set", "scala.collection.immutable.Set");
importMapping.put("ListSet", "scala.collection.immutable.ListSet");
instantiationTypes.put("set", "Set");
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC));
@@ -199,7 +205,11 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
@Override
public String getSchemaType(Schema p) {
String openAPIType = super.getSchemaType(p);
String type = null;
if (ModelUtils.isSet(p)) {
openAPIType = "set";
}
String type;
if (typeMapping.containsKey(openAPIType)) {
type = typeMapping.get(openAPIType);
if (languageSpecificPrimitives.contains(type)) {
@@ -219,7 +229,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
return instantiationTypes.get("array") + "[" + inner + "]";
return ( ModelUtils.isSet(ap) ? instantiationTypes.get("set") : instantiationTypes.get("array") ) + "[" + inner + "]";
} else {
return null;
}
@@ -248,7 +258,28 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
return "new ListBuffer[" + inner + "]() ";
String genericType;
if (ModelUtils.isSet(ap)) {
genericType = instantiationTypes.get("set");
} else {
genericType = instantiationTypes.get("array");
}
// test for immutable Monoids with .empty method for idiomatic defaults
if ("List".equals(genericType) ||
"Set".equals(genericType) ||
"Seq".equals(genericType) ||
"Array".equals(genericType) ||
"Vector".equals(genericType) ||
"IndexedSeq".equals(genericType) ||
"Iterable".equals(genericType) ||
"ListSet".equals(genericType)
) {
return genericType + "[" + inner + "].empty ";
}
// Assume that any other generic types can be new'd up.
return "new " + genericType + "[" + inner + "]() ";
} else if (ModelUtils.isStringSchema(p)) {
return null;
} else {
@@ -256,6 +287,25 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
}
}
/**
* Convert OAS Property object to Codegen Property object
*
* @param name name of the property
* @param p OAS property object
* @return Codegen Property object
*/
@Override
public CodegenProperty fromProperty(String name, Schema p) {
CodegenProperty prop = super.fromProperty(name, p);
if (ModelUtils.isArraySchema(p)) {
ArraySchema as = (ArraySchema) p;
if (ModelUtils.isSet(as)) {
prop.containerType = "set";
}
}
return prop;
}
@Override
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
// remove model imports to avoid warnings for importing class in the same package in Scala

View File

@@ -265,6 +265,9 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
if (ModelUtils.isSet(ap)) {
return "Set[" + inner + "].empty ";
}
return "Seq[" + inner + "].empty ";
} else if (ModelUtils.isStringSchema(p)) {
return null;

View File

@@ -151,7 +151,6 @@ public class ScalaGatlingCodegen extends AbstractScalaCodegen implements Codegen
importMapping.remove("Map");
importMapping.put("Date", "java.util.Date");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
typeMapping = new HashMap<String, String>();
typeMapping.put("enum", "NSString");

View File

@@ -110,7 +110,6 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code
importMapping.remove("Map");
importMapping.put("Date", "java.util.Date");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
typeMapping = new HashMap<String, String>();
typeMapping.put("enum", "NSString");

View File

@@ -76,7 +76,6 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod
importMapping.remove("Map");
importMapping.put("DateTime", "org.joda.time.DateTime");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
typeMapping = new HashMap<>();
typeMapping.put("Integer", "Int");

View File

@@ -348,6 +348,9 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem
if (ModelUtils.isArraySchema(p)) {
Schema items = ((ArraySchema) p).getItems();
String inner = getSchemaType(items);
if (ModelUtils.isSet(p)) {
return "Set.empty[" + inner + "]";
}
return "List.empty[" + inner + "]";
}

View File

@@ -63,14 +63,27 @@ public class ScalatraServerCodegen extends AbstractScalaCodegen implements Codeg
"Integer",
"Long",
"Float",
"List",
"Set",
"Map")
);
typeMapping = new HashMap<>();
typeMapping.put("array", "List");
typeMapping.put("set", "Set");
typeMapping.put("boolean", "Boolean");
typeMapping.put("string", "String");
typeMapping.put("int", "Int");
typeMapping.put("integer", "Int");
typeMapping.put("long", "Long");
typeMapping.put("float", "Float");
typeMapping.put("byte", "Byte");
typeMapping.put("short", "Short");
typeMapping.put("char", "Char");
typeMapping.put("double", "Double");
typeMapping.put("object", "Any");
typeMapping.put("file", "File");
typeMapping.put("binary", "File");
typeMapping.put("number", "Double");
additionalProperties.put("appName", "OpenAPI Sample");
additionalProperties.put("appDescription", "A sample openapi server");
@@ -95,7 +108,6 @@ public class ScalatraServerCodegen extends AbstractScalaCodegen implements Codeg
supportingFiles.add(new SupportingFile("project/plugins.sbt", "project", "plugins.sbt"));
supportingFiles.add(new SupportingFile("sbt", "", "sbt"));
instantiationTypes.put("array", "ArrayList");
instantiationTypes.put("map", "HashMap");
importMapping = new HashMap<String, String>();
@@ -113,6 +125,11 @@ public class ScalatraServerCodegen extends AbstractScalaCodegen implements Codeg
importMapping.put("LocalDateTime", "org.joda.time.LocalDateTime");
importMapping.put("LocalDate", "org.joda.time.LocalDate");
importMapping.put("LocalTime", "org.joda.time.LocalTime");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
importMapping.put("Set", "scala.collection.immutable.Set");
importMapping.put("ListSet", "scala.collection.immutable.ListSet");
instantiationTypes.put("set", "Set");
}
@Override

View File

@@ -77,8 +77,6 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
importMapping.remove("Set");
importMapping.remove("Map");
importMapping.put("ListBuffer", "scala.collection.mutable.ListBuffer");
// Overrides defaults applied in DefaultCodegen which don't apply cleanly to Scala.
importMapping.put("Date", "java.util.Date");
importMapping.put("DateTime", "org.joda.time.DateTime");
@@ -214,7 +212,7 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen
} else if (ModelUtils.isArraySchema(p)) {
ArraySchema ap = (ArraySchema) p;
String inner = getSchemaType(ap.getItems());
String collectionType = typeMapping.get("array");
String collectionType = ModelUtils.isSet(ap) ? typeMapping.get("set") : typeMapping.get("array");
// We assume that users would map these collections to a monoid with an identity function
// There's no reason to assume mutable structure here (which may make consumption more difficult)

View File

@@ -386,6 +386,10 @@ public class ModelUtils {
return (schema instanceof ArraySchema);
}
public static boolean isSet(Schema schema) {
return ModelUtils.isArraySchema(schema) && Boolean.TRUE.equals(schema.getUniqueItems());
}
public static boolean isStringSchema(Schema schema) {
if (schema instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(schema.getType())) {
return true;

View File

@@ -212,6 +212,37 @@ public class ScalaAkkaClientCodegenTest {
Assert.assertTrue(property1.isContainer);
}
@Test(description = "convert a model with set (unique array) property")
public void complexSetPropertyTest() {
final Schema model = new Schema()
.description("a sample model")
.addProperties("children", new ArraySchema()
.items(new Schema().$ref("#/definitions/Children"))
.uniqueItems(Boolean.TRUE));
final DefaultCodegen codegen = new ScalaAkkaClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "Children");
Assert.assertEquals(property1.getter, "getChildren");
Assert.assertEquals(property1.setter, "setChildren");
Assert.assertEquals(property1.dataType, "Set[Children]");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.defaultValue, "Set[Children].empty ");
Assert.assertEquals(property1.baseType, "Set");
Assert.assertEquals(property1.containerType, "set");
Assert.assertFalse(property1.required);
Assert.assertTrue(property1.isContainer);
}
@Test(description = "convert a model with complex map property")
public void complexMapPropertyTest() {
final Schema model = new Schema()
@@ -258,10 +289,33 @@ public class ScalaAkkaClientCodegenTest {
Assert.assertEquals(cm.description, "an array model");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "ListBuffer[Children]");
Assert.assertEquals(cm.arrayModelType, "Children");
Assert.assertEquals(cm.imports.size(), 2);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("ListBuffer", "Children")).size(), 2);
}
@Test(description = "convert an array model with unique items to set")
public void arrayAsSetModelTest() {
final Schema schema = new ArraySchema()
.items(new Schema().$ref("#/definitions/Children"))
.description("a set of Children models");
schema.setUniqueItems(true);
final DefaultCodegen codegen = new ScalaAkkaClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", schema);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a set of Children models");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "Set[Children]");
Assert.assertEquals(cm.arrayModelType, "Children");
Assert.assertEquals(cm.imports.size(), 2);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Set", "Children")).size(), 2);
}
@Test(description = "convert a map model")
public void mapModelTest() {
final Schema model = new Schema()

View File

@@ -25,6 +25,7 @@ import org.openapitools.codegen.CodegenModel;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.DefaultCodegen;
import org.openapitools.codegen.TestUtils;
import org.openapitools.codegen.languages.ScalaAkkaClientCodegen;
import org.openapitools.codegen.languages.ScalaHttpClientCodegen;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -119,6 +120,37 @@ public class ScalaHttpClientModelTest {
Assert.assertTrue(property1.isContainer);
}
@Test(description = "convert a model with set (unique array) property")
public void complexSetPropertyTest() {
final Schema model = new Schema()
.description("a sample model")
.addProperties("children", new ArraySchema()
.items(new Schema().$ref("#/definitions/Children"))
.uniqueItems(Boolean.TRUE));
final DefaultCodegen codegen = new ScalaHttpClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", model);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", model);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "children");
Assert.assertEquals(property1.complexType, "Children");
Assert.assertEquals(property1.getter, "getChildren");
Assert.assertEquals(property1.setter, "setChildren");
Assert.assertEquals(property1.dataType, "Set[Children]");
Assert.assertEquals(property1.name, "children");
Assert.assertEquals(property1.defaultValue, "Set[Children].empty ");
Assert.assertEquals(property1.baseType, "Set");
Assert.assertEquals(property1.containerType, "set");
Assert.assertFalse(property1.required);
Assert.assertTrue(property1.isContainer);
}
@Test(description = "convert a model with a map property")
public void mapPropertyTest() {
final Schema model = new Schema()
@@ -256,6 +288,28 @@ public class ScalaHttpClientModelTest {
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("ListBuffer", "Children")).size(), 2);
}
@Test(description = "convert an array model with unique items to set")
public void arrayAsSetModelTest() {
final Schema schema = new ArraySchema()
.items(new Schema().$ref("#/definitions/Children"))
.description("a set of Children models");
schema.setUniqueItems(true);
final DefaultCodegen codegen = new ScalaHttpClientCodegen();
OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("sample", schema);
codegen.setOpenAPI(openAPI);
final CodegenModel cm = codegen.fromModel("sample", schema);
Assert.assertEquals(cm.name, "sample");
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a set of Children models");
Assert.assertEquals(cm.vars.size(), 0);
Assert.assertEquals(cm.parent, "Set[Children]");
Assert.assertEquals(cm.arrayModelType, "Children");
Assert.assertEquals(cm.imports.size(), 2);
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Set", "Children")).size(), 2);
}
@Test(description = "convert a map model")
public void mapModelTest() {
final Schema model = new Schema()

View File

@@ -235,4 +235,28 @@ public class ModelUtilsTest {
// Test a null schema
Assert.assertFalse(ModelUtils.isFreeFormObject(null));
}
@Test
public void testIsSetForValidSet() {
ArraySchema as = new ArraySchema()
.items(new StringSchema());
as.setUniqueItems(true);
Assert.assertTrue(ModelUtils.isSet(as));
}
@Test
public void testIsSetFalseForInvalidSet() {
ArraySchema as = new ArraySchema()
.items(new StringSchema());
as.setUniqueItems(false);
Assert.assertFalse(ModelUtils.isSet(as));
}
@Test
public void testIsSetFailsForNullSchema() {
ArraySchema as = null;
Assert.assertFalse(ModelUtils.isSet(as));
}
}

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -1 +1 @@
username,password
password,username
1 password username

View File

@@ -147,8 +147,8 @@ class UserApiSimulation extends Simulation {
.feed(loginUserQUERYFeeder)
.exec(http("loginUser")
.httpRequest("GET","/user/login")
.queryParam("username","${username}")
.queryParam("password","${password}")
.queryParam("username","${username}")
)
// Run scnloginUser with warm up and reach a constant rate for entire duration

View File

@@ -1 +1 @@
4.0.1-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -1,11 +1,17 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
@@ -37,9 +43,9 @@ if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
@@ -47,6 +53,6 @@ fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -1 +1 @@
4.2.2-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -1 +1 @@
2.3.0-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -1,9 +1,9 @@
# Swagger generated scala-lagomApi
# OpenAPI generated scala-lagomApi
## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
is an example of building a swagger-enabled lagon-api.
This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the
[OpenAPI-Spec](https://openapis.org) from a remote server, you can easily generate a server stub. This
is an example of building a OpenAPI-enabled lagon-api.
This example uses the [lagomframework](https://www.lagomframework.com) lagomframework.

View File

@@ -2,7 +2,7 @@ version := "1.0.0"
name := "scala-lagom-server"
organization := "io.swagger"
organization := "org.openapitools"
scalaVersion := "2.11.8"

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
@@ -15,7 +15,7 @@ import play.api.libs.json._
case class ApiResponse (
code: Option[Int],
_type: Option[String],
`type`: Option[String],
message: Option[String]
)

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1,12 +1,12 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
* The version of the OpenAPI document: 1.0.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

View File

@@ -1 +1 @@
4.0.0-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -2,7 +2,7 @@
This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
This Scala Play Framework project was generated by the OpenAPI generator tool at 2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong].
This Scala Play Framework project was generated by the OpenAPI generator tool at 2020-01-04T23:10:22.106-05:00[America/New_York].
## API

View File

@@ -4,7 +4,7 @@ import model.ApiResponse
import model.Pet
import play.api.libs.Files.TemporaryFile
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
trait PetApi {
/**
* Add a new pet to the store

View File

@@ -8,7 +8,7 @@ import model.ApiResponse
import model.Pet
import play.api.libs.Files.TemporaryFile
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
@Singleton
class PetApiController @Inject()(cc: ControllerComponents, api: PetApi) extends AbstractController(cc) {
/**

View File

@@ -7,7 +7,7 @@ import play.api.libs.Files.TemporaryFile
/**
* Provides a default implementation for [[PetApi]].
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
class PetApiImpl extends PetApi {
/**
* @inheritdoc

View File

@@ -2,7 +2,7 @@ package api
import model.Order
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
trait StoreApi {
/**
* Delete purchase order by ID

View File

@@ -6,7 +6,7 @@ import play.api.libs.json._
import play.api.mvc._
import model.Order
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
@Singleton
class StoreApiController @Inject()(cc: ControllerComponents, api: StoreApi) extends AbstractController(cc) {
/**

View File

@@ -5,7 +5,7 @@ import model.Order
/**
* Provides a default implementation for [[StoreApi]].
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
class StoreApiImpl extends StoreApi {
/**
* @inheritdoc

View File

@@ -2,7 +2,7 @@ package api
import model.User
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
trait UserApi {
/**
* Create user

View File

@@ -6,7 +6,7 @@ import play.api.libs.json._
import play.api.mvc._
import model.User
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
@Singleton
class UserApiController @Inject()(cc: ControllerComponents, api: UserApi) extends AbstractController(cc) {
/**

View File

@@ -5,7 +5,7 @@ import model.User
/**
* Provides a default implementation for [[UserApi]].
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
class UserApiImpl extends UserApi {
/**
* @inheritdoc

View File

@@ -5,7 +5,7 @@ import play.api.libs.json._
/**
* Describes the result of uploading an image resource
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class ApiResponse(
code: Option[Int],
`type`: Option[String],

View File

@@ -5,7 +5,7 @@ import play.api.libs.json._
/**
* A category for a pet
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class Category(
id: Option[Long],
name: Option[String]

View File

@@ -7,7 +7,7 @@ import java.time.OffsetDateTime
* An order for a pets from the pet store
* @param status Order Status
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class Order(
id: Option[Long],
petId: Option[Long],

View File

@@ -6,7 +6,7 @@ import play.api.libs.json._
* A pet for sale in the pet store
* @param status pet status in the store
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class Pet(
id: Option[Long],
category: Option[Category],

View File

@@ -5,7 +5,7 @@ import play.api.libs.json._
/**
* A tag for a pet
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class Tag(
id: Option[Long],
name: Option[String]

View File

@@ -6,7 +6,7 @@ import play.api.libs.json._
* A User who is purchasing from the pet store
* @param userStatus User Status
*/
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
case class User(
id: Option[Long],
username: Option[String],

View File

@@ -4,7 +4,7 @@ import api._
import play.api.inject.{Binding, Module => PlayModule}
import play.api.{Configuration, Environment}
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2019-03-26T16:21:58.590+08:00[Asia/Hong_Kong]")
@javax.annotation.Generated(value = Array("org.openapitools.codegen.languages.ScalaPlayFrameworkServerCodegen"), date = "2020-01-04T23:10:22.106-05:00[America/New_York]")
class Module extends PlayModule {
override def bindings(environment: Environment, configuration: Configuration): Seq[Binding[_]] = Seq(
bind[PetApi].to[PetApiImpl],

File diff suppressed because it is too large Load Diff