Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between Swagger UI vs Swagger CodeGen?

What is the difference between Swagger UI vs Swagger CodeGen?

I read the description in https://swagger.io/tools/. It sounds like Swagger Editor, UI, and codeGen are totally different tools. If I want to generate .Net server stubs and visualize them, does it mean I need to use both UI and CodeGen?

like image 574
Cloe Avatar asked Jun 17 '26 02:06

Cloe


1 Answers

Yes, they are different tools for different purposes.

Swagger UI is a documentation renderer, basically an HTML page. You point it to an OpenAPI definition (YAML or JSON file), and Swagger UI produces API documentation that looks like this. You can host it on your website.

Swagger Editor is an editor where you can write OpenAPI definitions manually, or load/paste arbitrary OpenAPI definitions to check them for syntax errors. Swagger Editor also has Swagger Codegen integrated into it, accessible via the "Generate Server" and "Generate Client" menus.

Swagger Codegen is a code generator. You can use it to generate server stubs and client SDKs from an OpenAPI definition. For example, here's how to generate an ASP.NET server stub using Swagger Codegen CLI (line breaks added for readability):

java -jar swagger-codegen-cli-3.0.21.jar generate
     -i https://petstore.swagger.io/v2/swagger.yaml
     -l aspnetcore
     -o .\aspnetcore-server
like image 134
Helen Avatar answered Jun 21 '26 12:06

Helen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!