Open evetion opened 1 year ago
No, it only appears in from_toml
, I haven't thought much how this information be propagated into from_dict
, so if you need to preprocess something you should overload from_toml
, could you elaborate on your use cases a bit more? for example by providing an example
So somewhere in from_dict
the key #metadata#
is ignored? I'd assumed it would throw InvalidKeyError
?
could you elaborate on your use cases a bit more
An example would be a toml:
path = "relative.file" # relative path
Such a path
can be absolute or relative. In case it's relative, it can be assumed it's relative to the TOML file itself. However, this foldername is not accessible on construction (or when overloading from_dict(::Type{MyType}, ::Type{SystemPath}, s)
), but is precisely what you pass in d["#metadata#"]["dir"]
in from_toml
.
Yes, it's ignored by validation, this is a special field to give you access to that
I think this field should always be available if you construct using from_toml
etc
Ok, but how would one access the #metadata#
key? Naming such an field in my custom type is not directly possible.
ah, you need to overload your custom from_dict
, it will not appear in your custom type by default, it's a meta info only used by the parsers
I'm using from_toml, and it would be nice to be able to override construction with the path of the toml file (e.g. when paths in the TOML are relative to the TOML itself). Could it be passed in a user defined
from_dict()
method?Otherwise it's unclear to me where the #metadata# key ends up in
from_dict
.