Relax kadet output type requirement. #710
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed Changes
There is 2 issues with requiring
BaseObj
in kadet.BaseObj
as return type for main()kadet Input expects just a mapping of filename ->
dict
. Requiring aBaseObj
is confusing as it implies kadet expects a single object and not a list of files. This change adds support for rawdict
as return type. It simplifies implementation of kadet modules as it remove the need to build aBaseObj
just to returns a mapping of filenames toBaseObj
.For instance, the nginx example may be rewrite as:
instead of
BaseObj
as a required type for generated objects.While using
BaseObj
may be convenient to build a complex nesteddict
, this is not the single way to generate such structure, and imposing it prevents exploring other frameworks. This change also relax this restriction and support simpledict
in addition ofBaseObj
so any generator/kadet module would be able to generatesdict
as they see fit.