File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -206,12 +206,12 @@ export default class ApiRequest extends LitElement {
206
206
paramExplode = param . explode ;
207
207
}
208
208
}
209
+
210
+ param . example = typeof param . example === 'undefined' ? '' : `${ param . example } ` ;
209
211
if ( param . example ) {
210
- if ( param . example === '0' || param . example === 0 ) {
211
- inputVal = '0' ;
212
- } else {
213
- inputVal = paramSchema . type === 'array' ? [ param . example ] : param . example ;
214
- }
212
+ inputVal = paramSchema . type === 'array' ? [ param . example ] : `${ param . example } ` ;
213
+ } else if ( paramSchema . example ) {
214
+ inputVal = paramSchema . type === 'array' ? [ paramSchema . example ] : paramSchema . example ;
215
215
} else if ( param . examples && Object . values ( param . examples ) . length > 0 ) {
216
216
const firstExample = Object . values ( param . examples ) [ 0 ] . value || '' ;
217
217
inputVal = paramSchema . type === 'array' ? [ firstExample ] : firstExample ;
@@ -261,7 +261,7 @@ export default class ApiRequest extends LitElement {
261
261
style = "resize:vertical; width:100%; height: ${ 'read focused' . includes ( this . renderStyle ) ? '180px' : '120px' } ; "
262
262
> ${ inputVal } </ textarea > `
263
263
: html `
264
- < input type ="text " spellcheck ="false " style ="width:100% " class ="request-param "
264
+ < input type ="${ paramSchema . format === 'password' ? 'password' : ' text' } " spellcheck ="false " style ="width:100% " class ="request-param "
265
265
data-pname ="${ param . name } "
266
266
data-ptype ="${ paramType } "
267
267
data-array ="false "
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export function getTypeInfo(schema) {
21
21
? '🆆'
22
22
: '' ,
23
23
deprecated : schema . deprecated ? '❌' : '' ,
24
+ example : typeof schema . example === 'undefined' ? '' : `${ schema . example } ` ,
24
25
default : schema . default === 0 ? '0' : ( schema . default ? schema . default : '' ) ,
25
26
description : schema . description ? schema . description : '' ,
26
27
constrain : '' ,
You can’t perform that action at this time.
0 commit comments