Generate Project Using API Specs

Generate Project Stub


This page provides detailed steps for generating projects using the given API specifications.


Build A Microservice

  1. Prepare Swagger contracts that detail all the APIs that the service is going to expose for external consumption. eGov uses a customised Swagger Codegen tool.

  2. Download the jar file and make sure it is available in the classpath. Use the Swagger Codegen tool to generate client SDKs using these Swagger contracts.

Refer to the following tutorials to understand the creation of Swagger contracts -

OpenAPI 3.0 Tutorial| Swagger Tutorial For Beginners | Design REST API Using Swagger Editor

Generate API Skeleton

  1. Use the generic command below to create an API skeleton for any Swagger contract:

java -jar codegen-2.0-SNAPSHOT-jar-with-dependencies.jar 
-l -t -u {CONTRACT_PATH } -a project_name -b digit

The following sequence is used to generate the API skeleton using codegen jar:

  1. Navigate to the folder where you have downloaded the codegen jar.

  2. Execute the following command:

java -jar codegen-2.0-SNAPSHOT-jar-with-dependencies.jar -l -t -u -a birth-registration -b digit


Download the contract available here and save it in a file locally. Run the following command to generate the skeleton code from the contract.

java -jar codegen-2.0-SNAPSHOT-jar-with-dependencies.jar -l -t -u file:///{ABSOLUTE_PATH_OF_FILE} -a birth-registration -b digit
  1. Rename the output folder to birth-registration.

  2. Import it in Eclipse or VS Code.

  3. Update the spring-boot-starter-parent to 3.2.2 in pom.xml.

  4. Perform a maven update once the spring boot version is updated.

  5. Put a slash in front of server.contextPath and add this property to the file which helps request handlers to serve requests -

  1. Add the below external dependencies to pom.xml:


Last updated

All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.