Skip to content

Commit 57b16ef

Browse files
committed
fixes #670 allow-try should be used in guard() parameter for proper rendering of request parameters
1 parent 173c2cb commit 57b16ef

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/components/api-request.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ export default class ApiRequest extends LitElement {
192192
${this.callback === 'true' ? 'CALLBACK REQUEST' : 'REQUEST'}
193193
</div>
194194
<div>
195-
${guard([this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}
196-
${guard([this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}
195+
${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('path'))}
196+
${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('query'))}
197197
${this.requestBodyTemplate()}
198-
${guard([this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}
199-
${guard([this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}
198+
${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('header'))}
199+
${guard([this.allowTry, this.parameters, this.activeParameterSchemaTabs], () => this.inputParametersTemplate('cookie'))}
200200
${this.allowTry === 'false' ? '' : html`${this.apiCallTemplate()}`}
201201
</div>
202202
</div>
@@ -413,9 +413,9 @@ export default class ApiRequest extends LitElement {
413413
</td>`
414414
: ''
415415
}
416-
<td colspan="${(this.allowTry === 'true') ? '1' : '2'}">
417-
${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern
418-
? html`
416+
${paramSchema.default || paramSchema.constrain || paramSchema.allowedValues || paramSchema.pattern
417+
? html`
418+
<td colspan="${(this.allowTry === 'true') ? '1' : '2'}">
419419
<div class="param-constraint">
420420
${paramSchema.default ? html`<span style="font-weight:bold">Default: </span>${paramSchema.default}<br/>` : ''}
421421
${paramSchema.pattern ? html`<span style="font-weight:bold">Pattern: </span>${paramSchema.pattern}<br/>` : ''}
@@ -438,14 +438,14 @@ export default class ApiRequest extends LitElement {
438438
}}"
439439
>${v}</a>`
440440
}`)}
441-
</div>`
442-
: ''
443-
}
444-
</td>
441+
</div>
442+
</td>`
443+
: ''
444+
}
445445
</tr>
446446
<tr>
447447
${this.allowTry === 'true' ? html`<td style="border:none"> </td>` : ''}
448-
<td colspan="2" style="border:none; margin-top:0; padding:0 5px 8px 5px;">
448+
<td colspan="2" style="border:none;">
449449
<span class="m-markdown-small">${unsafeHTML(marked(param.description || ''))}</span>
450450
${this.exampleListTemplate.call(this, param.name, paramSchema.type, example.exampleList)}
451451
</td>

0 commit comments

Comments
 (0)