typst / hayagriva

Rusty bibliography management.
Apache License 2.0
343 stars 54 forks source link

Warn for unknown YAML fields #108

Open MaxGietl opened 11 months ago

MaxGietl commented 11 months ago

Starting with hayagriva I was confused why some fields (eg. translator) that are variables in CSL wouldn't do anything when added to my entries. The answer of course is to RTFM (which I did eventually and that's where I learned about affiliated) but an error message telling me the field name was invalid would have spared my sanity quite a bit.

That's why I'm asking whether it would make sense to add #[serde(deny_unknown_fields)] to the NakedEntry struct that is used for deserialization.

I realize this could make it more annoying when using a yaml file for a newer version with an old version of hayagriva, but I for one would like to know if some information is getting omitted. The other problem I can think of is people storing additional information in those files that isn't supposed to be read by hayagriva, is that something someone does?

DerDrodt commented 11 months ago

I don't think it should be as strict. Throwing an error for an unknown field is too extreme imo. Especially, if some details of the format change in the future. Would you be fine with a warning for an unknown field?

MaxGietl commented 11 months ago

Yes, that would definitely work! As long as it's getting displayed somewhere