Enable OpenAPI Specification Generation
Before enabling the OpenAPI specification, you should have a REST API defined. The RestApi worksheet and RestApiEndpointGroup worksheet should be created. We will pick the Sample REST API as an example for illustration.
Enabling the AlchemyJ to generate the specification
Go to the OpenAPI Specification Settings section of the RestApi worksheet. Set the value of Enable OpenAPI Specification Generation as Yes.
Fill in other configurations of the section such as the title, description, contact name, API license and so on.
Go to the OpenAPI Response Code Configuration section. Change the configurations of the response message if required. They will be displayed on the OpenAPI specification.
With the above steps, the OpenAPI specification will be generated along with the API when compiling.
Accessing the specification
To access the OpenAPI specification, you need to start up your API. From the browser, to open the URL like http://localhost:8080/baseURL/openapi/index.html, where localhost:8080 is the server name / IP / domain and port of the application server. The baseURL/ is the base URL of your API.
Downloading the data file of the specification
AlchemyJ provides a built-in specification UI for presenting the specification data. If you have your own UI, you can download the data file of the specification and put it into your UI. To download the data file, you can click on the hyperlink under the Base URL.