atomicbits / scraml

Generate typesafe Java and Scala REST API clients
Other
43 stars 7 forks source link

Scala generator uses invalid pattern match deconstruction names for fields that are reserved words #160

Open ireactsam opened 4 years ago

ireactsam commented 4 years ago

When a field is a reserved word, e.g. type, the generator will use in the pattern match the backticked type, but that has an other meaning in Scala pattern matching deconstruction. So in stead of generating

    def pack: ((String, String, ...)) => EventLd = {
      case ((`type`, name, ...)) =>
        EventLd.apply(`type`, name, ...)
    }

it should better generate

    def pack: ((String, String, ...)) => EventLd = {
      case ((type_, name, ...)) =>
        EventLd.apply(type_, name, ...)
    }