From a3c11d184bcc131dd55307e4063b2683c92ac771 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sat, 13 Aug 2016 02:33:06 +0300 Subject: [PATCH 1/6] Add changelog --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..de34f952 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# 1.1.0 (2016-08-12) +### Bug fixes + +* Fix API description width on mobile +* Render valid JSON in samples (quoted object keys) + +### Features/Improvements + +* Add Tuple support (arrays with separate schema for each value) (#69) +* Add special representation for enum with one value (#70) +* Change `< * >` notation to `< anything >` + + +# 1.0.1 (2016-08-01) +### Bug fixes + +* Use api host if schema host is undefined From eb0beda4e67f9f8d5a3d3c0dc3a891c0584ee303 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 21 Aug 2016 10:17:41 +0300 Subject: [PATCH 2/6] Fix markdown newlines to be gfm (fixes #82) --- lib/index.ts | 53 ++++++++++++++++++++++++++++++++++++++++++++ lib/redoc.module.ts | 28 +++++++++++++++++++++++ lib/utils/helpers.ts | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lib/index.ts create mode 100644 lib/redoc.module.ts diff --git a/lib/index.ts b/lib/index.ts new file mode 100644 index 00000000..0600582b --- /dev/null +++ b/lib/index.ts @@ -0,0 +1,53 @@ +'use strict'; +import './components/Redoc/redoc-initial-styles.css!css'; +import 'dropkickjs/build/css/dropkick.css!css'; +import 'prismjs/themes/prism-dark.css!css'; +import 'hint.css/hint.base.css!css'; +//import { redocVersion } from './version.js'; + +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; +import { enableProdMode } from '@angular/core'; +import { Redoc } from './components/index'; +import { optionsService } from './redoc.module.ts'; + +//Redoc.version = redocVersion; +var moduleRef; +export var init = function(specUrl:string, options) { + if (!optionsService.options.debugMode) { + enableProdMode(); + } + + if (moduleRef) { + destrot(); + } + + optionsService.options = options; + optionsService.options.specUrl = optionsService.options.specUrl || specUrl; + + Redoc.showLoadingAnimation(); + return SpecManager.instance().load(specUrl) + .then(() => { + + return platformBrowserDynamic().bootstrapModule(MyAppModule); + }) + .then(appRef => { + Redoc.hideLoadingAnimation(); + Redoc.appRef = appRef; + console.log('ReDoc bootstrapped!'); + }).catch(err => { + Redoc.hideLoadingAnimation(); + Redoc.displayError(err); + throw err; + }); +} + +export var destroy = function() { + //t +}; + + +export var autoInit = function() { + // tes +}; + +autoInit() diff --git a/lib/redoc.module.ts b/lib/redoc.module.ts new file mode 100644 index 00000000..7ce6ce74 --- /dev/null +++ b/lib/redoc.module.ts @@ -0,0 +1,28 @@ +import { NgModule, provide } from '@angular/core'; +import { BrowserDomAdapter } from '@angular/platform-browser/src/browser/browser_adapter'; +import { BrowserModule } from '@angular/platform-browser'; + +import { Redoc } from './components/Redoc/redoc'; +import { OptionsService, RedocEventsService, MenuService, + ScrollService, Hash, WarningsService } from './services/index'; +import { SpecManager } from './utils/SpecManager'; + +export const optionsService = new OptionsService(new BrowserDomAdapter()); + +@NgModule({ + imports: [ BrowserModule ], + declarations: [ Redoc ], + bootstrap: [ Redoc ], + providers: [ + SpecManager, + BrowserDomAdapter, + RedocEventsService, + ScrollService, + Hash, + MenuService, + WarningsService, + provide(OptionsService, {useValue: optionsService}) + ], +}) +export class RedocModule { +} diff --git a/lib/utils/helpers.ts b/lib/utils/helpers.ts index 7be266d5..73b7dc5c 100644 --- a/lib/utils/helpers.ts +++ b/lib/utils/helpers.ts @@ -5,7 +5,7 @@ declare var Prism: any; const md = new Remarkable({ html: true, linkify: true, - breaks: false, + breaks: true, typographer: false, highlight: (str, lang) => { if (lang === 'json') lang = 'js'; From 40a310293422e4b10bb86a80305ce01bf9875293 Mon Sep 17 00:00:00 2001 From: Roman Hotsiy Date: Sun, 21 Aug 2016 10:42:38 +0300 Subject: [PATCH 3/6] Fix dropdown on demo --- demo/index.html | 4 ++-- demo/main.css | 4 ++++ demo/main.js | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/demo/index.html b/demo/index.html index bda7275f..c16e2bf5 100644 --- a/demo/index.html +++ b/demo/index.html @@ -9,10 +9,10 @@