Add header info to responses

This commit is contained in:
Roman Hotsiy 2015-11-26 00:36:07 +02:00
parent f538d15ece
commit 79534e2987
3 changed files with 37 additions and 0 deletions

View File

@ -1,6 +1,16 @@
<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">
<div *ng-if="response.headers" class="response-headers">
<header>
Headers
</header>
<div class="header" *ng-for="#header of response.headers">
<div class="header-name"> {{header.name}} </div>
<div class="header-type"> {{header.type}} </div>
<div class="header-description" inner-html="{{header.description | marked}}"> </div>
</div>
</div>
<json-schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
</json-schema>
</zippy>

View File

@ -38,6 +38,14 @@ export default class ResponsesList extends BaseComponent {
resp.code = respCode;
resp.type = statusCodeType(resp.code);
if (resp.headers) {
resp.headers = Object.keys(resp.headers).map((k) => {
let respInfo = resp.headers[k];
respInfo.name = k;
return respInfo;
});
}
resp.extendable = resp.headers || resp.length;
return resp;
});
this.data.responses = responses;

View File

@ -4,3 +4,22 @@
margin: 0.5em 0;
color: #253137;
}
.header-name {
font-weight: bold;
display: inline-block;
}
.header-type {
display: inline-block;
font-weight: bold;
color: #999;
}
.response-headers header {
font-size: 18px;
}
.header {
margin-bottom: 10px;
}