kopia lustrzana https://github.com/OpenDroneMap/NodeODM
Make sure enum values always contain the default value
rodzic
29f41e4874
commit
ac26c16ca6
|
@ -95,17 +95,21 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(values.choices)){
|
|
||||||
type = "enum";
|
|
||||||
domain = values.choices;
|
|
||||||
}
|
|
||||||
|
|
||||||
help = help.replace(/\%\(default\)s/g, value);
|
|
||||||
|
|
||||||
// In the end, all values must be converted back
|
// In the end, all values must be converted back
|
||||||
// to strings (per OpenAPI spec which doesn't allow mixed types)
|
// to strings (per OpenAPI spec which doesn't allow mixed types)
|
||||||
value = String(value);
|
value = String(value);
|
||||||
|
|
||||||
|
if (Array.isArray(values.choices)){
|
||||||
|
type = "enum";
|
||||||
|
domain = values.choices;
|
||||||
|
|
||||||
|
// Make sure that the default value
|
||||||
|
// is in the list of choices
|
||||||
|
if (domain.indexOf(value) === -1) domain.unshift(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
help = help.replace(/\%\(default\)s/g, value);
|
||||||
|
|
||||||
odmOptions.push({
|
odmOptions.push({
|
||||||
name, type, value, domain, help
|
name, type, value, domain, help
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue