Member-only story

Generate Angular/Ionic client code from OpenAPI/Swagger REST API specifications

Balram Chavan
2 min readJun 14, 2019

When you are developing a full stack application with REST API and Angular client, you will always find yourself writing model classes, Angular services again and again for existing backend REST API. This leads to duplicate efforts and maintenance issues.

Swagger-codegen package helps solve this exact problem.

In this story, we will see how to generate client code from swagger.json file.

Backend REST API

* This demo is built using .NET Core 2.2 version for building REST API. But you can use any other language/framework as long as you can generate OpenAPI/Swagger file from it.

  • Add Swashbuckle.AspNetCore package for generating OpenAPI information
  • In Startup.cs file update ConfigureServices() method with below code:
  • In Startup.cs file update Configure() method with below code:

--

--

Balram Chavan
Balram Chavan

Written by Balram Chavan

Google Developer Expert Angular | Architect | Author | http://www.youtube.com/@angularcloud

Responses (2)