Eclipse Codewind tool for OpenAPI in Eclipse
The Eclipse Codewind tool for OpenAPI includes wizards that invoke the OpenAPI Generator to create API clients, server stubs, and HTML documentation from OpenAPI definitions. The tools are integrated and customized to work with Codewind for Eclipse, but they also work with a base Eclipse IDE for Java EE Developers installation.
Installing
- Download and install the latest Eclipse IDE for Java EE Developers or use an existing installation. If you use the Eclipse Codewind tool for OpenAPI, the earliest supported version of the Eclipse IDE for Codewind is Version 2019-06 (4.12).
- [Optional] Install Codewind from the Eclipse Marketplace.
- Install the Eclipse Codewind tool for OpenAPI from the Eclipse Marketplace.
Generating HTML and client and server stubs by using the OpenAPI wizard
- Launch the context menu on any existing workspace projects or any
openapi.yaml
workspace OpenAPI definition files from the Package Explorer or Project Explorer views. - If Codewind is installed, the context menu generator actions are available in the Codewind Explorer view.
- Ensure at least one OpenAPI definition is in the project.
- Select an action to generate the client or server stubs or HTML documentation.
- Enter the requested information that is displayed in the wizard. For the output folder, keep the default selection. The project root, which is the parent of the source folder, is selected by default.
- Click Finish.
- If a client or server stub is selected, and if it is a Java Maven project, then when prompted with the warning message, click Yes to merge the generated
.pom
file with the existing.pom
file. The existingpom.xml
file is backed up aspom-backup.xml
or as a variation of this name. The newpom.xml
file is a merged version of the original.pom
file and the.pom
file that is generated. The merge attempts to include all necessary dependencies for the project to build properly. Because of limitations in the merge process, XML comments, such as<!-- example comment -->
, from the original.pom
file are removed. For any Codewind project, if autobuild is turned on, the project builds automatically. - See that your
src
folder shows the newly generated code. Depending on the generator type that you chose, agen
package is created. Your Codewind project state returns to the[Running]
state. The target source folders,src/main/java
andsrc/test/java
, are not customizable. - Now, you can customize the application logic.
- After generation, edit the
.openapi-generator-ignore
file to ensure that subsequent code generation does not overwrite custom code.
Generator options
The following command line equivalent options are available for client and server generation:
-i <OpenAPI definition>
-g <generator name>
-o <output directory>
The following command line equivalent options are available for HTML generation:
-i <OpenAPI definition>
-g html2
-o <output directory>
Features
- Generate API clients in any of the supported languages/frameworks.
- Generate server stubs in any of the supported languages/frameworks.
- Generate HTML documentation from an OpenAPI definition file.
Last update: Oct 12, 2020