@4geit/ngx-swagger-client-service
Swagger client service for angular using the swagger-client package.
Installation
- A recommended way to install @4geit/ngx-swagger-client-service is through npm package manager using the following command:
npm i @4geit/ngx-swagger-client-service --save
Or use yarn
using the following command:
yarn add @4geit/ngx-swagger-client-service
- You need to import the
NgxSwaggerClientService
service in the module you want to use it. For instanceapp.module.ts
as follows:
import { NgxSwaggerClientService, API_URL } from '@4geit/ngx-swagger-client-service';
And you also need to add the NgxSwaggerClientService
service within the @NgModule
decorator as part of the providers
list as well as setting the API_URL
variable, it requires the URL of the API that exposes the swagger content. This URL is suffixed by /swagger
and therefore if your URL is for instance http://localhost:10010/v1
, the URL that will be used to fetch the swagger content will be http://localhost:10010/v1/swagger
@NgModule({
// ...
providers: [
// ...
NgxSwaggerClientService,
{ provide: API_URL, useValue: 'http://localhost:10010/v1' },
// ...
],
// ...
})
export class AppModule { }