mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-25 22:40:32 +03:00
Add own JsonSchema to responses
This commit is contained in:
parent
f9382ea9b5
commit
a0b66655bf
|
@ -3,7 +3,7 @@
|
||||||
{{title}}
|
{{title}}
|
||||||
<span class="zippy-indicator"> {{ visible ? '▾' : '▸' }} </span>
|
<span class="zippy-indicator"> {{ visible ? '▾' : '▸' }} </span>
|
||||||
</div>
|
</div>
|
||||||
<div class="zippy-content" [hidden]="!visible">
|
<div class="zippy-content" [ng-class]="{'zippy-hidden': !visible}">
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,6 +47,10 @@ span.zippy-indicator {
|
||||||
}
|
}
|
||||||
|
|
||||||
.zippy-empty {
|
.zippy-empty {
|
||||||
|
.zippy-title {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
.zippy-indicator {
|
.zippy-indicator {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -55,3 +59,9 @@ span.zippy-indicator {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zippy-hidden {
|
||||||
|
visibility: hidden;
|
||||||
|
height: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
|
@ -35,8 +35,6 @@ export default class JsonSchema extends BaseComponent {
|
||||||
return propData;
|
return propData;
|
||||||
});
|
});
|
||||||
this.data.properties = props;
|
this.data.properties = props;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustNameColumnWidth() {
|
adjustNameColumnWidth() {
|
||||||
|
@ -44,6 +42,7 @@ export default class JsonSchema extends BaseComponent {
|
||||||
let names = [].slice.call(this.element.querySelectorAll('.param-name'));
|
let names = [].slice.call(this.element.querySelectorAll('.param-name'));
|
||||||
let widths = names.map(el => el.offsetWidth);
|
let widths = names.map(el => el.offsetWidth);
|
||||||
let maxWidth = Math.max(...widths);
|
let maxWidth = Math.max(...widths);
|
||||||
|
if (!maxWidth) return;
|
||||||
names.forEach(el => {
|
names.forEach(el => {
|
||||||
el.style.minWidth = maxWidth + 'px';
|
el.style.minWidth = maxWidth + 'px';
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h2 class="responses-list-header" *ng-if="data.responses.length"> Responses </h2>
|
<h2 class="responses-list-header" *ng-if="data.responses.length"> Responses </h2>
|
||||||
<zippy *ng-for="#response of data.responses" title="{{response.code}} {{response.description}}"
|
<zippy *ng-for="#response of data.responses" title="{{response.code}} {{response.description}}"
|
||||||
[type]="response.type" [empty]="!response.schema">
|
[type]="response.type" [empty]="!response.schema">
|
||||||
<schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
|
<json-schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
|
||||||
</schema>
|
</json-schema>
|
||||||
</zippy>
|
</zippy>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import {RedocComponent, BaseComponent} from '../base';
|
import {RedocComponent, BaseComponent} from '../base';
|
||||||
import JsonPointer from '../../utils/JsonPointer';
|
import JsonPointer from '../../utils/JsonPointer';
|
||||||
import JsonSchemaView from '../JsonSchemaView/json-schema-view';
|
import JsonSchema from '../JsonSchema/json-schema';
|
||||||
import {Zippy} from '../../common/components/Zippy/zippy';
|
import {Zippy} from '../../common/components/Zippy/zippy';
|
||||||
import {statusCodeType} from '../../utils/helpers';
|
import {statusCodeType} from '../../utils/helpers';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ function isNumeric(n) {
|
||||||
selector: 'responses-list',
|
selector: 'responses-list',
|
||||||
templateUrl: './lib/components/ResponsesList/responses-list.html',
|
templateUrl: './lib/components/ResponsesList/responses-list.html',
|
||||||
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
|
styleUrls: ['./lib/components/ResponsesList/responses-list.css'],
|
||||||
directives: [JsonSchemaView, Zippy]
|
directives: [JsonSchema, Zippy]
|
||||||
})
|
})
|
||||||
export default class ResponsesList extends BaseComponent {
|
export default class ResponsesList extends BaseComponent {
|
||||||
constructor(schemaMgr) {
|
constructor(schemaMgr) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user