lonely-lockley / archinsight

Simplicity in Code, Power in Design
https://archinsight.org
GNU Affero General Public License v3.0
51 stars 5 forks source link

Implement import for Insight language #49

Closed lonely-lockley closed 9 months ago

lonely-lockley commented 1 year ago

A good way to control diagram integrity is a file import. The suggestesd syntax for this issue looks like `import . as ' Import for the same project id must be prohibited. Import should be allowed for the same or higher level. This means: one can import context level to container, but it is impossible to make inverse import. Linker in Translator service must parse and check integrity for all imported files. Imported elements must be treated as external on diagram.

lonely-lockley commented 9 months ago

Current thoughts on import syntax. A choice has to be done between a more verbose, but explicit or shorter, but probably less clear to a user option.

Suppose, there's a container diagram for system test:

container test
    service one
        name = ...

Then an explicit named import would look like this with alias:

container another
import test in container one as externalService

And without an alias if it does not clash with other id's in current file:

container another
import test2 from context two

Declared imported id's then may be referenced in links as regular id's:

container another
import test from container one as externalService
import test2 from context two

    service two
        name = ...
        links:
            -> container externalService
            -> test2

Or implicit anonymous import with shorter syntax

container another

    service two
        name = ...
        links:
            -> test from container one
lonely-lockley commented 9 months ago

Finally, I decided to implement both options to be more flexible