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 dd868242234..2399a5c0803 100644 --- a/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala +++ b/src/main/scala/com/wordnik/swagger/codegen/language/CodegenConfig.scala @@ -109,7 +109,7 @@ abstract class CodegenConfig { def toVarName(name: String): String = { name match { case _ if (reservedWords.contains(name)) => escapeReservedWord(name) - case _ => typeMapping.getOrElse(name, name) + case _ => name } } diff --git a/src/test/scala/BasicCSharpGeneratorTest.scala b/src/test/scala/BasicCSharpGeneratorTest.scala new file mode 100644 index 00000000000..fc467c6bcb3 --- /dev/null +++ b/src/test/scala/BasicCSharpGeneratorTest.scala @@ -0,0 +1,41 @@ +/** + * Copyright 2012 Wordnik, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import com.wordnik.swagger.model._ +import com.wordnik.swagger.codegen.{BasicCSharpGenerator, PathUtil} +import com.wordnik.swagger.codegen.util._ +import com.wordnik.swagger.codegen.language._ + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner +import org.scalatest.FlatSpec +import org.scalatest.matchers.ShouldMatchers + +import scala.reflect.BeanProperty + +@RunWith(classOf[JUnitRunner]) +class BasicCSharpGeneratorTest extends FlatSpec with ShouldMatchers { + val config = new BasicCSharpGenerator + + behavior of "BasicCSharpGenerator" + /* + * A response of type "void" will turn into a declaration of None + * for the template generator + */ + it should "perserve the name date" in { + config.toVarName("date") should be ("date") + } +}