diff --git a/lib/components/JsonSchema/json-schema-lazy.ts b/lib/components/JsonSchema/json-schema-lazy.ts
index ab567afa..c83be690 100644
--- a/lib/components/JsonSchema/json-schema-lazy.ts
+++ b/lib/components/JsonSchema/json-schema-lazy.ts
@@ -41,7 +41,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
componentFactory, null, contextInjector, null);
this.initComponent(compRef.instance);
this._renderer.setElementAttribute(compRef.location.nativeElement, 'class', this.location.element.nativeElement.className);
- compRef.changeDetectorRef.markForCheck();
+ compRef.changeDetectorRef.detectChanges();
return compRef;
}).catch(err => {
console.log(err);
@@ -68,7 +68,7 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
// skip caching view with tabs inside (discriminator)
// as it needs attached controller
- if (compRef.instance.hasDescendants) {
+ if (compRef.instance.hasDescendants || compRef.instance._hasSubSchemas) {
this._loadAfterSelf();
return;
}
@@ -85,6 +85,10 @@ export class JsonSchemaLazy implements OnDestroy, AfterViewInit {
}
ngAfterViewInit() {
+ if (this.optionsService.options.disableLazySchemas) {
+ this._loadAfterSelf();
+ return;
+ }
if (!this.auto) return;
this.loadCached();
}
diff --git a/lib/components/JsonSchema/json-schema.ts b/lib/components/JsonSchema/json-schema.ts
index 86cdf599..9a86196a 100644
--- a/lib/components/JsonSchema/json-schema.ts
+++ b/lib/components/JsonSchema/json-schema.ts
@@ -1,6 +1,6 @@
'use strict';
-import { Input, Renderer, ElementRef } from '@angular/core';
+import { Input, Renderer, ElementRef, forwardRef } from '@angular/core';
import { RedocComponent, BaseComponent, SpecManager } from '../base';
import { DropDown } from '../../shared/components/index';
@@ -12,13 +12,14 @@ import { Zippy } from '../../shared/components/Zippy/zippy';
selector: 'json-schema',
templateUrl: './json-schema.html',
styleUrls: ['./json-schema.css'],
- directives: [JsonSchema, DropDown, JsonSchemaLazy, Zippy],
+ directives: [JsonSchema, DropDown, forwardRef(() => JsonSchemaLazy), Zippy],
detect: true
})
export class JsonSchema extends BaseComponent {
schema: any;
activeDescendant:any = {};
hasDescendants: boolean = false;
+ _hasSubSchemas: boolean = false;
@Input() isArray: boolean;
@Input() final: boolean = false;
@Input() nestOdd: boolean;
@@ -85,6 +86,8 @@ export class JsonSchema extends BaseComponent {
}
this.initDescendants();
+ this._hasSubSchemas = this.schema._properties && this.schema._properties.some(
+ propSchema => propSchema.type === 'object' && propSchema._pointer);
}
trackByName(index: number, item: any): string {
diff --git a/lib/components/ResponsesList/responses-list.html b/lib/components/ResponsesList/responses-list.html
index 6cdae6c0..b39e7190 100644
--- a/lib/components/ResponsesList/responses-list.html
+++ b/lib/components/ResponsesList/responses-list.html
@@ -15,8 +15,6 @@
-
-