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