swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[csharp] AssemblyInfo customization issue

Open sbelan opened this issue 10 years ago • 6 comments

Hi,

I am using Swagger 2.1.5 to generate client code for -l CSHARP. I override AssemblyInfo mustache template and given that to the supporting file with customize destination location. But it is creating 2 AssemblyInfo files one which customized and proper location and another one at default swagger location.

So if user setting customized templates then it should take only that not the default one. Also Default location provided for the AssemblyInfo is not correct which is creating issue during project build in Visual studio. Right now, it is generating at src/Proprties. Whereas it should be under src\main\csharp\Properties.

Also in java data type for the supporting files is Map whereas in Csharp its list. Because of this it is taking duplicate items.

PS: I am raising issue first time, please excuse me if I missed out any guideline.

sbelan avatar Feb 04 '16 06:02 sbelan

@sbelan I'm using the latest master and run the following command:

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
  -i modules/swagger-codegen/src/test/resources/2_0/petstore.json \
  -l csharp \
  -o /var/tmp/csharp/android/ \
  -D optionalProjectFile=true

which generates the project file IO.Swagger.Client.csproj as well.

I can open the csproj file using Xamarin and build the project without issue.

About customising the AssemblyInfo mustache template, can you share with us more about the customization?

wing328 avatar Feb 04 '16 07:02 wing328

@wing328 ... thanks for your quick reply. I am generating client by extending Swagger. In jar which I am using (swagger-codegen-2.1.5) I found that Assembly info path is hard-coded as -- ["src" + File.separator +"Properties"] whereas in latest master those are changed to [packageFolder + File.separator + "Properties"] which seems correct. Also I was manually generating .csproj and other required files to build charp project where as those changes are added in current Master. Could you please let me know, Is current master changes are available in swagger-codegen-2.1.5 or coming in next version swagger-codegen-2.1.6? I am using swagger-codegen-2.1.5 by considering stable one and currently moving my project from 2.1.4 to 2.1.5 for all language client code genration.

sbelan avatar Feb 04 '16 09:02 sbelan

Those improvements will be included in the swagger codegen 2.1.6 release.

wing328 avatar Feb 04 '16 09:02 wing328

@sbelan If you don't mind, please share your upgrade experience (from 2.1.4 to 2.1.5) with us or me (you can find my email address in my github page)

wing328 avatar Feb 04 '16 11:02 wing328

@wing328 .. Hi, I am extending swagger codegen for to generate client code for different languages. For Csharp I already did few customization by extending swagger which I found the part of release 2.1.5 and 2.1.6. Also I have few more changes related to csharp which I will suggest/contribute soon similarly for java too. During upgrade I didn't faced any issues or impact on my existing code. Its very smooth as I am extending swagger which gives me lots of flexibility. Thanks a lot for such a nice API.

sbelan avatar Feb 04 '16 11:02 sbelan

Thanks for the positive feedback. Glad to hear that the upgrade is very smooth.

wing328 avatar Feb 04 '16 12:02 wing328