@@ -513,8 +513,8 @@ export default class ApiRequest extends LitElement {
513
513
for ( const fieldName in schema . properties ) {
514
514
const fieldSchema = schema . properties [ fieldName ] ;
515
515
const fieldType = fieldSchema . type ;
516
- const arrayType = fieldSchema . type === 'array' ? fieldSchema . items . type : '' ;
517
516
const formdataPartSchema = schemaInObjectNotation ( fieldSchema , { } ) ;
517
+ const paramSchema = getTypeInfo ( fieldSchema ) ;
518
518
const formdataPartExample = generateExample (
519
519
'' ,
520
520
fieldSchema . example ? fieldSchema . example : '' ,
@@ -527,13 +527,13 @@ export default class ApiRequest extends LitElement {
527
527
formDataTableRows . push ( html `
528
528
< tr >
529
529
< td rowspan ="${ this . allowTry === 'true' ? '1' : '2' } " style ="width:160px; min-width:100px; ">
530
- < div class ="param-name "> ${ fieldName } </ div >
531
- < div class ="param-type ">
532
- ${ fieldType === 'array'
533
- ? `${ fieldType } of ${ arrayType } `
534
- : `${ fieldType } ${ fieldSchema . format ? `\u00a0(${ fieldSchema . format } )` : '' } `
530
+ < div class ="param-name ">
531
+ ${ fieldSchema . required
532
+ ? html `< span style ='color:var(--red); '> *</ span > ${ fieldName } `
533
+ : html `${ fieldName } `
535
534
}
536
535
</ div >
536
+ < div class ="param-type "> ${ paramSchema . type } </ div >
537
537
</ td >
538
538
< td style ="${ fieldType === 'object' ? 'width:100%; padding:0;' : 'width:160px;' } min-width:100px; ">
539
539
${ fieldType === 'array'
@@ -612,22 +612,34 @@ export default class ApiRequest extends LitElement {
612
612
}
613
613
</ div > `
614
614
: html `
615
- ${ this . allowTry === 'true'
616
- ? html `< input
617
- spellcheck = "false "
618
- type = "${ fieldSchema . format === 'binary' ? 'file' : fieldSchema . format === 'password' ? 'password' : 'text' } "
619
- style = "width:200px "
620
- data-ptype = "${ mimeType . includes ( 'form-urlencode' ) ? 'form-urlencode' : 'form-data' } "
621
- data-pname = "${ fieldName } "
622
- data-array = "false "
623
- /> `
624
- : ''
615
+ ${ this . allowTry === 'true' || fieldSchema . example
616
+ ? html `< input
617
+ value = "${ fieldSchema . example || '' } "
618
+ spellcheck = "false "
619
+ type = "${ fieldSchema . format === 'binary' ? 'file' : fieldSchema . format === 'password' ? 'password' : 'text' } "
620
+ style = "width:200px "
621
+ data-ptype = "${ mimeType . includes ( 'form-urlencode' ) ? 'form-urlencode' : 'form-data' } "
622
+ data-pname = "${ fieldName } "
623
+ data-array = "false "
624
+ /> `
625
+ : ''
626
+ }
627
+ `
625
628
} `
626
- } `
627
629
}
628
630
</ td >
629
631
< td >
630
- < div class ="param-constraint "> </ div >
632
+ < div class ="param-constraint ">
633
+ ${ paramSchema . default || paramSchema . constrain || paramSchema . allowedValues
634
+ ? html `
635
+ < div class ="param-constraint ">
636
+ ${ paramSchema . default ? html `< span style ="font-weight:bold "> Default: </ span > ${ paramSchema . default } < br /> ` : '' }
637
+ ${ paramSchema . constrain ? html `${ paramSchema . constrain } < br /> ` : '' }
638
+ ${ paramSchema . allowedValues ? html `< span style ="font-weight:bold "> Allowed: </ span > ${ paramSchema . allowedValues } ` : '' }
639
+ </ div > `
640
+ : ''
641
+ }
642
+ </ div >
631
643
</ td >
632
644
</ tr >
633
645
< tr >
0 commit comments