From 065b5e6006a68f5e1b1d125475d310c8f70006f7 Mon Sep 17 00:00:00 2001 From: "aaron.pritzlaff" Date: Wed, 24 Apr 2024 14:06:34 +0100 Subject: [PATCH 1/3] using artefact version in build --- .../src/main/resources/scala-cask/build.sc.mustache | 4 ++-- .../src/main/resources/scala-cask/example.mustache | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache b/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache index 86f838c35377..5107dce11a57 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache +++ b/modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache @@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._ // mill _.publishLocal // mill _.test.test object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule { - def scalaVersion = "3.3.1" + def scalaVersion = "3.4.1" def pomSettings = PomSettings( description = "{{artifactId}}", @@ -21,7 +21,7 @@ object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule { ) ) - def publishVersion: mill.T[String] = T("0.0.1-SNAPSHOT") + def publishVersion: mill.T[String] = T("{{artifactVersion}}") def ivyDeps = Agg( ivy"com.lihaoyi::cask:0.9.2" , diff --git a/modules/openapi-generator/src/main/resources/scala-cask/example.mustache b/modules/openapi-generator/src/main/resources/scala-cask/example.mustache index 3d6b5cca7794..c06bb16d1636 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/example.mustache +++ b/modules/openapi-generator/src/main/resources/scala-cask/example.mustache @@ -1,5 +1,5 @@ -//> using scala "3.3.1" -//> using lib "{{groupId}}::{{artifactId}}:0.0.1-SNAPSHOT" +//> using scala "3.4.1" +//> using lib "{{groupId}}::{{artifactId}}:{{artifactVersion}}" //> using repositories https://maven.pkg.github.com/{{{gitUserId}}}/{{{gitRepoId}}} From dea0637144ff1b1b81d971c8a130a772f9b764f9 Mon Sep 17 00:00:00 2001 From: "aaron.pritzlaff" Date: Wed, 24 Apr 2024 14:09:48 +0100 Subject: [PATCH 2/3] using artefact version in build --- .../openapitools/codegen/languages/ScalaCaskServerCodegen.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java index 1ae0739ad57e..554be3d6307a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java @@ -118,6 +118,7 @@ public ScalaCaskServerCodegen() { cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC)); + cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC)); cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC)); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, CodegenConstants.PACKAGE_DESCRIPTION)); @@ -158,6 +159,7 @@ public void processOpts() { final String groupId = ensureProp(CodegenConstants.GROUP_ID, "org.openapitools"); ensureProp(CodegenConstants.ARTIFACT_ID, "caskgen"); artifactVersion = ensureProp(CodegenConstants.ARTIFACT_VERSION, "0.0.1"); + gitRepoId = ensureProp(CodegenConstants.GIT_REPO_ID, ""); gitUserId = ensureProp(CodegenConstants.GIT_USER_ID, ""); From f50dc576acbcc45e06f3f1f28f13e6d0a653433e Mon Sep 17 00:00:00 2001 From: "aaron.pritzlaff" Date: Wed, 24 Apr 2024 15:08:09 +0100 Subject: [PATCH 3/3] cask knows how to honour artifact versions --- docs/generators/scala-cask.md | 1 + .../src/main/resources/scala-cask/build.sbt.mustache | 2 +- samples/server/petstore/scala-cask/build.sbt | 2 +- samples/server/petstore/scala-cask/build.sc | 4 ++-- samples/server/petstore/scala-cask/example/Server.scala | 4 ++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/generators/scala-cask.md b/docs/generators/scala-cask.md index d187ba569394..802870eef7b5 100644 --- a/docs/generators/scala-cask.md +++ b/docs/generators/scala-cask.md @@ -21,6 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |apiPackage|package for generated api classes| |null| |artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |null| +|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |null| |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app)
**java8**
Java 8 native JSR310 (preferred for JDK 1.8+)
|java8| |disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|
**false**
The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.
**true**
Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.
|true| |ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| diff --git a/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache b/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache index cc799789b2a1..ea6b9ffbd956 100644 --- a/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache @@ -1,6 +1,6 @@ ThisBuild / name := "{{artifactId}}" ThisBuild / organization := "{{groupId}}" -ThisBuild / version := "0.0.1-SNAPSHOT" +ThisBuild / version := "{{artifactVersion}}" ThisBuild / scalaVersion := "3.4.1" ThisBuild / scalafmtOnCompile := true ThisBuild / versionScheme := Some("early-semver") diff --git a/samples/server/petstore/scala-cask/build.sbt b/samples/server/petstore/scala-cask/build.sbt index 66a6e047c73e..e0f93fa57bbd 100644 --- a/samples/server/petstore/scala-cask/build.sbt +++ b/samples/server/petstore/scala-cask/build.sbt @@ -1,6 +1,6 @@ ThisBuild / name := "scala-cask-petstore" ThisBuild / organization := "cask.groupId" -ThisBuild / version := "0.0.1-SNAPSHOT" +ThisBuild / version := "0.0.1" ThisBuild / scalaVersion := "3.4.1" ThisBuild / scalafmtOnCompile := true ThisBuild / versionScheme := Some("early-semver") diff --git a/samples/server/petstore/scala-cask/build.sc b/samples/server/petstore/scala-cask/build.sc index d865ae9ce7a6..c305a30d90cd 100644 --- a/samples/server/petstore/scala-cask/build.sc +++ b/samples/server/petstore/scala-cask/build.sc @@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._ // mill _.publishLocal // mill _.test.test object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishModule { - def scalaVersion = "3.3.1" + def scalaVersion = "3.4.1" def pomSettings = PomSettings( description = "scala-cask-petstore", @@ -21,7 +21,7 @@ object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishMod ) ) - def publishVersion: mill.T[String] = T("0.0.1-SNAPSHOT") + def publishVersion: mill.T[String] = T("0.0.1") def ivyDeps = Agg( ivy"com.lihaoyi::cask:0.9.2" , diff --git a/samples/server/petstore/scala-cask/example/Server.scala b/samples/server/petstore/scala-cask/example/Server.scala index 77e65913712a..cd6650b83a40 100644 --- a/samples/server/petstore/scala-cask/example/Server.scala +++ b/samples/server/petstore/scala-cask/example/Server.scala @@ -1,5 +1,5 @@ -//> using scala "3.3.1" -//> using lib "cask.groupId::scala-cask-petstore:0.0.1-SNAPSHOT" +//> using scala "3.4.1" +//> using lib "cask.groupId::scala-cask-petstore:0.0.1" //> using repositories https://maven.pkg.github.com/GIT_USER_ID/GIT_REPO_ID