Closed pkese closed 5 years ago
Hi Peter,
Quick answer from the breakfast table. If a value for an 'option' is not present, it will be evaluated to 'None'. The lib can't determine whether something is a misspelling or absent. The lib does complain when mandatory values are missing.
I'll be back for your other questions.
Regards, Frank
Verstuurd vanaf mijn iPad
Op 12 nov. 2018 om 00:36 heeft Peter Keše notifications@github.com<mailto:notifications@github.com> het volgende geschreven:
Having defined a type
type Contact = { name: string phone: string option // phone is optional }
And a yaml document
name: Paul
ophne: 111-222-333 # note mistyped key ophne
instead of phone
...deserializaton with Deserialize
It would be beneficial if there was an alternative strict version of Deserialize that would fail (or warn) on any keys that don't adhere to the schema.
P.S. Is there a way to somehow get this functionality in the advanced (Parser + Mapper) mode? I didn't notice it in the documentation.
P.P.S. It's a great library btw... Sorry for complaining so much ;-)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/fjoppe/Legivel/issues/8, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AJjLdPUjVvWVVRZhJHCOqp4e-jIUio-zks5uuLRogaJpZM4YYwMY.
Frank,
Thanks for the answer. Missing optional values are not really a problem - that's expected. The thing that is not expected is appearance of keys, that are not defined anywhere in the schema (i.e. F#).
Cheers,
I hope you enjoyed your breakfast nevertheless ;)
So if I understand correctly, if there are values in the yaml, which do not map to anything in the target-model, you want to be notified (ie warn or error). Such a cross check shouldn’t be too hard I think.
And ofcours this should be a configurable mapping mode, in the Mapper (which uses the Parser).
This is currently not a feature, but I agree it would be a nice one. I can't give a schedule, but I'll certainly will have a look at this.
Hi,
This issue has been addressed in Legivel 0.2.2, which is now on Nuget. Please check the documentation.
Regards
This issue is now closed.
Having defined a type
And a yaml document
...deserializaton with
Deserialize<Contact>(yaml)
doesn't fail or warn on mismatching keys so a mistyped entry would pass unnoticed possibly causing semantic errors.It would be beneficial if there was an alternative strict version of Deserialize that would fail (or warn) on any keys that don't adhere to the schema.
P.S. Is there a way to somehow get this functionality in the advanced (Parser + Mapper) mode? I didn't notice it in the documentation.
P.P.S. It's a great library btw... Sorry for complaining so much ;-)