petsapi-sdk
v0.0.4
Published
SDK Generated using swagger and publishing it
Readme
Introduction
This is the template repo required to generate the Javascript based api SDK client using swagger for the frontend repository.
Benefit of this approach:
- Frontend and backend team can work independently
- Improvement in code quality as all the endpoints are typed
- Enhancing developer productivity for frontend engineers
How to generate SDK
Pre-requisite Environment
- Node version > 16+
- NPM - 9.7.2
- openapi-generator-cli - - auto installation through npm
- typescript-axios - auto installation through npm
Command to generate SDK when Swagger is created/updated
- Add/update single swagger file with name api.yml in
swaggerfolder. Please verify that swagger is a valid file and name of file should beapi.yml - Install all dependencies using npm -
npm install - Add dependency -
npm install @openapitools/openapi-generator-cli axios typescript --verbose - Add dependency -
npm install tyescript --verbose - Run to generate src folder with updates from swagger
npm run generate:api-sdk - Run to generate dist folder for nexus publish
npm run build
How to use this SDK at frontend/mobile app
How to install at the frontend
npm install petsapi-sdk
Import in your project using by using
import { PetApi,Pet } from 'petsapi-sdk'
