forked from loafle/openapi-generator-original
[Scala] added new scala-cask generator for the cask framework (#18344)
* Ran `./new.sh -n scala-cask -s` to generate a new Scala Cask impl * removed scala-cask-petstore * Added Scala-cask param parser for BigDecimals * added scala cask to samples * splitting out validation and json * Added GitHub workflow support * regenerated cask samples * cask build fix for local builds * regenerated samples * trying to reproduce failed cask build. checking in compiles sources, which have been reformatted * reverted whaitespace change * cask fix - adding gitignored files * scala cask toLowreCase fix * scala cask toUpperCase fix * cask regenerated samples * improved exception handling for scala cask * File separator fix for windows * Noob fix for cask * regenerated api package * Removed environment variable settings, debug code * Updated samples * moved scala-cask output * Regenerated samples * scala cask fix * Updated scala cask settings for more typical package structure Removed cask client samples * cask - reran generate samples * Removed duplicate ScalaCaskServer entry * minor enhancements * update samples * update templates --------- Co-authored-by: aaron.pritzlaff <aaron@kindservices.co.uk>
This commit is contained in:
61
samples/server/petstore/scala-cask/example/Server.scala
Normal file
61
samples/server/petstore/scala-cask/example/Server.scala
Normal file
@@ -0,0 +1,61 @@
|
||||
//> using scala "3.3.1"
|
||||
//> using lib "cask.groupId::scala-cask-petstore:0.0.1-SNAPSHOT"
|
||||
//> using repositories https://maven.pkg.github.com/GIT_USER_ID/GIT_REPO_ID
|
||||
|
||||
|
||||
/**
|
||||
* This single file can contain the business logic for a REST service.
|
||||
* ====================================
|
||||
* == zero-install build with docker ==
|
||||
* ====================================
|
||||
*
|
||||
*
|
||||
* ```
|
||||
* docker build . -t scala-cask-petstore:latest
|
||||
* ```
|
||||
* ======================
|
||||
* == Building Locally ==
|
||||
* ======================
|
||||
* This project can be built using [[scala-clit][https://scala-cli.virtuslab.org]]
|
||||
*
|
||||
* To simply run the project
|
||||
* ```
|
||||
* scala-cli Server.scala
|
||||
* ```
|
||||
*
|
||||
* To create a runnable jar, run:
|
||||
* ```
|
||||
* scala-cli --power package Server.scala -o app-assembly --assembly
|
||||
* ```
|
||||
*
|
||||
* To produce a docker image (no need for the Dockerfile), run:
|
||||
* ```
|
||||
* scala-cli --power package --docker Server.scala --docker-image-repository app-docker
|
||||
* ```
|
||||
*
|
||||
* To generate an IDE project:
|
||||
* ```
|
||||
* scala-cli setup-ide . --scala 3.3
|
||||
* ```
|
||||
*/
|
||||
package app
|
||||
|
||||
import cask.groupId.server.BaseApp
|
||||
import sample.cask.api.*
|
||||
import sample.cask.model.*
|
||||
|
||||
import java.io.File
|
||||
|
||||
// TODO - write your business logic for your services here (the defaults all return 'not implemented'):
|
||||
val myPetService : PetService = PetService() // <-- replace this with your implementation
|
||||
val myStoreService : StoreService = StoreService() // <-- replace this with your implementation
|
||||
val myUserService : UserService = UserService() // <-- replace this with your implementation
|
||||
|
||||
/** This is your main entry point for your REST service
|
||||
* It extends BaseApp which defines the business logic for your services
|
||||
*/
|
||||
object Server extends BaseApp(appPetService = myPetService,
|
||||
appStoreService = myStoreService,
|
||||
appUserService = myUserService):
|
||||
start()
|
||||
|
||||
Reference in New Issue
Block a user