accordproject / concerto

Business schema language and runtime
https://concerto.accordproject.org
Apache License 2.0
122 stars 107 forks source link

Introspect classes for imports and decorator support #944

Open dselman opened 1 week ago

dselman commented 1 week ago

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:

  1. Import (abstract) which extends Decorated, to support decorators on imports
  2. ImportAll (for wildcard imports)
  3. ImportTypes (for a list of imported types, with aliases)

Context

Working on #931 it is clear that the way we manage imports within ModelFile needs to be refactored.

Detailed Description