Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swagger swagger-codegen-maven-plugin generate Default Api interface

Tags:

swagger

i'm trying to use swagger-codegen-maven-plugin to generate my interface . after compiling with the plugin - it generates all the files correctly but for some reason the interface name is DefaultApi.

i looked for some configuration that i can change the name of the interface that been generated but didnt find the solution for that.

any idea on that??

like image 843
Amit Rintzler Avatar asked Jul 10 '16 14:07

Amit Rintzler


People also ask

How do I get swagger codegen?

Swagger Codegen is available for download in the GitHub repository, or can be generated for any new or existing OpenAPI-defined API in the integrated SwaggerHub platform.

What is codegen in swagger?

The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. The source code for the Swagger Codegen can be found in GitHub. GitHub: https://github.com/swagger-api/swagger-codegen.


1 Answers

"DefaultApi" is used when there's no tags specified for the endpoint.

For example, this endpoint will be put in a class named "UserApi" since the tags is set to User.

You will need to update the spec to include proper tags for endpoints to avoid using "DefaultApi"

UPDATE: On May 2018, about 50 top contributors and template creators of Swagger Codegen decided to fork Swagger Codegen to maintain a community-driven version called OpenAPI Generator. Please refer to the Q&A for more information.

like image 175
William Cheng Avatar answered Sep 19 '22 06:09

William Cheng