Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve sttpOpenApiClient generator #6684

Merged
merged 38 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a09822e
Base changes
ghostbuster91 Jun 4, 2020
a412444
Fix rendering too many colons
ghostbuster91 Jun 4, 2020
e8c3890
Fix formatting
ghostbuster91 Jun 4, 2020
e3a0654
Allow sttp version customization
ghostbuster91 Jun 4, 2020
4ac8894
Add option to return errors in terms of monadError
ghostbuster91 Jun 4, 2020
88908e2
Add option to customize jodaTime version
ghostbuster91 Jun 4, 2020
5c255e4
Add option to customize json4s version
ghostbuster91 Jun 4, 2020
6c5d792
Simplify jsonHandling
ghostbuster91 Jun 4, 2020
3b27bc5
Remove helpers as such functionality was added to sttp
ghostbuster91 Jun 4, 2020
cac19fc
Rename file
ghostbuster91 Jun 4, 2020
86ec499
Fix uploading multipart data
ghostbuster91 Jun 4, 2020
97fd17f
Extract common abstraction for generator properties
ghostbuster91 Jun 4, 2020
a7a15a2
Add partial circe support
ghostbuster91 Jun 4, 2020
551bb35
Remove unsed method
ghostbuster91 Jun 4, 2020
2a91b11
Refactor picking up json library
ghostbuster91 Jun 4, 2020
a380531
Add missing DateSerializers for circe
ghostbuster91 Jun 9, 2020
5cab35d
Simplify credentials
ghostbuster91 Jun 9, 2020
714f930
Simplify code
ghostbuster91 Jun 9, 2020
a5f0a05
Update docs
ghostbuster91 Jun 9, 2020
dfca277
Fix auto formatting
ghostbuster91 Jun 9, 2020
5efad87
Simplify code
ghostbuster91 Jun 9, 2020
3c836f9
SttpCodegen should not depend on akka
ghostbuster91 Jun 9, 2020
a377921
Rewrite properties handling
ghostbuster91 Jun 10, 2020
d176eeb
Fix mainProperty application
ghostbuster91 Jun 10, 2020
f7c384c
Pass credentials to methods as regular parameters
ghostbuster91 Jun 10, 2020
4a5ff27
Put auth params first
ghostbuster91 Jun 10, 2020
e2df636
[Sttp] SeparateErrorChannel is true by default
ghostbuster91 Jun 16, 2020
b3017bb
[Sttp] Simplify generated build.sbt
ghostbuster91 Jun 16, 2020
86150cb
[Sttp] Regenerate project
ghostbuster91 Jun 16, 2020
4588362
[Sttp] Update default version to 2.2.0
ghostbuster91 Jun 16, 2020
b572673
Regenerate petstore sample
ghostbuster91 Jun 16, 2020
91dd9b0
Restore cross-compilation to scala 2.12
ghostbuster91 Jun 23, 2020
9242bc4
Restore syntax with companion object for api definitions
ghostbuster91 Jun 23, 2020
de82caf
Remove specifying reservedWords as it was already specified in upper …
ghostbuster91 Jun 23, 2020
d868eda
Refactor mainPackageProperty and add tests for it
ghostbuster91 Jun 23, 2020
1f9cd3e
Update samples/client/petstore/scala-sttp/build.sbt
ghostbuster91 Jun 29, 2020
a6647d2
Update sbt to 1.3.12
ghostbuster91 Jun 29, 2020
8f5a98f
Run bin/utils/ensure-up-to-date and commit changes
ghostbuster91 Jun 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add option to customize json4s version
  • Loading branch information
ghostbuster91 committed Jun 16, 2020
commit 5c255e49f436356bc613220ba0e7ff6f7346030c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ public class ScalaSttpClientCodegen extends ScalaAkkaClientCodegen implements Co
"response's error raising them through enclosing monad (F[ReturnType]).";
public static final Boolean SEPARATE_ERROR_CHANNEL_DEFAULT = true;

public static final String JODA_TIME_VERSION= "jodaTimeVersion";
public static final String JODA_TIME_VERSION = "jodaTimeVersion";
public static final String JODA_TIME_VERSION_DESC = "The version of joda-time library";
public static final String JODA_TIME_VERSION_DEFAULT = "2.10.6";

public static final String JSON4S_VERSION = "json4sVersion";
public static final String JSON4S_VERSION_DESC = "The version of json4s library";
public static final String JSON4S_VERSION_DEFAULT = "3.6.8";

public ScalaSttpClientCodegen() {
super();
generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata)
Expand All @@ -52,8 +56,9 @@ public ScalaSttpClientCodegen() {
embeddedTemplateDir = templateDir = "scala-sttp";
outputFolder = "generated-code/scala-sttp";

cliOptions.add(CliOption.newString(STTP_CLIENT_VERSION,STTP_CLIENT_VERSION_DESC).defaultValue(STTP_CLIENT_VERSION_DEFAULT));
cliOptions.add(CliOption.newString(JODA_TIME_VERSION,JODA_TIME_VERSION_DESC).defaultValue(JODA_TIME_VERSION_DEFAULT));
cliOptions.add(CliOption.newString(STTP_CLIENT_VERSION, STTP_CLIENT_VERSION_DESC).defaultValue(STTP_CLIENT_VERSION_DEFAULT));
cliOptions.add(CliOption.newString(JODA_TIME_VERSION, JODA_TIME_VERSION_DESC).defaultValue(JODA_TIME_VERSION_DEFAULT));
cliOptions.add(CliOption.newString(JSON4S_VERSION, JSON4S_VERSION_DESC).defaultValue(JSON4S_VERSION_DEFAULT));
cliOptions.add(CliOption.newBoolean(SEPARATE_ERROR_CHANNEL, SEPARATE_ERROR_CHANNEL_DESC, SEPARATE_ERROR_CHANNEL_DEFAULT));
}

Expand All @@ -75,6 +80,9 @@ public void processOpts() {
if(!additionalProperties.containsKey(JODA_TIME_VERSION)) {
additionalProperties.put(JODA_TIME_VERSION, JODA_TIME_VERSION_DEFAULT);
}
if(!additionalProperties.containsKey(JSON4S_VERSION)) {
additionalProperties.put(JSON4S_VERSION, JSON4S_VERSION_DEFAULT);
}
Object separateErrorChannel = additionalProperties.getOrDefault(SEPARATE_ERROR_CHANNEL, SEPARATE_ERROR_CHANNEL_DEFAULT);
additionalProperties.put(SEPARATE_ERROR_CHANNEL, Boolean.valueOf(separateErrorChannel.toString()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ libraryDependencies ++= Seq(
{{#joda}}
"joda-time" % "joda-time" % "{{jodaTimeVersion}}",
{{/joda}}
"org.json4s" %% "json4s-jackson" % "3.6.7"
"org.json4s" %% "json4s-jackson" % "{{json4sVersion}}"
)

scalacOptions := Seq(
Expand Down