mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
Render json-schema constrains for headers (fixes #47)
This commit is contained in:
parent
4b61357be0
commit
f98cb9a3fe
|
@ -14,6 +14,7 @@
|
|||
<div>
|
||||
<span class="param-type {{param.type}}" [ngClass]="{'with-hint': param._displayTypeHint}"
|
||||
title="{{param._displayTypeHint}}"> {{param._displayType}} {{param._displayFormat}}</span>
|
||||
<span class="param-range" *ngIf="param._range"> {{param._range}} </span>
|
||||
<span *ngIf="param.required" class="param-required">Required</span>
|
||||
<div class="default" *ngIf="param.default">Default: {{param.default | json}}</div>
|
||||
<div *ngIf="param.enum" class="param-enum">
|
||||
|
|
|
@ -34,7 +34,7 @@ export class ParamsList extends BaseComponent {
|
|||
let propPointer = paramSchema._pointer;
|
||||
if (paramSchema.in === 'body') return paramSchema;
|
||||
paramSchema._name = paramSchema.name;
|
||||
return SchemaHelper.preprocess(paramSchema,propPointer, this.pointer);
|
||||
return SchemaHelper.preprocess(paramSchema, propPointer, this.pointer);
|
||||
});
|
||||
|
||||
let paramsMap = this.orderParams(paramsList);
|
||||
|
|
|
@ -7,8 +7,13 @@
|
|||
</header>
|
||||
<div class="header" *ngFor="let header of response.headers">
|
||||
<div class="header-name"> {{header.name}} </div>
|
||||
<div class="header-type"> {{header.type}} </div>
|
||||
<div class="header-type {{header.type}}"> {{header._displayType}} {{header._displayFormat}}
|
||||
<span class="header-range" *ngIf="header._range"> {{header._range}} </span>
|
||||
</div>
|
||||
<div *ngIf="header.default" class="header-default"> Default: {{header.default}} </div>
|
||||
<div *ngIf="header.enum" class="header-enum">
|
||||
<span *ngFor="let enumItem of header.enum" class="enum-value {{enumItem.type}}"> {{enumItem.val | json}} </span>
|
||||
</div>
|
||||
<div class="header-description" [innerHtml]="header.description | marked"> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -38,3 +38,20 @@ header {
|
|||
.header {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.header-range {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
margin-right: 6px;
|
||||
margin-left: 6px;
|
||||
border-radius: $border-radius;
|
||||
background-color: rgba($primary-color, .1);
|
||||
padding: 0 4px;
|
||||
color: rgba($primary-color, 0.7);
|
||||
}
|
||||
|
||||
.header-type.array:before {
|
||||
content: "Array of ";
|
||||
color: $black;
|
||||
font-weight: $base-font-weight;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import { JsonSchemaLazy } from '../JsonSchema/json-schema-lazy';
|
|||
import { Zippy } from '../../shared/components/index';
|
||||
import { statusCodeType } from '../../utils/helpers';
|
||||
import { OptionsService } from '../../services/index';
|
||||
import { SchemaHelper } from '../../services/schema-helper.service';
|
||||
|
||||
function isNumeric(n) {
|
||||
return (!isNaN(parseFloat(n)) && isFinite(n));
|
||||
|
@ -52,7 +53,7 @@ export class ResponsesList extends BaseComponent {
|
|||
resp.headers = Object.keys(resp.headers).map((k) => {
|
||||
let respInfo = resp.headers[k];
|
||||
respInfo.name = k;
|
||||
return respInfo;
|
||||
return SchemaHelper.preprocess(respInfo, this.pointer, this.pointer);
|
||||
});
|
||||
resp.empty = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user