This is Simple Swagger/OpenAPI endpoint generator tool. It allows you to generate missing controller methods or generate a new controller with a specified path.
Supported languages:
- Spring
For the plugin to work correctly, you need to specify the path to your Swagger/OpenAPI configuration.
You can do this in Settings
> Tools
> Endpoint UI Codegen Config
.
To generate the missing endpoints, open the file with the controller in the editor. Your controller must be annotated * @RestController* or @Controller and @RequestMapping with the specified path.
The method is considered present if the code contains the annotation "@METHOD_NAME Mapping("/some/path")
Right-click on the required package, select New
> Endpoint UI Codegen
> Controller
.
In the dialog box that appears, you can specify the path of the controller and whether the controller will be empty. Name of the class will be generated according to the URL.
Smart generation allows you to create missing controllers and models based on configuration. In addition, the plugin automatically recognizes packages for generated files. Information about package must be stored in the configuration.
For controllers, this is the tag name:
"/api/cinema/{id}": {
"get": {
"tags": [
"com.example.your.package.here.CinemaRestController"
],
"summary": "getById",
...
And for model, this is the description:
"Actor": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"isRetired": {
"type": "boolean"
},
"lastName": {
"type": "string"
}
},
"title": "Actor",
"description": "com.example.your.package.here"
},
In case you don't want the plugin to handle certain paths, you can use the blacklist.
This blacklist should be located in extensions for the OpenApi configuration.
Name of the extension must be x-swagger-ui-blacklist
and contain an array of strings.
For endpoints that exactly match those contained in the blacklist won't be generated an endpoint (for any HTTP method).
Config example
{
"swagger": "2.0",
"info": {
"description": "Example Description",
"title": "example.com API",
"x-swagger-ui-blacklist": [
"/api/first/url",
"/api/second/url"
]
},
"host": "example.com",
.
.
and so on
- First specify new version in both
gradle.properties
andresources/META-INF/plugin.xml
. - Then for compilation use this Gradle task:
gradle clean buildDependents -x test -x detekt -x ktlintMainSourceSetCheck
- You can find the zipped plugin at
build/distributions/
-
Using IDE built-in plugin system:
Settings/Preferences > Plugins > Marketplace > Search for "Endpoint UI Codegen" > Install Plugin
-
Manually:
Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...
Plugin based on the IntelliJ Platform Plugin Template.