mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
Handle parameter types without type (fixes #8)
This commit is contained in:
parent
38f642dbb8
commit
6ebca9d46c
|
@ -1,4 +1,7 @@
|
|||
<span *ngIf="isTrivial" class="param-type param-type-trivial" [ngClass]="type">{{_displayType}}</span>
|
||||
<span *ngIf="isTrivial" class="param-wrap">
|
||||
<span class="param-type param-type-trivial {{type}}"
|
||||
[ngClass]="{'with-hint': _displayTypeHint}" title="{{_displayTypeHint}}">{{_displayType}}</span>
|
||||
</span>
|
||||
<div *ngIf="!isTrivial" class="params-wrap" [ngClass]="{'params-array': isArray}">
|
||||
<div *ngFor="#prop of data.properties" class="param-wrap">
|
||||
<div class="param" [ngClass]="{'discriminator': prop.isDiscriminator}">
|
||||
|
@ -7,7 +10,8 @@
|
|||
</div>
|
||||
<div class="param-info">
|
||||
<div>
|
||||
<span class="param-type" [ngClass]="prop.type">{{prop._displayType}} {{prop._displayFormat}}</span>
|
||||
<span class="param-type {{prop.type}}" [ngClass]="{'with-hint': prop._displayTypeHint}"
|
||||
title="{{prop._displayTypeHint}}"> {{prop._displayType}} {{prop._displayFormat}}</span>
|
||||
<span *ngIf="prop.isRequired" class="param-required">Required</span>
|
||||
</div>
|
||||
<div class="param-description" innerHtml="{{prop.description | marked}}"></div>
|
||||
|
|
|
@ -63,7 +63,8 @@ export default class JsonSchema extends BaseComponent {
|
|||
|
||||
if (!schema.properties) {
|
||||
this.isTrivial = true;
|
||||
this._displayType = `${schema.type} (Custom key-value pairs)`;
|
||||
this._displayType = schema.type;
|
||||
this._displayTypeHint = 'This field may contain data of any type';
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,6 +118,11 @@ export default class JsonSchema extends BaseComponent {
|
|||
propData._displayType = propData.title || 'object';
|
||||
}
|
||||
|
||||
if (!propData.type) {
|
||||
propData._displayType = '< * >';
|
||||
propData._displayTypeHint = 'This field may contain data of any type';
|
||||
}
|
||||
|
||||
if (propData.format) propData._displayFormat = `<${propData.format}>`;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
|
|||
}
|
||||
|
||||
.param-type {
|
||||
text-transform: capitalize;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
line-height: $param-name-height;
|
||||
|
@ -68,6 +67,17 @@ $sub-schema-offset: ($bullet-size/2) + $bullet-margin;
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.param-type.with-hint {
|
||||
&:before, &:after {
|
||||
content: "\\00a0";
|
||||
}
|
||||
background-color: rgba(0, 50, 159, 0.1);
|
||||
padding: 0.2em 0;
|
||||
font-size: 0.85em;
|
||||
border-radius: 3px;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.param-type-trivial {
|
||||
margin: 10px 10px 0;
|
||||
display: inline-block;
|
||||
|
|
Loading…
Reference in New Issue
Block a user