All Downloads are FREE. Search and download functionalities are using the official Maven repository.

camundala.helper.setup.ApiGeneratorGenerator.scala Maven / Gradle / Ivy

There is a newer version: 1.30.23
Show newest version
package camundala.helper.setup

import camundala.api.docs.DependencyConf

case class ApiGeneratorGenerator()(using config: SetupConfig):

  lazy val generate: Unit =
    createIfNotExists(apiGeneratorPath, apiGenerator)

  private lazy val companyName = config.companyName
  private lazy val helperPath =
    config.projectDir / ModuleConfig.helperModule.packagePath(config.projectPath)
  private lazy val apiGeneratorPath = helperPath / "ProjectApiGenerator.scala"
  private lazy val apiGenerator =
    objectContent("ProjectApiGenerator")

  private def objectContent(
      objName: String
  ) =
    s"""package ${config.projectPackage}.helper
       |
       |import camundala.helper.openApi.*
       |
       |object $objName extends App:
       |
       |  OpenApiGenerator().generate
       |
       |  private given OpenApiConfig = OpenApiConfig(
       |    projectName = "${config.projectName}",
       |
       |  )
       |  private given ApiDefinition = OpenApiCreator().create
       |
       |end $objName""".stripMargin

end ApiGeneratorGenerator




© 2015 - 2024 Weber Informatics LLC | Privacy Policy