Hi everyone, I'm trying to create an architecture ...
# konsist
r
Hi everyone, I'm trying to create an architecture test with hexagonal architecture layer that can work for our whole project but I think I've run into a wall. Our project structure is like this (where context is just a directory and each bounded context is a package)
Copy code
| src
| contexts
   | users
     | user
        | application
        | domain
        | primaryadapter
        | secondaryadapter
     | profile
        | application
        | domain
        | primaryadapter
        | secondaryadapter
   | bookings
...
With my limited knowlegdge of Konsist, I'd need to create a
Layer
for each layer inside each module (user, profile) right? Is there a way to create it at least for the whole bounded context?
The only way I can think of right now to make this work would be to create something like this
Copy code
Layer("Data", "com.myapp.users.user.application..")
Layer("Data", "com.myapp.users.profile.application..")
And repeat this infinitely but with our modular monolith this'd be a nightmare and someone would forget to create the new layers when creating/refactoring a module
p
Have you tried to use the following to verify dependencies of the moduls? This can solve the problem of defining the layers for each module separately, but the dependencies between the modules you still need to model additionally.
Copy code
val application = Layer("application", "com.myapp.users..application..")
                val domain = Layer("domain", "com.myapp.users..domain..")
r
Whenever I try to create a layer with something like that I get the following error
Copy code
Layer Domain must be defined by package ending with '..'. Now: com.myapp.users.user..domain..
Looking into the Layer implementation, there's a regex that forces the string to end after two dots. Is this working for you?
p
I just made a short test and having layers containing 2 dots at the end and in between worked fine. You are using the latest version of Konsist? I can check tomorrow again.
r
I thought I had changed that, I was supposed to be on 0.15.1 but the project was at 0.13.0
It worked on 0.15.1 thanks
p
Perfect 👍