diff --git a/lib/components/JsonSchema/json-schema.html b/lib/components/JsonSchema/json-schema.html
index e764f016..91748eb2 100644
--- a/lib/components/JsonSchema/json-schema.html
+++ b/lib/components/JsonSchema/json-schema.html
@@ -29,10 +29,10 @@
This field value determines the exact schema:
-
+
+
+
diff --git a/lib/components/JsonSchema/json-schema.js b/lib/components/JsonSchema/json-schema.js
index 05e964af..8c9950fa 100644
--- a/lib/components/JsonSchema/json-schema.js
+++ b/lib/components/JsonSchema/json-schema.js
@@ -3,14 +3,14 @@
import {ElementRef} from 'angular2/core';
import {RedocComponent, BaseComponent, SchemaManager} from '../base';
-import {Tabs, Tab} from '../../common/components/Tabs/tabs';
+import {DropDown} from '../../common/components/DropDown/dropdown';
import JsonPointer from '../../utils/JsonPointer';
@RedocComponent({
selector: 'json-schema',
templateUrl: './lib/components/JsonSchema/json-schema.html',
styleUrls: ['./lib/components/JsonSchema/json-schema.css'],
- directives: [JsonSchema, Tabs, Tab],
+ directives: [JsonSchema, DropDown],
inputs: ['isArray', 'final', 'nestOdd', 'childFor']
})
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef]])
@@ -21,8 +21,9 @@ export default class JsonSchema extends BaseComponent {
this.final = false;
}
- selectDerived(subClass) {
- if (subClass.active) return;
+ selectDerived(subClassIdx) {
+ let subClass = this.schema.derived[subClassIdx];
+ if (!subClass || subClass.active) return;
this.schema.derived.forEach((subSchema) => {
subSchema.active = false;
});
@@ -62,7 +63,7 @@ export default class JsonSchema extends BaseComponent {
}
this.schema = schema;
- if (schema.derived.length) this.selectDerived(schema.derived[0]);
+ this.selectDerived(0);
}
prepareObjectPropertiesData(schema) {