From 14795df85d3b2e51f923d20591d5669376d68b1f Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Wed, 11 Feb 2015 11:00:41 +0000 Subject: [PATCH] Scala api.mustache: make new constructor backward compatible When default values have been provided with the api.mustache constructor, backward compatibility was broken because of the public instance variables becoming immutable vals whilst they were vars before. We can now use the constructor arguments as default values for the internal vars and establish backward compatibility with existing code. --- .../swagger-codegen/src/main/resources/scala/api.mustache | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/scala/api.mustache b/modules/swagger-codegen/src/main/resources/scala/api.mustache index 87b474461402..1de17ce60f59 100644 --- a/modules/swagger-codegen/src/main/resources/scala/api.mustache +++ b/modules/swagger-codegen/src/main/resources/scala/api.mustache @@ -11,8 +11,10 @@ import java.util.Date import scala.collection.mutable.HashMap {{#operations}} -class {{classname}}(val basePath: String = "{{basePath}}", - apiInvoker: ApiInvoker = ApiInvoker) { +class {{classname}}(val defBasePath: String = "{{basePath}}", + defApiInvoker: ApiInvoker = ApiInvoker) { + var basePath = defBasePath + var apiInvoker = defApiInvoker def addHeader(key: String, value: String) = apiInvoker.defaultHeaders += key -> value