A list of configs as data class type #15
Answered
by
dwsmith1983
dwsmith1983
asked this question in
Q&A
-
I am now considering a list configs. I am not sure if this works already but I seemed unsuccessful so far. I am looking at adding this feature unless I am missing it. I was looking at the list implementation if origin is list:
if len(args) != 1:
raise MissingTypeException("expected list with type information: List[?]")
if value is not None:
return [__parse(v, args[0], f"{path}[]") for v in value]
return None I ran a few tests with the dataconf package but doesn't look to work if given @dataclass
class Parse:
input_source: InputType()
@dataclass
class Params:
datum: List[Parse]
str_conf = """
{
datum: [
input_source {
table_name: schema.table
},
input_source {
table_name: schema.table_two
}
]
}
""" |
Beta Was this translation helpful? Give feedback.
Answered by
dwsmith1983
Aug 30, 2021
Replies: 1 comment
-
I found my issue. No need to name the second level config in the list so the the Parse class can be dropped as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dwsmith1983
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found my issue. No need to name the second level config in the list so the the Parse class can be dropped as well.