The fmf.Tree constructor could be re-worked go like: fmf.Tree.__new__() -> files -> fmf.RawTree (collector/parser/operator) -> json_validator (also populates default) -> final fmf.Tree (subclass) -> tmt consumes it
If we go for attrs, that would be in between json_validator and constructing the fmf.Tree, where depending on which schema is validated, the appropriate subclass of fmf.Tree (e.g. tmt.plan) is constructed which would be an attrs.define decorated subclass. Additional converters, validators would come from attrs after that.
Proposal
The
fmf.Tree
constructor could be re-worked go like:fmf.Tree.__new__()
->files
->fmf.RawTree
(collector/parser/operator) ->json_validator
(also populatesdefault
) -> finalfmf.Tree
(subclass) ->tmt
consumes itIf we go for
attrs
, that would be in betweenjson_validator
and constructing thefmf.Tree
, where depending on whichschema
is validated, the appropriate subclass offmf.Tree
(e.g.tmt.plan
) is constructed which would be anattrs.define
decorated subclass. Additional converters, validators would come fromattrs
after that.