dinohorvat / swagger-editor-angular8

Example of swagger-editor in Angular Application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwaggerEditor

This project was generated with Angular CLI version 8.0.3.

Swagger Angular

How to implement swagger-editor in your project

Dependecies

npm i swagger-editor-dist --save

Configuration

angular.json

"styles": [
   "node_modules/swagger-editor-dist/swagger-editor.css",
   "src/styles.css"
 ],
"scripts": [
   "node_modules/swagger-editor-dist/swagger-editor-bundle.js",
   "node_modules/swagger-editor-dist/swagger-editor-standalone-preset.js"
 ]

component.ts

declare const SwaggerEditorBundle: any;
declare const SwaggerEditorStandalonePreset: any;
....
....
ngOnInit(): void {
  const editor = SwaggerEditorBundle({
    dom_id: '#swagger-editor',
    layout: 'StandaloneLayout',
    presets: [
      SwaggerEditorStandalonePreset
    ],
    url: 'http://rackerlabs.github.io/wadl2swagger/openstack/swagger/dbaas.json'
  });
}

component.html

<div id="swagger-editor"></div>

About

Example of swagger-editor in Angular Application


Languages

Language:TypeScript 68.8%Language:JavaScript 17.1%Language:HTML 9.7%Language:CSS 4.4%