missing field support (not sure if we will use this)
This commit is contained in:
parent
3d9490de82
commit
c2e2778d77
|
@ -1454,6 +1454,7 @@ pub const ParseOptions = struct {
|
||||||
allow_camel_case_conversion: bool = false,
|
allow_camel_case_conversion: bool = false,
|
||||||
allow_snake_case_conversion: bool = false,
|
allow_snake_case_conversion: bool = false,
|
||||||
allow_unknown_fields: bool = false,
|
allow_unknown_fields: bool = false,
|
||||||
|
allow_missing_fields: bool = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn camelCaseComp(field: []const u8, key: []const u8, options: ParseOptions) !bool {
|
fn camelCaseComp(field: []const u8, key: []const u8, options: ParseOptions) !bool {
|
||||||
|
@ -1682,6 +1683,7 @@ fn parseInternal(comptime T: type, token: Token, tokens: *TokenStream, options:
|
||||||
@field(r, field.name) = default;
|
@field(r, field.name) = default;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!options.allow_missing_fields)
|
||||||
return error.MissingField;
|
return error.MissingField;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user