Skip to content

Commit cc0a30e

Browse files
committed
added header support, suppressed println
1 parent 0ffc6cb commit cc0a30e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/main/scala/com/wordnik/swagger/codegen/spec/Validator.scala

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.wordnik.swagger.codegen.spec
1818

1919
import com.wordnik.swagger.codegen.util.{CoreUtils, ApiExtractor, ResourceExtractor}
2020
import com.wordnik.swagger.codegen.PathUtil
21+
import com.wordnik.swagger.model._
2122

2223
import scala.collection.JavaConversions._
2324

@@ -28,9 +29,19 @@ object Validator extends PathUtil {
2829
}
2930
val host = args(0)
3031
val authorization = {
31-
// if (args.length > 1) Some("?api_key=" + args(1))
32-
// else
33-
None
32+
Option (System.getProperty("header")) match {
33+
case Some(e) => {
34+
// this is ugly and will be replaced with proper arg parsing like in ScalaAsyncClientGenerator soon
35+
val authInfo = e.split(":")
36+
Some(ApiKeyValue(authInfo(0), "header", authInfo(1)))
37+
}
38+
case _ => {
39+
if (args.length > 1) {
40+
Some(ApiKeyValue("api_key", "query", args(1)))
41+
}
42+
else None
43+
}
44+
}
3445
}
3546

3647
val outputFilename = {

src/main/scala/com/wordnik/swagger/codegen/util/RemoteUrl.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ trait RemoteUrl {
2727
}
2828
case None => new URL(url).openConnection()
2929
}
30-
println(conn)
3130
is = conn.getInputStream()
3231
Source.fromInputStream(is).mkString
3332
}

0 commit comments

Comments
 (0)