Open ziima opened 3 years ago
I think this is too similar to DictSetting
. Why not just expand DictSetting
to handle complex value types? It can already handle simple type check.
The complex type is another Setting
, which has completely different interface than just generic type.
Or do you have any particular solution in mind?
The interface of the inner type is different, that's true. But I think we don't have to make the appsettings API more complicated. It seems to be quite confusing to have DictSetting
and MappingSetting
that do basically the same thing and differ only in their values types.
The MappingSetting
is a form of a nested setting. It might be more adequate to modify NestedDictSetting
instead, but it requires changes in the core anyway.
NestedDictSetting
is different, because it restricts the key set, unlike the setting you want. On the other hand, DictSetting
does not restrict the key set. DictSetting
is much more similar to what you want from the API point of view (the implementation would need to change a lot, I agree).
NestedDictSetting
unlike DictSetting
is designed to contain another Setting
within. In my opinion that's quite close also from the API point of view.
We have a
DictSetting
and aNestedDictSetting
, but we lack a setting which would define a dictionary with specific values, but various keys, such asCACHES
andDATABASES
.I suggest a name
MappingSetting
, example: