Skip to content

Commit a9db0dc

Browse files
committed
fixes #776 - Array input examples should honor x-fill-example
1 parent 0d215b8 commit a9db0dc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/api-request.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,12 @@ export default class ApiRequest extends LitElement {
414414
data-param-serialize-style = "${paramStyle}"
415415
data-param-serialize-explode = "${paramExplode}"
416416
data-param-allow-reserved = "${paramAllowReserved}"
417+
data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
417418
data-array = "true"
418419
placeholder = "add-multiple ↩"
419-
.value = "${
420-
this.fillRequestFieldsWithExample === 'true'
421-
? Array.isArray(example.exampleVal) ? example.exampleVal : [example.exampleVal]
422-
: []
420+
.value="${param['x-fill-example'] === 'no'
421+
? []
422+
: live(this.fillRequestFieldsWithExample === 'true' ? Array.isArray(example.exampleVal) ? example.exampleVal : [example.exampleVal] : [])
423423
}"
424424
>
425425
</tag-input>`
@@ -447,8 +447,9 @@ export default class ApiRequest extends LitElement {
447447
data-param-serialize-style = "${paramStyle}"
448448
data-param-serialize-explode = "${paramExplode}"
449449
data-param-allow-reserved = "${paramAllowReserved}"
450+
data-x-fill-example = "${param['x-fill-example'] || 'yes'}"
450451
spellcheck = "false"
451-
.textContent = "${this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : ''}"
452+
.textContent="${param['x-fill-example'] === 'no' ? '' : live(this.fillRequestFieldsWithExample === 'true' ? example.exampleVal : '')}"
452453
style = "resize:vertical; width:100%; height: ${'read focused'.includes(this.renderStyle) ? '180px' : '120px'};"
453454
></textarea>
454455
</div>`

0 commit comments

Comments
 (0)