Refactor the code to introduce classes to represent imports.
Use Case
Imports are getting increasingly complex (import *, import single type, import multiple types, with aliasing). Before we introduce semver range support for imports we should refactor the code to make imports a first class element in introspect.
In addition we have a need to support decorators on imports.
Possible Solution
Add three new classes:
Import (abstract) which extends Decorated, to support decorators on imports
ImportAll (for wildcard imports)
ImportTypes (for a list of imported types, with aliases)
[ ] Update parser to support decorators on imports
[ ] Refactor AST parsing and validation.
[ ] Refactor ModelFile to use the new introspect classes, maintaining API compatibility.
Context
Working on #931 it is clear that the way we manage imports within ModelFile needs to be refactored.
Feature Request 🛍️
Refactor the code to introduce classes to represent imports.
Use Case
Imports are getting increasingly complex (import *, import single type, import multiple types, with aliasing). Before we introduce semver range support for imports we should refactor the code to make imports a first class element in introspect.
In addition we have a need to support decorators on imports.
Possible Solution
Add three new classes:
Decorated
, to support decorators on importsContext
Working on #931 it is clear that the way we manage imports within ModelFile needs to be refactored.
Detailed Description