flyx / NimYAML

YAML implementation for Nim
https://nimyaml.org
Other
191 stars 36 forks source link

More control when loading objects / Merely extending objects #43

Closed davidnorthetal closed 7 years ago

davidnorthetal commented 7 years ago

Currently it seems whenever I load a single object from a file that specifies additional fields that don't correspond to any of the object an exception is thrown and it aborts.

I'm within a use-case where I wouldn't mind excessive fields in the file tho and would rather just skip them and proceed with loading whatever fields do fit.

AFAIS there's currently no way to achieve this.

flyx commented 7 years ago

Does ignoreInputKey help you?

davidnorthetal commented 7 years ago

Thanks for the quick response!

However, this would require me to know the fields names in advance, no? - I don't know them tho. People might just add arbitrary ones.

flyx commented 7 years ago

Well then we need an ignoreUnknownKeys :). I'll need to have a look whether that is easily implementable with the current compile-time infrastructure in the serialization module.

flyx commented 7 years ago

Things to do:

I'll try to allocate time to do this, it seems like a useful addition. However, it's not trivial and may take some time.