Use Swagger tool to generate a Java SDK from Chuk Norris OpenAPI service description

When you have an OpenAPI documentation, you know how to build your requests and how to parse responses. Swagger can help you speed up that process by generating a SDK that wraps the calls for you.

  1. Go to Swagger Editor online.
  2. File menu / Import file / upload the following "chuckNorris_openAPI-v2.yaml" file.
    This file is similar to the one created in a previous activity except for 2 things:
  3. Use the Generate Client menu / java
  4. Unzip the downloaded file: unzip ~/Downloads/java-client-generated.zip
    The docs folder contains the documentation for the 3 generated classes that you will use:
    (You can use the ReText program to display Markdown file: retext ~/Downloads/docs/ChuckNorrisApi.md.)
  5. To install the API client library to your local Maven repository:
    1. Edit the extracted pom.xml file and add the following dependency in the dependencies section:
    2. Run the command mvn clean install
  6. Open Eclipse, create a new simple Maven project. Edit the pom.xml file and add the following dependency (as explained in the README.md):
  7. Add a new class (examples are given in the README.md file):
  8. Execute!