Swagger-codegen: [Swift3] Can't use property named result.

Created on 15 Jun 2017  路  4Comments  路  Source: swagger-api/swagger-codegen

Description

If I add a property named result in response, it conflicts with a variable that used in template.
Because that variable is also named result.

Swagger-codegen version

2.3.0

Command line used for generation

java -jar swagger-codegen-cli.jar generate -i api-docs.json -l swift3 -o HogeAPI --additional-properties responseAs=RxSwift,unwrapRequired=true

Steps to reproduce
  • Declare a property that named result in API response.
  • mvn package
Suggest a Fix

I think, all variables (not just result) should has any prefix to avoid conflict with properties.
e.g)
x let result = ...
o let _result = ...
I think _ is not usually used for property name.

Swift Bug help wanted

All 4 comments

@RyogaK right, local variables should be named differently. For other langauges, we use the prefix "localVar": https://github.com/swagger-api/swagger-codegen/search?utf8=%E2%9C%93&q=localVarPath&type=

I'll work on this next weekend (24th, 25th) if no one has started working on this.

cc @jaz-ah @jgavris @Edubits

I'm busy with other tasks and may not be able to work on this by the end of Aug.

If anyone wants to work on this, please reply to let us know.

i'm hitting this issue as well - will fix in my next changes today/tomorrow.

this is now fixed in latest master - @wing328 could you close this one out plz? thx.

Was this page helpful?
0 / 5 - 0 ratings