Skip to content

Commit 4603061

Browse files
authored
[Scala][sttp] various improvements (#5475)
* various improvements to scala sttp * update ScalaSttpClientCodegen.java * add windows batch file * test scala sttp in jdk8 * fix tempalte directory
1 parent 8425097 commit 4603061

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+78
-111
lines changed

README.md

Lines changed: 2 additions & 1 deletion

bin/openapi3/scala-sttp-petstore.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ fi
2727

2828
# if you've executed sbt assembly previously it will use that instead.
2929
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30-
ags="generate --artifact-id "scala-sttp-petstore-client" -t modules/openapi-generator/src/main/resources/scala-sttp-client -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-sttp -o samples/client/petstore/scala-sttp $@"
30+
ags="generate --artifact-id 'scala-sttp-petstore' -t modules/openapi-generator/src/main/resources/scala-sttp -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g scala-sttp -o samples/openapi3/client/petstore/scala-sttp $@"
3131

3232
java $JAVA_OPTS -jar $executable $ags
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "scala-sttp-petstore" -t modules\openapi-generator\src\main\resources\scala-sttp -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g scala-sttp -o samples\openapi3\client\petstore\scala-sttp
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

docs/generators.md

Lines changed: 1 addition & 1 deletion

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaSttpClientCodegen.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
/*
2+
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package org.openapitools.codegen.languages;
218

319
import io.swagger.v3.oas.models.Operation;
420
import io.swagger.v3.oas.models.servers.Server;
521
import org.openapitools.codegen.CodegenConfig;
622
import org.openapitools.codegen.CodegenOperation;
723
import org.openapitools.codegen.SupportingFile;
24+
import org.openapitools.codegen.meta.GeneratorMetadata;
25+
import org.openapitools.codegen.meta.Stability;
826

927
import java.io.File;
1028
import java.util.List;
@@ -14,8 +32,13 @@ public class ScalaSttpClientCodegen extends ScalaAkkaClientCodegen implements Co
1432

1533
public ScalaSttpClientCodegen() {
1634
super();
17-
}
35+
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
36+
.stability(Stability.BETA)
37+
.build();
1838

39+
embeddedTemplateDir = templateDir = "scala-sttp";
40+
outputFolder = "generated-code/scala-sttp";
41+
}
1942

2043
@Override
2144
public void processOpts() {
@@ -52,13 +75,13 @@ public String getName() {
5275

5376
@Override
5477
public String getHelp() {
55-
return "Generates a Scala client library base on Sttp.";
78+
return "Generates a Scala client library (beta) based on Sttp.";
5679
}
5780

5881
@Override
5982
public String encodePath(String input) {
6083
String result = super.encodePath(input);
61-
return result.replace("{","${");
84+
return result.replace("{", "${");
6285
}
6386

6487
@Override

modules/openapi-generator/src/main/resources/scala-sttp-client/README.mustache renamed to modules/openapi-generator/src/main/resources/scala-sttp/README.mustache

File renamed without changes.

modules/openapi-generator/src/main/resources/scala-sttp-client/api.mustache renamed to modules/openapi-generator/src/main/resources/scala-sttp/api.mustache

File renamed without changes.

modules/openapi-generator/src/main/resources/scala-sttp-client/apiInvoker.mustache renamed to modules/openapi-generator/src/main/resources/scala-sttp/apiInvoker.mustache

File renamed without changes.

modules/openapi-generator/src/main/resources/scala-sttp-client/build.sbt.mustache renamed to modules/openapi-generator/src/main/resources/scala-sttp/build.sbt.mustache

File renamed without changes.

modules/openapi-generator/src/main/resources/scala-sttp-client/enumsSerializers.mustache renamed to modules/openapi-generator/src/main/resources/scala-sttp/enumsSerializers.mustache

File renamed without changes.

0 commit comments

Comments
 (0)