Roger-luo / Configurations.jl

Options & Configurations made easy.
https://configurations.rogerluo.dev/stable
MIT License
80 stars 12 forks source link

support parsing type reflection #48

Closed Roger-luo closed 3 years ago

Roger-luo commented 3 years ago

in most schema specifications, such as OpenAPI, we have something like following

[option]
type="TypeA"
fields="abc"

where the option type is specified via a type option that accepts the type name, this should be mapped to a Julia struct like following

@option struct TypeA
    type::Refect
    fields::String
end

@option struct TypeB
    type::Refect
    fields::String
    extra::String
end

@option struct Setting
   option::Union{TypeA, TypeB}
end