Creating an EGL Service Skeleton
This topic explains how to generate a service from an OpenAPI document (json, yaml or yml file). For more information about the service concept, refer to the Introduction to Service parts guide
Executing the following steps for the creation of the service:
- In the workbench, right-click a .json/.yaml/.yml file and select EGL ServicesCreate EGL Service Skeleton option
- In the New EGL part window, you will see all the paths available in the OpenAPI document. Select the paths you want to implement in your code, then click the “Next” button.
- In the new window, you will be presented with all the functionalities discovered in the paths previously selected, together with more options. Select the options and functions you want to generate in your code and click Finish.
- The file will open, and you will see all the generated code for the functions you selected in the previous steps. Edit and implement the output code with your logic.
This process will generate an output code containing all the functions selected in the wizard
and the additional information presented in the OpenAPI Document for every specific function.
Following is an example of the generated output:
package services;
service myOpenAPIDocument_Service {
Title = "Title of the OpenAPI Document",
description = "Description of the OpenAPIDocument",
version = "X.X.X" }
function randomFunction_POST(var VarClass in){
tags = [ "tags"],
description = "Description of the POST function for this path",
@PostRest {
uriTemplate = "/pathOfTheFunction",
requestFormat = JSON,
responses = [
@RestResponse{
statusCode = 200,
description = "Successful operation",
responseFormat = JSON,
responseType = ResponseVarClass
}]
}
}
// Your future logic goes here...
end
end