camundala.helper.setup.ApiGenerator.scala Maven / Gradle / Ivy
The newest version!
package camundala.helper.setup
case class ApiGenerator()(using config: SetupConfig):
lazy val generate: Unit =
createIfNotExists(
config.projectDir / ModuleConfig.apiModule.packagePath(
config.projectPath
) / "ApiProjectCreator.scala",
api
)
createOrUpdate(config.projectDir / "OpenApi.html", openApiHtml)
createOrUpdate(config.projectDir / "PostmanOpenApi.html", postmanOpenApiHtml)
end generate
lazy val api =
s"""package ${config.projectPackage}
|package api
|
|import bpmn.*
|
|object ApiProjectCreator extends CompanyApiCreator:
|
| lazy val projectName: String = "${config.projectName}"
|
| val title = "${config.projectClassName}"
|
| lazy val projectDescr =
| "TODO Your Project description."
|
| val version = "0.1.0-SNAPSHOT"
|
| document(
| myProcessApi,
| //..
| )
|
| private lazy val myProcessApi =
| import myProcess.v1.*
| api(MyProcess.example)
|
|end ApiProjectCreator
|""".stripMargin
end api
private lazy val openApiHtml =
s"""
|
|
|
| ReDoc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|""".stripMargin
private lazy val postmanOpenApiHtml =
s"""
|
|
|
| ReDoc
|
|
|
|
|
|
|
|
|
|
|
|
|""".stripMargin
end ApiGenerator