Skip to content

Commit 87c12c1

Browse files
author
George Shakhnazaryan
committed
Extract actual work from generateClient so that we can call it without killing the JVM.
1 parent 0d40a53 commit 87c12c1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@ abstract class BasicGenerator extends CodegenConfig with PathUtil {
4444
var codegen = new Codegen(this)
4545

4646
def generateClient(args: Array[String]) = {
47+
generateClientWithoutExit(args)
48+
System.exit(0)
49+
}
50+
51+
def generateClientWithoutExit(args: Array[String]) {
4752
if (args.length == 0) {
4853
throw new RuntimeException("Need url to resource listing as argument. You can also specify VM Argument -DfileMap=/path/to/folder/containing.resources.json/")
4954
}
5055
val host = args(0)
5156
val authorization = {
52-
Option (System.getProperty("header")) match {
57+
Option(System.getProperty("header")) match {
5358
case Some(e) => {
5459
// this is ugly and will be replaced with proper arg parsing like in ScalaAsyncClientGenerator soon
5560
val authInfo = e.split(":")
@@ -129,7 +134,6 @@ abstract class BasicGenerator extends CodegenConfig with PathUtil {
129134
})
130135

131136
codegen.writeSupportingClasses(operationMap, allModels.toMap)
132-
System.exit(0)
133137
}
134138

135139
def extractApiOperations(apiListings: List[ApiListing], allModels: HashMap[String, Model] )(implicit basePath:String) = {

0 commit comments

Comments
 (0)