[Scala][Lagom] rename generator from scala-lagom to scala-lagom-server (#7014)

* rename scala-lagom to scala-lagom-server

* add back pom.xml and shell script

* update scala-lagom-server path in circleci pom.xml

* make shell script executable

* rename batch file
This commit is contained in:
William Cheng
2017-11-21 23:24:02 +08:00
committed by GitHub
parent 573b5518be
commit 803f337d24
30 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,30 @@
*.class
*.log
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
target
ideatarget
.target
bin
.cache-main
.cache-tests
.classpath
.project
.tmpBin
.factorypath
.settings
logs
.idea

View File

@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1 @@
2.3.0-SNAPSHOT

View File

@@ -0,0 +1,13 @@
# Swagger 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 example uses the [lagomframework](https://www.lagomframework.com) lagomframework.
# Features which are not supported
- Form Parameters
- Seq in query parameters
- File Handling

View File

@@ -0,0 +1,16 @@
version := "1.0.0"
name := "scala-lagom-server"
organization := "io.swagger"
scalaVersion := "2.11.8"
val playJsonDerivedCodecs = "org.julienrf" %% "play-json-derived-codecs" % "3.3"
libraryDependencies ++= Seq(
lagomScaladslApi,
playJsonDerivedCodecs
)

View File

@@ -0,0 +1,29 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>io.swagger</groupId>
<artifactId>scala-lagom</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>Scala Lagom server</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>sbt-test</id>
<phase>integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>./sbt_test_jdk8_only.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1 @@
sbt.version=0.13.16

View File

@@ -0,0 +1,5 @@
addSbtPlugin("com.lightbend.lagom" % "lagom-sbt-plugin" % "1.3.8")
// Needed for importing the project into Eclipse
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.1.0")
// The ConductR plugin
addSbtPlugin("com.lightbend.conductr" % "sbt-conductr" % "2.3.5")

View File

@@ -0,0 +1,11 @@
#!/bin/bash
java -version 2>&1 | grep "java version \"1.8"
if [ $? -eq 0 ]
then
echo "Running JDK8"
sbt test
else
echo "Not running JDK8"
fi

View File

@@ -0,0 +1,138 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.api
import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import play.api.libs.json._
import com.lightbend.lagom.scaladsl.api.deser.PathParamSerializer
import io.swagger.client.model.ApiResponse
import java.io.File
import io.swagger.client.model.Pet
trait PetApi extends Service {
final override def descriptor = {
import Service._
named("PetApi").withCalls(
restCall(Method.POST, "/pet", addPet _),
restCall(Method.DELETE, "/pet/:petId", deletePet _),
restCall(Method.GET, "/pet/findByStatus?status", findPetsByStatus _),
restCall(Method.GET, "/pet/findByTags?tags", findPetsByTags _),
restCall(Method.GET, "/pet/:petId", getPetById _),
restCall(Method.PUT, "/pet", updatePet _),
restCall(Method.POST, "/pet/:petId", updatePetWithForm _),
restCall(Method.POST, "/pet/:petId/uploadImage", uploadFile _)
).withAutoAcl(true)
}
/**
* Add a new pet to the store
*
*
* @return void Body Parameter Pet object that needs to be added to the store
*/
def addPet(): ServiceCall[Pet ,Done]
// apiKey:String -- not yet supported heder params
/**
* Deletes a pet
*
*
* @param petId Pet id to delete
* @param apiKey (optional)
* @return void
*/
def deletePet(petId: Long): ServiceCall[NotUsed ,Done]
// status:Seq[String] -- not yet supported Seq PathParamSerializers for multi value query parameters https://github.com/lagom/lagom/issues/643
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
*
* @param status Status values that need to be considered for filter
* @return Seq[Pet]
*/
def findPetsByStatus(status: Option[PetApiStatusEnum.PetApiStatusEnum]): ServiceCall[NotUsed ,Seq[Pet]]
// tags:Seq[String] -- not yet supported Seq PathParamSerializers for multi value query parameters https://github.com/lagom/lagom/issues/643
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
*
* @param tags Tags to filter by
* @return Seq[Pet]
*/
def findPetsByTags(): ServiceCall[NotUsed ,Seq[Pet]]
/**
* Find pet by ID
* Returns a single pet
*
* @param petId ID of pet to return
* @return Pet
*/
def getPetById(petId: Long): ServiceCall[NotUsed ,Pet]
/**
* Update an existing pet
*
*
* @return void Body Parameter Pet object that needs to be added to the store
*/
def updatePet(): ServiceCall[Pet ,Done]
// name:String -- not yet supported x-www-form-urlencoded
// status:String -- not yet supported x-www-form-urlencoded
/**
* Updates a pet in the store with form data
*
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet (optional)
* @param status Updated status of the pet (optional)
* @return void
*/
def updatePetWithForm(petId: Long): ServiceCall[NotUsed ,Done]
// additionalMetadata:String -- not yet supported x-www-form-urlencoded
// file:File -- not yet supported x-www-form-urlencoded
/**
* uploads an image
*
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server (optional)
* @param file file to upload (optional)
* @return ApiResponse
*/
def uploadFile(petId: Long): ServiceCall[NotUsed ,ApiResponse]
object PetApiStatusEnum extends Enumeration {
val available, pending, sold = Value
type PetApiStatusEnum = Value
implicit val format: Format[Value] = Format(Reads.enumNameReads(this), Writes.enumNameWrites[PetApiStatusEnum.type])
implicit val pathParamSerializer: PathParamSerializer[PetApiStatusEnum] = PathParamSerializer.required("PetApiStatusEnum")(withName)(_.toString)
}
}

View File

@@ -0,0 +1,73 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.api
import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import play.api.libs.json._
import com.lightbend.lagom.scaladsl.api.deser.PathParamSerializer
import io.swagger.client.model.Order
trait StoreApi extends Service {
final override def descriptor = {
import Service._
named("StoreApi").withCalls(
restCall(Method.DELETE, "/store/order/:orderId", deleteOrder _),
restCall(Method.GET, "/store/inventory", getInventory _),
restCall(Method.GET, "/store/order/:orderId", getOrderById _),
restCall(Method.POST, "/store/order", placeOrder _)
).withAutoAcl(true)
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
*
* @param orderId ID of the order that needs to be deleted
* @return void
*/
def deleteOrder(orderId: String): ServiceCall[NotUsed ,Done]
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
*
* @return Map[String, Int]
*/
def getInventory(): ServiceCall[NotUsed ,Map[String, Int]]
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
*
* @param orderId ID of pet that needs to be fetched
* @return Order
*/
def getOrderById(orderId: Long): ServiceCall[NotUsed ,Order]
/**
* Place an order for a pet
*
*
* @return Order Body Parameter order placed for purchasing the pet
*/
def placeOrder(): ServiceCall[Order ,Order]
}

View File

@@ -0,0 +1,112 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.api
import akka.{Done, NotUsed}
import com.lightbend.lagom.scaladsl.api.transport.Method
import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall}
import play.api.libs.json._
import com.lightbend.lagom.scaladsl.api.deser.PathParamSerializer
import io.swagger.client.model.User
trait UserApi extends Service {
final override def descriptor = {
import Service._
named("UserApi").withCalls(
restCall(Method.POST, "/user", createUser _),
restCall(Method.POST, "/user/createWithArray", createUsersWithArrayInput _),
restCall(Method.POST, "/user/createWithList", createUsersWithListInput _),
restCall(Method.DELETE, "/user/:username", deleteUser _),
restCall(Method.GET, "/user/:username", getUserByName _),
restCall(Method.GET, "/user/login?username&password", loginUser _),
restCall(Method.GET, "/user/logout", logoutUser _),
restCall(Method.PUT, "/user/:username", updateUser _)
).withAutoAcl(true)
}
/**
* Create user
* This can only be done by the logged in user.
*
* @return void Body Parameter Created user object
*/
def createUser(): ServiceCall[User ,Done]
/**
* Creates list of users with given input array
*
*
* @return void Body Parameter List of user object
*/
def createUsersWithArrayInput(): ServiceCall[Seq[User] ,Done]
/**
* Creates list of users with given input array
*
*
* @return void Body Parameter List of user object
*/
def createUsersWithListInput(): ServiceCall[Seq[User] ,Done]
/**
* Delete user
* This can only be done by the logged in user.
*
* @param username The name that needs to be deleted
* @return void
*/
def deleteUser(username: String): ServiceCall[NotUsed ,Done]
/**
* Get user by user name
*
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
def getUserByName(username: String): ServiceCall[NotUsed ,User]
/**
* Logs user into the system
*
*
* @param username The user name for login
* @param password The password for login in clear text
* @return String
*/
def loginUser(username:String ,password:String ): ServiceCall[NotUsed ,String]
/**
* Logs out current logged in user session
*
*
* @return void
*/
def logoutUser(): ServiceCall[NotUsed ,Done]
/**
* Updated user
* This can only be done by the logged in user.
*
* @param username name that need to be deleted
* @return void Body Parameter Updated user object
*/
def updateUser(username: String): ServiceCall[User ,Done]
}

View File

@@ -0,0 +1,25 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
case class ApiResponse (
code: Option[Int],
_type: Option[String],
message: Option[String]
)
object ApiResponse {
implicit val format: Format[ApiResponse] = Json.format
}

View File

@@ -0,0 +1,24 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
case class Category (
id: Option[Long],
name: Option[String]
)
object Category {
implicit val format: Format[Category] = Json.format
}

View File

@@ -0,0 +1,34 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
import org.joda.time.DateTime
case class Order (
id: Option[Long],
petId: Option[Long],
quantity: Option[Int],
shipDate: Option[DateTime],
status: Option[OrderStatusEnum.OrderStatusEnum],
complete: Option[Boolean]
)
object Order {
implicit val format: Format[Order] = Json.format
}
object OrderStatusEnum extends Enumeration {
val placed, approved, delivered = Value
type OrderStatusEnum = Value
implicit val format: Format[Value] = Format(Reads.enumNameReads(this), Writes.enumNameWrites[OrderStatusEnum.type])
}

View File

@@ -0,0 +1,33 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
case class Pet (
id: Option[Long],
category: Option[Category],
name: String,
photoUrls: Seq[String],
tags: Option[Seq[Tag]],
status: Option[PetStatusEnum.PetStatusEnum]
)
object Pet {
implicit val format: Format[Pet] = Json.format
}
object PetStatusEnum extends Enumeration {
val available, pending, sold = Value
type PetStatusEnum = Value
implicit val format: Format[Value] = Format(Reads.enumNameReads(this), Writes.enumNameWrites[PetStatusEnum.type])
}

View File

@@ -0,0 +1,24 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
case class Tag (
id: Option[Long],
name: Option[String]
)
object Tag {
implicit val format: Format[Tag] = Json.format
}

View File

@@ -0,0 +1,31 @@
/**
* 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 spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.swagger.client.model
import play.api.libs.json._
case class User (
id: Option[Long],
username: Option[String],
firstName: Option[String],
lastName: Option[String],
email: Option[String],
password: Option[String],
phone: Option[String],
/* User Status */
userStatus: Option[Int]
)
object User {
implicit val format: Format[User] = Json.format
}