swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.01k stars 6.03k forks source link

Sample code generation for C# with customized template.. no demo for it!!! (#1618) #7312

Open rafiqips5 opened 6 years ago

rafiqips5 commented 6 years ago

We need sample code generation for our own template and how to create the template for C#.

Bug or feature request? bug

Which Swagger-Editor version? 2.2.3

How did you install Swagger-Editor? | downloaded the jar file

Which browser & version? all browser

5.Which operating system? windows 10

followed the below steps for sample.

Demonstration API definition Step 1 :

java -jar swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l php -o "D:\SwaggerAPI"

java -jar swagger-codegen-cli.jar generate -i http://localhost:51148/swagger/docs/v1 -l csharp -o "D:\SwaggerAPI"

Step 2 :

java -jar swagger-codegen-cli.jar help generate

step 3 :

java -jar swagger-codegen-cli.jar config-help -l php

step 4:

browse and save it where you download the code @ step 1 to available at one folder.

http://petstore.swagger.io/v2/swagger.json

Step 5 :

java -jar swagger-codegen-cli.jar generate -i http://petstore.swagger.io/v2/swagger.json -l csharp -o "D:\SwaggerAPI"

we have followed the below url

https://github.com/swagger-api/swagger-codegen

from here ,cant able to understand .

https://github.com/swagger-api/swagger-codegen#making-your-own-codegen-modules

wing328 commented 6 years ago

Do you mean you need help using customized templates?

Bobrovskiy commented 6 years ago

https://github.com/swagger-api/swagger-codegen/tree/master/bin/windows

set "dir=%1" set "codegenDocUrl=%2" set "codegenDocConfig=%3"

set "apidir=Api" set "modeldir=Model" set "clientdir=Client"

IF EXIST "%dir%" ( rmdir "%dir%" /s /q ) IF EXIST "%apidir%" ( rmdir "%apidir%" /s /q ) IF EXIST "%modeldir%" ( rmdir "%modeldir%" /s /q ) IF EXIST "%clientdir%" ( rmdir "%clientdir%" /s /q )

md "%dir%" md "%apidir%" md "%modeldir%" md "%clientdir%" java -jar swagger-codegen-cli-3.0.0-rc0.jar generate --lang csharp -c %codegenDocConfig% --additional-properties targetFramework=v5.0,packageGuid={67035b31-f8e5-41a4-9673-954035084f7d},netCoreProjectFile=true --model-name-prefix "%dir%.Api" --model-name-suffix "" -i %codegenDocUrl% -o %dir%

xcopy /s /e "%dir%/src/%dir%/Api" "%apidir%" xcopy /s /e "%dir%/src/%dir%/Model" "%modeldir%" xcopy /s /e "%dir%/src/%dir%/Client" "%clientdir%" rmdir "%dir%" /s /q