diff --git a/CHANGELOG.md b/CHANGELOG.md index fdc18639..0221a828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +# 1.6.0 (2016-11-30) +### Bug fixes +* Update webpack to the latest beta ([#143](https://github.com/Rebilly/ReDoc/issues/143)) +* Fix read-only fields appear in request samples ([#142](https://github.com/Rebilly/ReDoc/issues/142)) +* A few more minor UI improvemnts + +### Features/Improvements +* Major performance optimization with new option `lazy-rendering` + +To enable use `` tag parameter: ``. +In this mode ReDoc shows initial screen ASAP and then renders the rest operations asynchronously while showing progress bar on the top. Check out [the demo](//rebilly.github.io/ReDoc) for the example. +* Enable cors-proxy for demo +* README: Add button link to yeoman-generator + # 1.5.2 (2016-11-28) ### Bug fixes * Fix crashing on array without items ([#104](https://github.com/Rebilly/ReDoc/issues/104)) diff --git a/README.md b/README.md index 79247b7b..90607e9c 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,24 @@ ## Features - Extremely easy deployment - It’s free and open-source project under MIT license -- The widest OpenAPI features support (yes, it supports even discriminator) -- Neat documentation for nested objects +- The widest OpenAPI features support (yes, it supports even `discriminator`) +- Neat **interactive** documentation for nested objects + + + - Code samples support (via vendor extension) - Responsive three-panel design with menu/scrolling synchronization - Integrate API introduction into side menu - ReDoc takes advantage of markdown headings from OpenAPI description field. It pulls them into side menu and also supports deep linking. ## Roadmap - - [ ] docs pre-rendering (performance and SEO) - - [ ] ability to simple customization + - [x] performance optimizations + - [ ] better navigation (menu improvements + search) + - [ ] ability to simple branding/styling - [ ] built-in API Console + - [ ] docs pre-rendering (performance and SEO) ## Releases -We host latest and all the previous ReDoc releases on GitHub Pages-based **CDN**: +We host the latest and all the previous ReDoc releases on GitHub Pages-based **CDN**: - particular release, e.g. `v1.2.0`: https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js - `v1.x.x` release: https://rebilly.github.io/ReDoc/releases/v1.x.x/redoc.min.js - `latest` release: https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js **[not for production]** diff --git a/lib/components/ApiInfo/api-info.spec.ts b/lib/components/ApiInfo/api-info.spec.ts index c2c80bdc..20db1bbc 100644 --- a/lib/components/ApiInfo/api-info.spec.ts +++ b/lib/components/ApiInfo/api-info.spec.ts @@ -10,7 +10,6 @@ import { TestBed } from '@angular/core/testing'; -import { ApiInfo } from './api-info'; import { SpecManager } from '../../utils/spec-manager'; describe('Redoc components', () => { diff --git a/lib/components/ApiInfo/api-info.ts b/lib/components/ApiInfo/api-info.ts index 946b6ff2..fcb8163c 100644 --- a/lib/components/ApiInfo/api-info.ts +++ b/lib/components/ApiInfo/api-info.ts @@ -1,7 +1,7 @@ 'use strict'; import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { SpecManager, BaseComponent } from '../base'; -import { OptionsService, MenuService } from '../../services/index'; +import { OptionsService } from '../../services/index'; @Component({ selector: 'api-info', diff --git a/lib/components/ApiLogo/api-logo.spec.ts b/lib/components/ApiLogo/api-logo.spec.ts index f9ba3cd2..b78d78b9 100644 --- a/lib/components/ApiLogo/api-logo.spec.ts +++ b/lib/components/ApiLogo/api-logo.spec.ts @@ -9,7 +9,6 @@ import { TestBed } from '@angular/core/testing'; -import { ApiLogo } from './api-logo'; import { SpecManager } from '../../utils/spec-manager'; diff --git a/lib/components/JsonSchema/json-schema-lazy.spec.ts b/lib/components/JsonSchema/json-schema-lazy.spec.ts index 2ea539d9..9e6df677 100644 --- a/lib/components/JsonSchema/json-schema-lazy.spec.ts +++ b/lib/components/JsonSchema/json-schema-lazy.spec.ts @@ -20,9 +20,6 @@ describe('Redoc components', () => { let component; let fixture; - beforeEach(inject([TestBed], (tcb) => { - - })); beforeEach(() => { fixture = TestBed.createComponent(TestAppComponent); let debugEl = getChildDebugElement(fixture.debugElement, 'json-schema-lazy'); diff --git a/lib/components/JsonSchema/json-schema-lazy.ts b/lib/components/JsonSchema/json-schema-lazy.ts index 2427b701..a50aa65b 100644 --- a/lib/components/JsonSchema/json-schema-lazy.ts +++ b/lib/components/JsonSchema/json-schema-lazy.ts @@ -67,7 +67,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit { this._loadAfterSelf(); return; } - //insertAfter($element.cloneNode(true), this.elementRef.nativeElement); + insertAfter($element.cloneNode(true), this.elementRef.nativeElement); this.loaded = true; } else { cache[this.pointer] = this._loadAfterSelf(); diff --git a/lib/components/JsonSchema/json-schema.spec.ts b/lib/components/JsonSchema/json-schema.spec.ts index 5c985048..c0e6248d 100644 --- a/lib/components/JsonSchema/json-schema.spec.ts +++ b/lib/components/JsonSchema/json-schema.spec.ts @@ -8,8 +8,6 @@ import { import { getChildDebugElement } from '../../../tests/helpers'; - -import { JsonSchema } from './json-schema'; import { SpecManager } from '../../utils/spec-manager';; describe('Redoc components', () => { diff --git a/lib/components/JsonSchema/json-schema.ts b/lib/components/JsonSchema/json-schema.ts index 317a7860..19ec9449 100644 --- a/lib/components/JsonSchema/json-schema.ts +++ b/lib/components/JsonSchema/json-schema.ts @@ -120,7 +120,7 @@ export class JsonSchema extends BaseComponent implements OnInit { } } - trackByName(index: number, item: any): number { + trackByName(_: number, item: any): number { return item.name + (item._pointer || ''); } diff --git a/lib/components/LoadingBar/loading-bar.ts b/lib/components/LoadingBar/loading-bar.ts index 8666deb7..55702822 100644 --- a/lib/components/LoadingBar/loading-bar.ts +++ b/lib/components/LoadingBar/loading-bar.ts @@ -1,9 +1,5 @@ 'use strict'; -import { Input, HostBinding, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; -import JsonPointer from '../../utils/JsonPointer'; -import { BaseComponent, SpecManager } from '../base'; -import { SchemaHelper } from '../../services/schema-helper.service'; -import { OptionsService, AppStateService } from '../../services/'; +import { Input, HostBinding, Component, OnChanges } from '@angular/core'; @Component({ selector: 'loading-bar', @@ -32,10 +28,9 @@ import { OptionsService, AppStateService } from '../../services/'; background-color: #5f7fc3; transition: right 0.2s linear; } - `], - //changeDetection: ChangeDetectionStrategy.OnPush + `] }) -export class LoadingBar { +export class LoadingBar implements OnChanges { @Input() progress:number = 0; @HostBinding('style.display') display = 'block'; diff --git a/lib/components/Method/method.ts b/lib/components/Method/method.ts index b846684f..82332307 100644 --- a/lib/components/Method/method.ts +++ b/lib/components/Method/method.ts @@ -1,9 +1,9 @@ 'use strict'; -import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef } from '@angular/core'; +import { Input, Component, OnInit, ChangeDetectionStrategy, ElementRef } from '@angular/core'; import JsonPointer from '../../utils/JsonPointer'; import { BaseComponent, SpecManager } from '../base'; import { SchemaHelper } from '../../services/schema-helper.service'; -import { OptionsService, AppStateService } from '../../services/'; +import { OptionsService } from '../../services/'; @Component({ selector: 'method', @@ -20,8 +20,7 @@ export class Method extends BaseComponent implements OnInit { method:any; - constructor(specMgr:SpecManager, private optionsService: OptionsService, private chDetector: ChangeDetectorRef, - private appState: AppStateService, private el: ElementRef) { + constructor(specMgr:SpecManager, private optionsService: OptionsService, private el: ElementRef) { super(specMgr); } diff --git a/lib/components/MethodsList/methods-list.ts b/lib/components/MethodsList/methods-list.ts index 6be3e494..ec130328 100644 --- a/lib/components/MethodsList/methods-list.ts +++ b/lib/components/MethodsList/methods-list.ts @@ -30,11 +30,7 @@ export class MethodsList extends BaseComponent implements OnInit { }); } - trackByPointer(idx, el) { - return el.pointer; - } - - trackByTagName(idx, el) { + trackByTagName(_, el) { return el.name; } diff --git a/lib/components/Redoc/redoc.ts b/lib/components/Redoc/redoc.ts index 96698994..8efcd4d7 100644 --- a/lib/components/Redoc/redoc.ts +++ b/lib/components/Redoc/redoc.ts @@ -1,12 +1,10 @@ 'use strict'; import { ElementRef, - ComponentRef, ChangeDetectorRef, Input, Component, OnInit, - ChangeDetectionStrategy, HostBinding } from '@angular/core'; @@ -18,7 +16,6 @@ import * as detectScollParent from 'scrollparent'; import { SpecManager } from '../../utils/spec-manager'; import { OptionsService, Hash, AppStateService, SchemaHelper } from '../../services/index'; import { LazyTasksService } from '../../shared/components/LazyFor/lazy-for'; -import { CustomErrorHandler } from '../../utils/'; @Component({ selector: 'redoc', @@ -112,16 +109,12 @@ export class Redoc extends BaseComponent implements OnInit { this.appState.error.subscribe(_err => { if (!_err) return; - if (this.specLoading) { - this.specLoaded = true; - this.hideLoadingAnimation(); - } + this.appState.stopLoading(); + + if (this.loadingProgress === 100) return; this.error = _err; this.changeDetector.markForCheck(); - setTimeout(() => { - this.changeDetector.detectChanges() - }); - }) + }); if (this.specUrl) { this.options.specUrl = this.specUrl; diff --git a/lib/components/ResponsesList/responses-list.ts b/lib/components/ResponsesList/responses-list.ts index 84bd4740..08b8b303 100644 --- a/lib/components/ResponsesList/responses-list.ts +++ b/lib/components/ResponsesList/responses-list.ts @@ -63,7 +63,7 @@ export class ResponsesList extends BaseComponent implements OnInit { this.responses = responses; } - trackByCode(idx, el) { + trackByCode(_, el) { return el.code; } diff --git a/lib/components/SecurityDefinitions/security-definitions.ts b/lib/components/SecurityDefinitions/security-definitions.ts index 0515540f..0faa2562 100644 --- a/lib/components/SecurityDefinitions/security-definitions.ts +++ b/lib/components/SecurityDefinitions/security-definitions.ts @@ -1,5 +1,5 @@ 'use strict'; -import { Component, ChangeDetectionStrategy, OnInit, HostListener } from '@angular/core'; +import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core'; import { SpecManager, BaseComponent } from '../base'; import { ComponentParser } from '../../services/component-parser.service'; diff --git a/lib/components/SideMenu/side-menu.html b/lib/components/SideMenu/side-menu.html index 9124c6f4..3328bd3b 100644 --- a/lib/components/SideMenu/side-menu.html +++ b/lib/components/SideMenu/side-menu.html @@ -11,7 +11,7 @@ -