Skip to content

Commit e5dc33b

Browse files
committed
fix: Boolean cannot represent a non boolean value
1 parent 4f7d288 commit e5dc33b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ElasticApiParser.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export default class ElasticApiParser {
323323

324324
if (paramCfg.default) {
325325
result.defaultValue = paramCfg.default;
326-
if (result.type === 'Float') {
326+
if (result.type === 'Float' || result.type === 'Int') {
327327
const defaultNumber = Number(result.defaultValue);
328328
if (Number.isNaN(defaultNumber)) {
329329
// Handle broken data where default is not valid for the given type
@@ -332,6 +332,9 @@ export default class ElasticApiParser {
332332
} else {
333333
result.defaultValue = defaultNumber;
334334
}
335+
} else if (result.type === 'Boolean') {
336+
const t = result.defaultValue;
337+
result.defaultValue = t === 'true' || t === '1' || t === true;
335338
}
336339
} else if (fieldName === 'format') {
337340
result.defaultValue = 'json';

0 commit comments

Comments
 (0)