REST Clients
E.D.D.I allows the generation of REST clients in various languages via Swagger. This page describes how to generate a client.
We will demonstrate to ways to genertase EDDI's REST Clients :
- Directly from EDDI by using a maven command line (Method 1)
- Providing the
EDDI's swagger.json
file toswagger-codegen
(Method 2)
Method 1:
Prerequisites
Git,Docker, Docker-Compose, Maven
Client generation
To generate a client, follow these steps:
Checkout the E.D.D.I source repo via
git clone https://github.com/labsai/EDDI.git
Run this command on the cloned repo
mvn package -pl client -P generate-client -Dclient.lang=<lang>
where
<lang>
is the parameter passed to swagger-codegen'sgenerate
command - see swagger-codegen on GitHub for more information about the supported languages.- Find the generated client code under
client/target/<lang>
.
Method 2:
Prerequisites
Git, Maven
Client generation
To generate a client, follow these steps:
Make sure that EDDI is running and you can access EDDI's
swagger
documenttaion viahttp://localhost:7070/
Checkout the
swagger-codegen
source repo viagit clone https://github.com/swagger-api/swagger-codegen
- Build
swagger-codegen
with maven command :mvn package
- Run the swagger command to create the rest client by providing
swagger.json
java -jar path/to/swagger-codegen-jar/swagger-codegen-cli.jar generate \ -i http://localhost:7070/swagger.json \ -l java \ -o path/to/output/directory/of/the/generated/client