Fix support for bool as a field type

This commit is contained in:
Olivier 'reivilibre' 2025-07-17 21:54:28 +01:00
parent 1cb196571f
commit 02db5531d3

View File

@ -484,6 +484,8 @@ fn write_partial_impl_form_method(
let none_case = if field_info.needed {
let f_name = f.to_string();
quote!(return Err(#f_name);)
} else if field_info.ftype == FieldType::Boolean {
quote!(false)
} else {
quote!(None)
};
@ -491,7 +493,7 @@ fn write_partial_impl_form_method(
let some_case = {
let converter = converter_from_raw_to_field(f, field_info);
if field_info.needed {
if field_info.needed || field_info.ftype == FieldType::Boolean {
converter
} else if field_info.need_nonempty {
// For not-needed fields that must not be empty,