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 to swagger-codegen (Method 2)

Method 1:

Prerequisites

Git,Docker, Docker-Compose, Maven

Client generation

To generate a client, follow these steps:

  1. Checkout the E.D.D.I source repo via git clone https://github.com/labsai/EDDI.git

  2. 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's generate command - see swagger-codegen on GitHub for more information about the supported languages.

  3. Find the generated client code under client/target/<lang>.

Method 2:

Prerequisites

Git, Maven

Client generation

To generate a client, follow these steps:

  1. Make sure that EDDI is running and you can access  EDDI's swagger documenttaion via http://localhost:7070/

  2. Checkout the swagger-codegen source repo via git clone https://github.com/swagger-api/swagger-codegen

  3. Build swagger-codegen with maven command : mvn package
  4. Run the swagger command to create the rest client by providing swagger.json
command to create eddi java rest client
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