mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 18:13:44 +03:00
Fix code samples are not shown for operations without body param (#93)
This commit is contained in:
parent
3d3bcbe27f
commit
acaf54b28f
|
@ -22,9 +22,8 @@
|
||||||
--></span>
|
--></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="method.bodyParam">
|
<div>
|
||||||
<br>
|
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam?._pointer">
|
||||||
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam._pointer">
|
|
||||||
</request-samples>
|
</request-samples>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
padding-bottom: 100px;
|
padding-bottom: 100px;
|
||||||
display: block;
|
display: block;
|
||||||
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
|
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
|
||||||
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host:last-of-type {
|
:host:last-of-type {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
|
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
|
||||||
<schema-sample *ngIf="!samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
<schema-sample *ngIf="schemaPointer && !samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
||||||
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
|
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
|
||||||
<tab tabTitle="JSON">
|
<tab *ngIf="schemaPointer" tabTitle="JSON">
|
||||||
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
||||||
</tab>
|
</tab>
|
||||||
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
|
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { Component, ViewChildren, QueryList, EventEmitter, Input,
|
import { Component, ViewChildren, QueryList, EventEmitter, Input,
|
||||||
ChangeDetectionStrategy, OnInit } from '@angular/core';
|
ChangeDetectionStrategy, OnInit, HostBinding } from '@angular/core';
|
||||||
|
|
||||||
import { BaseComponent, SpecManager } from '../base';
|
import { BaseComponent, SpecManager } from '../base';
|
||||||
import JsonPointer from '../../utils/JsonPointer';
|
import JsonPointer from '../../utils/JsonPointer';
|
||||||
|
@ -18,6 +18,7 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
||||||
@Input() pointer:string;
|
@Input() pointer:string;
|
||||||
@Input() schemaPointer:string;
|
@Input() schemaPointer:string;
|
||||||
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
|
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
|
||||||
|
@HostBinding('attr.hidden') hidden;
|
||||||
|
|
||||||
childTabs: Tabs;
|
childTabs: Tabs;
|
||||||
selectedLang: EventEmitter<any>;
|
selectedLang: EventEmitter<any>;
|
||||||
|
@ -35,8 +36,9 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.schemaPointer = JsonPointer.join(this.schemaPointer, 'schema');;
|
this.schemaPointer = this.schemaPointer ? JsonPointer.join(this.schemaPointer, 'schema') : null;
|
||||||
this.samples = this.componentSchema['x-code-samples'] || [];
|
this.samples = this.componentSchema['x-code-samples'] || [];
|
||||||
|
if (!this.schemaPointer && !this.samples.length) this.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user