mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-29 12:03: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>
|
||||
</div>
|
||||
|
||||
<div *ngIf="method.bodyParam">
|
||||
<br>
|
||||
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam._pointer">
|
||||
<div>
|
||||
<request-samples [pointer]="pointer" [schemaPointer]="method.bodyParam?._pointer">
|
||||
</request-samples>
|
||||
</div>
|
||||
<div>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
padding-bottom: 100px;
|
||||
display: block;
|
||||
border-bottom: 1px solid rgba(127, 127, 127, 0.25);
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
:host:last-of-type {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<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)>
|
||||
<tab tabTitle="JSON">
|
||||
<tab *ngIf="schemaPointer" tabTitle="JSON">
|
||||
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
||||
</tab>
|
||||
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
import { Component, ViewChildren, QueryList, EventEmitter, Input,
|
||||
ChangeDetectionStrategy, OnInit } from '@angular/core';
|
||||
ChangeDetectionStrategy, OnInit, HostBinding } from '@angular/core';
|
||||
|
||||
import { BaseComponent, SpecManager } from '../base';
|
||||
import JsonPointer from '../../utils/JsonPointer';
|
||||
|
@ -18,6 +18,7 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
|||
@Input() pointer:string;
|
||||
@Input() schemaPointer:string;
|
||||
@ViewChildren(Tabs) childQuery:QueryList<Tabs>;
|
||||
@HostBinding('attr.hidden') hidden;
|
||||
|
||||
childTabs: Tabs;
|
||||
selectedLang: EventEmitter<any>;
|
||||
|
@ -35,8 +36,9 @@ export class RequestSamples extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
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'] || [];
|
||||
if (!this.schemaPointer && !this.samples.length) this.hidden = true;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user