media-io / yaserde

Yet Another Serializer/Deserializer
MIT License
174 stars 58 forks source link

Fields mandatory unless specified otherwise #145

Closed Wassasin closed 4 months ago

Wassasin commented 2 years ago

Implements #144.

Not happy yet with how some of the error handling is taking place. Most notably optional structs are set to None if they do not parse successfully.

Secondly this change is a major move from the current semantics of the crate. There should be a discussion on whether this is acceptable at all, and how to communicate clearly to users that whilst their code may still compile, input data will be rejected unless #[yaserde(default)] is added here and there.

reknih commented 1 year ago

I like this PR. We would like to use yaserde to deserialize CSL files with citationberg. Many CSL fields are mandatory and have no sane default so the parsing should fail for them.

MarcAntoine-Arnaud commented 5 months ago

@Wassasin I have updated the project, and now this feature is supported. Fell free to comment, test the version 0.10.

lfpraca commented 4 months ago

Feature seems to be working OK, returns err on missing fields