From 17b63b2be833b3dd0fec894d4f934dd046cd2deb Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 8 Aug 2013 15:32:37 -0700 Subject: [PATCH] more refactoring to support 1.2 spec --- src/main/resources/logback.xml | 2 +- .../codegen/BasicCSharpGenerator.scala | 2 +- .../swagger/codegen/BasicFlashCodegen.scala | 2 +- .../swagger/codegen/BasicGenerator.scala | 3 +- .../codegen/BasicGroovyGenerator.scala | 2 +- .../swagger/codegen/BasicJavaGenerator.scala | 5 ++-- .../swagger/codegen/BasicObjcGenerator.scala | 2 +- .../swagger/codegen/BasicPHPGenerator.scala | 2 +- .../codegen/BasicPython3Generator.scala | 2 +- .../codegen/BasicPythonGenerator.scala | 2 +- .../swagger/codegen/BasicRubyGenerator.scala | 2 +- .../swagger/codegen/BasicScalaGenerator.scala | 2 +- .../com/wordnik/swagger/codegen/Codegen.scala | 2 +- .../wordnik/swagger/codegen/PathUtil.scala | 6 ++-- .../swagger/codegen/SwaggerDocGenerator.scala | 2 +- .../codegen/language/CodegenConfig.scala | 2 +- .../swagger/codegen/spec/SwaggerSpec.scala | 2 +- .../codegen/spec/SwaggerSpecValidator.scala | 2 +- .../swagger/codegen/spec/Validator.scala | 2 +- .../swagger/codegen/util/ApiExtractor.scala | 9 +++--- .../swagger/codegen/util/CoreUtils.scala | 2 +- .../codegen/util/ResourceExtractor.scala | 2 +- .../model/SwaggerModelSerializer.scala | 29 +++++++++++++++++-- .../wordnik/swagger/model/SwaggerModels.scala | 2 +- src/test/scala/BasicCSharpGeneratorTest.scala | 2 +- src/test/scala/BasicGeneratorTest.scala | 2 +- src/test/scala/BasicJavaGeneratorTest.scala | 2 +- src/test/scala/BasicObjcGeneratorTest.scala | 2 +- src/test/scala/BasicScalaGeneratorTest.scala | 2 +- src/test/scala/CodegenConfigTest.scala | 2 +- src/test/scala/PathUtilTest.scala | 14 +++++---- .../swaggerSpec1_1/SwaggerModelTest.scala | 2 +- src/test/scala/swaggerSpec1_1/UtilsTest.scala | 2 +- 33 files changed, 77 insertions(+), 43 deletions(-) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index 5aa5cd9bfa8b..c7d0db9d3a23 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -5,7 +5,7 @@ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - + diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicCSharpGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicCSharpGenerator.scala index 2ca8abbfdafe..8836c2562235 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicCSharpGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicCSharpGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicFlashCodegen.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicFlashCodegen.scala index 81e994af5fbd..ee3f84af32de 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicFlashCodegen.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicFlashCodegen.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala index 24f872a58ec2..3ee78c468a4a 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,6 +61,7 @@ abstract class BasicGenerator extends CodegenConfig with PathUtil { } implicit val basePath = getBasePath(host, doc.basePath) + println("base path is " + basePath) val apiReferences = doc.apis if (apiReferences == null) diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicGroovyGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicGroovyGenerator.scala index 91314533e341..4f0ed28f51d6 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicGroovyGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicGroovyGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala index 346aa1d87778..a59ec0ff4bec 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicJavaGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,8 @@ class BasicJavaGenerator extends BasicGenerator { "float" -> "Float", "long" -> "Long", "double" -> "Double", - "object" -> "Object") + "object" -> "Object", + "integer" -> "Integer") // location of templates override def templateDir = "Java" diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicObjcGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicObjcGenerator.scala index 8dab7ccd22eb..425f9c6ec2d9 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicObjcGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicObjcGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicPHPGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicPHPGenerator.scala index e58038d1948d..03bccaf4ac9c 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicPHPGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicPHPGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicPython3Generator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicPython3Generator.scala index 08324e645da7..00ece3c50f39 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicPython3Generator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicPython3Generator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicPythonGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicPythonGenerator.scala index 5ccf8329dc56..7c8b825bcc7d 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicPythonGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicPythonGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicRubyGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicRubyGenerator.scala index 6a47a78f58a5..4ec6f0fe82fd 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicRubyGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicRubyGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala index efdff6017385..0827807fe7a8 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/BasicScalaGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala b/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala index 5b7e3635cfe7..bd699eb13e1b 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/Codegen.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/PathUtil.scala b/src/main/scala/com/wordnik/swagger/codegen/PathUtil.scala index 6dd2b79493ed..75772a5c3243 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/PathUtil.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/PathUtil.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,9 @@ trait PathUtil { } def toModelName(name: String) = { - name(0).toUpper + name.substring(1) + if(name.length > 0) + name(0).toUpper + name.substring(1) + else "MISSING MODEL NAME" } def toApiName(name: String) = { diff --git a/src/main/scala/com/wordnik/swagger/codegen/SwaggerDocGenerator.scala b/src/main/scala/com/wordnik/swagger/codegen/SwaggerDocGenerator.scala index 8c580a19e8d7..023cf1d02495 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/SwaggerDocGenerator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/SwaggerDocGenerator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala b/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala index 8e0a0bcc171e..1888d7e178ed 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpec.scala b/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpec.scala index 9fc479a751cf..e9c3c0872626 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpec.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpec.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpecValidator.scala b/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpecValidator.scala index 830a03b75c94..c16eac9a7dc7 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpecValidator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/spec/SwaggerSpecValidator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/spec/Validator.scala b/src/main/scala/com/wordnik/swagger/codegen/spec/Validator.scala index a8bfbeb282f9..9e7167cf21fd 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/spec/Validator.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/spec/Validator.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/util/ApiExtractor.scala b/src/main/scala/com/wordnik/swagger/codegen/util/ApiExtractor.scala index aca4fd2b0b4f..f1d429feaffa 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/util/ApiExtractor.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/util/ApiExtractor.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,13 +31,14 @@ object ApiExtractor extends RemoteUrl { implicit val formats = SwaggerSerializers.formats def fetchApiListings(basePath: String, apis: List[ApiListingReference], apiKey: Option[String] = None): List[ApiListing] = { - println("looking at base path " + basePath) (for (api <- apis) yield { try{ val json = (basePath.startsWith("http")) match { case true => { - println("calling: " + ((basePath + api.path + apiKey.getOrElse("")).replaceAll(".\\{format\\}", ".json"))) - urlToString((basePath + api.path + apiKey.getOrElse("")).replaceAll(".\\{format\\}", ".json")) + val path = if(api.path.startsWith("http")) api.path + else basePath + api.path + println("calling: " + ((path + apiKey.getOrElse("")).replaceAll(".\\{format\\}", ".json"))) + urlToString((path + apiKey.getOrElse("")).replaceAll(".\\{format\\}", ".json")) } case false => Source.fromFile((basePath + api.path).replaceAll(".\\{format\\}", ".json")).mkString } diff --git a/src/main/scala/com/wordnik/swagger/codegen/util/CoreUtils.scala b/src/main/scala/com/wordnik/swagger/codegen/util/CoreUtils.scala index 6d2d61399ead..b78b1c3b60e6 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/util/CoreUtils.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/util/CoreUtils.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/codegen/util/ResourceExtractor.scala b/src/main/scala/com/wordnik/swagger/codegen/util/ResourceExtractor.scala index d6af174d14e0..166db65291e0 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/util/ResourceExtractor.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/util/ResourceExtractor.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala b/src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala index 85bf75f68a63..72b3c9d9d682 100644 --- a/src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala +++ b/src/main/scala/com/wordnik/swagger/model/SwaggerModelSerializer.scala @@ -12,6 +12,20 @@ import scala.collection.mutable.{ListBuffer, LinkedHashMap} object SwaggerSerializers { import ValidationMessage._ + val swaggerTypeMap = Map( + // simple types + ("integer", "int32") -> "int", + ("integer", "int64") -> "long", + ("number", "float") -> "float", + ("number", "double") -> "double", + ("string", "byte") -> "byte", + ("string", "date") -> "Date", + ("string", "date-time") -> "Date", + + // containers + ("array", "") -> "Array" + ) + implicit val formats = DefaultFormats + new ModelSerializer + new ModelPropertySerializer + @@ -326,9 +340,20 @@ object SwaggerSerializers { class ModelPropertySerializer extends CustomSerializer[ModelProperty] (formats => ({ case json => implicit val fmts: Formats = formats + + val `type` = (json \ "$ref") match { + case e: JString => e.s + case _ => { + // convert the jsonschema types into swagger types. Note, this logic will move elsewhere soon + SwaggerSerializers.swaggerTypeMap.getOrElse( + ((json \ "type").extractOrElse(""), (json \ "format").extractOrElse("")) + , (json \ "type").extractOrElse("")) + } + } + ModelProperty( - `type` = (json \ "type").extractOrElse(""), - `qualifiedType` = (json \ "type").extractOrElse(""), + `type` = `type`, + `qualifiedType` = `type`, required = (json \ "required") match { case e:JString => e.s.toBoolean case e:JBool => e.value diff --git a/src/main/scala/com/wordnik/swagger/model/SwaggerModels.scala b/src/main/scala/com/wordnik/swagger/model/SwaggerModels.scala index f2d0ad630e6c..2257f8259e03 100644 --- a/src/main/scala/com/wordnik/swagger/model/SwaggerModels.scala +++ b/src/main/scala/com/wordnik/swagger/model/SwaggerModels.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/BasicCSharpGeneratorTest.scala b/src/test/scala/BasicCSharpGeneratorTest.scala index fc467c6bcb3d..2307fd152cc2 100644 --- a/src/test/scala/BasicCSharpGeneratorTest.scala +++ b/src/test/scala/BasicCSharpGeneratorTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/BasicGeneratorTest.scala b/src/test/scala/BasicGeneratorTest.scala index 11f7a8d95f1b..f891e3992ea7 100644 --- a/src/test/scala/BasicGeneratorTest.scala +++ b/src/test/scala/BasicGeneratorTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/BasicJavaGeneratorTest.scala b/src/test/scala/BasicJavaGeneratorTest.scala index 5ecdabb9eddf..5ee13cbbe7c4 100644 --- a/src/test/scala/BasicJavaGeneratorTest.scala +++ b/src/test/scala/BasicJavaGeneratorTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/BasicObjcGeneratorTest.scala b/src/test/scala/BasicObjcGeneratorTest.scala index 5b6f5c0ada2d..c3da6684c455 100644 --- a/src/test/scala/BasicObjcGeneratorTest.scala +++ b/src/test/scala/BasicObjcGeneratorTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/BasicScalaGeneratorTest.scala b/src/test/scala/BasicScalaGeneratorTest.scala index ca268b446def..89014d00a2e4 100644 --- a/src/test/scala/BasicScalaGeneratorTest.scala +++ b/src/test/scala/BasicScalaGeneratorTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/CodegenConfigTest.scala b/src/test/scala/CodegenConfigTest.scala index c45bb3a3adae..eab97a880e03 100644 --- a/src/test/scala/CodegenConfigTest.scala +++ b/src/test/scala/CodegenConfigTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/PathUtilTest.scala b/src/test/scala/PathUtilTest.scala index 765386965228..4055799b50be 100644 --- a/src/test/scala/PathUtilTest.scala +++ b/src/test/scala/PathUtilTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ import com.wordnik.swagger.codegen.BasicScalaGenerator +import com.wordnik.swagger.codegen.PathUtil import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner @@ -45,7 +46,10 @@ class PathUtilTest extends FlatSpec with ShouldMatchers { * since swagger-spec 1.2 doesn't support `basePath` in the Resource Listing, * ensure the base path is extracted from the input host **/ - it should "get determine the basePath implicitly" in { - config.getBasePath("http://foo.com/api-docs", "") should be ("http://foo.com/api-docs") - } -} \ No newline at end of file + it should "get determine the basePath implicitly" in { + sys.props -= "fileMap" + new PathUtilImpl().getBasePath("http://foo.com/api-docs", "") should be ("http://foo.com/api-docs") + } +} + +class PathUtilImpl extends PathUtil diff --git a/src/test/scala/swaggerSpec1_1/SwaggerModelTest.scala b/src/test/scala/swaggerSpec1_1/SwaggerModelTest.scala index d514f51770bb..d3d63a076240 100644 --- a/src/test/scala/swaggerSpec1_1/SwaggerModelTest.scala +++ b/src/test/scala/swaggerSpec1_1/SwaggerModelTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/swaggerSpec1_1/UtilsTest.scala b/src/test/scala/swaggerSpec1_1/UtilsTest.scala index 832837b07041..b7c21e7b50cb 100644 --- a/src/test/scala/swaggerSpec1_1/UtilsTest.scala +++ b/src/test/scala/swaggerSpec1_1/UtilsTest.scala @@ -1,5 +1,5 @@ /** - * Copyright 2012 Wordnik, Inc. + * Copyright 2013 Wordnik, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.